Commit 41472420 authored by Volker Krause's avatar Volker Krause

Parent Content pointer are no longer needed for KMime headers.

Will be removed from KMime shortly.
parent ae925ffd
......@@ -399,13 +399,13 @@ QString KAMail::appendBodyAttachments(KMime::Message& message, JobData& data)
// Set the content type
KMimeType::Ptr type = KMimeType::findByUrl(url);
KMime::Headers::ContentType* ctype = new KMime::Headers::ContentType(content);
KMime::Headers::ContentType* ctype = new KMime::Headers::ContentType;
ctype->fromUnicodeString(type->name(), autoDetectCharset(type->name()));
ctype->setName(attachment, "local");
content->setHeader(ctype);
// Set the encoding
KMime::Headers::ContentTransferEncoding* cte = new KMime::Headers::ContentTransferEncoding(content);
KMime::Headers::ContentTransferEncoding* cte = new KMime::Headers::ContentTransferEncoding;
cte->setEncoding(KMime::Headers::CEbase64);
cte->setDecoded(false);
content->setHeader(cte);
......
......@@ -977,7 +977,7 @@ void KMComposeWin::applyTemplate(uint uoid, uint uOldId)
if (ident.isNull()) {
return;
}
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Templates", mMsg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Templates");
header->fromUnicodeString(ident.templates(), "utf-8");
mMsg->setHeader(header);
......@@ -1655,7 +1655,7 @@ void KMComposeWin::setMessage(const KMime::Message::Ptr &newMsg, bool lastSignSt
for (int i = numNL; i > 0; --i) {
xface.insert(i * 70, QStringLiteral("\n\t"));
}
auto header = new KMime::Headers::Generic("X-Face", mMsg.data());
auto header = new KMime::Headers::Generic("X-Face");
header->fromUnicodeString(xface, "utf-8");
mMsg->setHeader(header);
}
......@@ -3019,7 +3019,7 @@ void KMComposeWin::slotIdentityChanged(uint uoid, bool initalChange)
if (ident.organization().isEmpty()) {
mMsg->organization()->clear();
} else {
KMime::Headers::Organization *const organization = new KMime::Headers::Organization(mMsg.data());
KMime::Headers::Organization *const organization = new KMime::Headers::Organization;
organization->fromUnicodeString(ident.organization(), "utf-8");
mMsg->setHeader(organization);
}
......@@ -3032,7 +3032,7 @@ void KMComposeWin::slotIdentityChanged(uint uoid, bool initalChange)
for (int i = numNL; i > 0; --i) {
xface.insert(i * 70, QStringLiteral("\n\t"));
}
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Face", mMsg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Face");
header->fromUnicodeString(xface, "utf-8");
mMsg->setHeader(header);
}
......@@ -3046,7 +3046,7 @@ void KMComposeWin::slotIdentityChanged(uint uoid, bool initalChange)
mMsg->removeHeader("X-KMail-Transport");
mComposerBase->transportComboBox()->setCurrentTransport(TransportManager::self()->defaultTransportId());
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport", mMsg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(QString::number(transport->id()), "utf-8");
mMsg->setHeader(header);
mComposerBase->transportComboBox()->setCurrentTransport(transport->id());
......@@ -3055,7 +3055,7 @@ void KMComposeWin::slotIdentityChanged(uint uoid, bool initalChange)
const bool fccIsDisabled = ident.disabledFcc();
if (fccIsDisabled) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled", mMsg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled");
header->fromUnicodeString(QStringLiteral("true"), "utf-8");
mMsg->setHeader(header);
} else {
......
......@@ -591,7 +591,7 @@ int KMKernel::openComposer(const QString &to, const QString &cc,
}
if (!inReplyTo.isEmpty()) {
KMime::Headers::InReplyTo *header = new KMime::Headers::InReplyTo(msg.data());
KMime::Headers::InReplyTo *header = new KMime::Headers::InReplyTo;
header->fromUnicodeString(inReplyTo, "utf-8");
msg->setHeader(header);
}
......@@ -746,7 +746,7 @@ bool KMKernel::fillComposer(KMail::Composer *&cWin,
msg->to()->fromUnicodeString(to, "utf-8");
}
if (identity > 0) {
KMime::Headers::Generic *h = new KMime::Headers::Generic("X-KMail-Identity", msg.data());
KMime::Headers::Generic *h = new KMime::Headers::Generic("X-KMail-Identity");
h->from7BitString(QByteArray::number(identity));
msg->setHeader(h);
}
......
......@@ -294,7 +294,7 @@ void KNotesIconViewItem::saveNoteContent(const QString &subject, const QString &
}
if (position >= 0) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Cursor-Position", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Cursor-Position");
header->fromUnicodeString(QString::number(position), "utf-8");
message->setHeader(header);
}
......
......@@ -423,7 +423,7 @@ void KNote::saveNoteContent()
message->date(true)->setDateTime(QDateTime::currentDateTime());
message->mainBodyPart()->fromUnicodeString(text().isEmpty() ? QStringLiteral(" ") : text());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Cursor-Position", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-Cursor-Position");
header->fromUnicodeString(QString::number(m_editor->cursorPositionFromStart()), "utf-8");
message->setHeader(header);
......
......@@ -278,8 +278,7 @@ bool MailClient::send(const KIdentityManagement::Identity &identity,
message->contentType()->setParameter(QStringLiteral("method"), QStringLiteral("request"));
if (!attachment.isEmpty()) {
KMime::Headers::ContentDisposition *disposition =
new KMime::Headers::ContentDisposition(message.data());
KMime::Headers::ContentDisposition *disposition = new KMime::Headers::ContentDisposition;
disposition->setDisposition(KMime::Headers::CDinline);
message->setHeader(disposition);
message->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr);
......@@ -297,8 +296,7 @@ bool MailClient::send(const KIdentityManagement::Identity &identity,
// Set the first multipart, the body message.
KMime::Content *bodyMessage = new KMime::Content;
KMime::Headers::ContentDisposition *bodyDisposition =
new KMime::Headers::ContentDisposition(bodyMessage);
KMime::Headers::ContentDisposition *bodyDisposition = new KMime::Headers::ContentDisposition;
bodyDisposition->setDisposition(KMime::Headers::CDinline);
bodyMessage->contentType()->setMimeType("text/plain");
bodyMessage->contentType()->setCharset("utf-8");
......@@ -309,8 +307,7 @@ bool MailClient::send(const KIdentityManagement::Identity &identity,
// Set the sedcond multipart, the attachment.
if (!attachment.isEmpty()) {
KMime::Content *attachMessage = new KMime::Content;
KMime::Headers::ContentDisposition *attachDisposition =
new KMime::Headers::ContentDisposition(attachMessage);
KMime::Headers::ContentDisposition *attachDisposition = new KMime::Headers::ContentDisposition;
attachDisposition->setDisposition(KMime::Headers::CDattachment);
attachMessage->contentType()->setMimeType("text/calendar");
attachMessage->contentType()->setCharset("utf-8");
......
......@@ -59,7 +59,7 @@ FilterAction::ReturnCode FilterActionAddHeader::process(ItemContext &context , b
KMime::Headers::Base *header = KMime::Headers::createHeader(mParameter.toLatin1());
if (!header) {
header = new KMime::Headers::Generic(mParameter.toLatin1(), msg.data());
header = new KMime::Headers::Generic(mParameter.toLatin1());
}
header->fromUnicodeString(mValue, "utf-8");
......
......@@ -42,7 +42,7 @@ FilterAction::ReturnCode FilterActionReplyTo::process(ItemContext &context , boo
const QByteArray replyTo("Reply-To");
KMime::Headers::Base *header = KMime::Headers::createHeader(replyTo);
if (!header) {
header = new KMime::Headers::Generic(replyTo, msg.data());
header = new KMime::Headers::Generic(replyTo);
}
header->fromUnicodeString(mParameter, "utf-8");
msg->setHeader(header);
......
......@@ -92,7 +92,7 @@ FilterAction::ReturnCode FilterActionRewriteHeader::process(ItemContext &context
KMime::Headers::Base *newheader = KMime::Headers::createHeader(param);
if (!newheader) {
newheader = new KMime::Headers::Generic(param, msg.data());
newheader = new KMime::Headers::Generic(param);
}
newheader->fromUnicodeString(newValue, "utf-8");
msg->setHeader(newheader);
......
......@@ -72,7 +72,7 @@ FilterAction::ReturnCode FilterActionSetIdentity::process(ItemContext &context ,
const KMime::Message::Ptr msg = context.item().payload<KMime::Message::Ptr>();
const uint currentId = msg->headerByType("X-KMail-Identity") ? msg->headerByType("X-KMail-Identity")->asUnicodeString().trimmed().toUInt() : 0;
if (currentId != mParameter) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity");
header->fromUnicodeString(QString::number(mParameter), "utf-8");
if (applyOnOutbound) {
msg->from()->fromUnicodeString(ident.fullEmailAddr(), "utf-8");
......
......@@ -82,7 +82,7 @@ FilterAction::ReturnCode FilterActionSetTransport::process(ItemContext &context
}
const KMime::Message::Ptr msg = context.item().payload<KMime::Message::Ptr>();
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(argsAsString(), "utf-8");
msg->setHeader(header);
msg->assemble();
......
......@@ -258,7 +258,7 @@ FilterAction::ReturnCode FilterActionWithCommand::genericProcess(ItemContext &co
const QString newUid = aMsg->headerByType("X-UID") ? aMsg->headerByType("X-UID")->asUnicodeString() : QString();
if (uid != newUid) {
aMsg->setFrozen(false);
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-UID", aMsg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-UID");
header->fromUnicodeString(uid, "utf-8");
aMsg->setHeader(header);
aMsg->assemble();
......
......@@ -336,7 +336,7 @@ void ComposerPrivate::contentJobFinished(KJob *job)
headers->setHeader(skeletonMessage->date());
headers->setHeader(skeletonMessage->messageID());
KMime::Headers::Generic *realTo = new KMime::Headers::Generic("X-KMail-EncBccRecipients", headers);
KMime::Headers::Generic *realTo = new KMime::Headers::Generic("X-KMail-EncBccRecipients");
realTo->fromUnicodeString(eJob->recipients().join(QLatin1String("%")), "utf-8");
qCDebug(MESSAGECOMPOSER_LOG) << "got one of multiple messages sending to:" << realTo->asUnicodeString();
......
......@@ -263,17 +263,17 @@ void MessageComposer::ComposerViewBase::updateTemplate(const KMime::Message::Ptr
void MessageComposer::ComposerViewBase::saveMailSettings()
{
const KIdentityManagement::Identity identity = identityManager()->identityForUoid(m_identityCombo->currentIdentity());
auto header = new KMime::Headers::Generic("X-KMail-Transport", m_msg.data());
auto header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(QString::number(m_transport->currentTransportId()), "utf-8");
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-Fcc", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-Fcc");
header->fromUnicodeString(QString::number(m_fccCollection.id()) , "utf-8");
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-Identity", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-Identity");
header->fromUnicodeString(QString::number(identity.uoid()), "utf-8");
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-Dictionary", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-Dictionary");
header->fromUnicodeString(m_dictionary->currentDictionary(), "utf-8");
m_msg->setHeader(header);
......@@ -282,14 +282,14 @@ void MessageComposer::ComposerViewBase::saveMailSettings()
if (m_editor->quotePrefixName().isEmpty()) {
m_msg->removeHeader("X-KMail-QuotePrefix");
} else {
header = new KMime::Headers::Generic("X-KMail-QuotePrefix", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-QuotePrefix");
header->fromUnicodeString(m_editor->quotePrefixName(), "utf-8");
m_msg->setHeader(header);
}
if (m_editor->composerControler()->isFormattingUsed()) {
qCDebug(MESSAGECOMPOSER_LOG) << "HTML mode";
header = new KMime::Headers::Generic("X-KMail-Markup", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-Markup");
header->fromUnicodeString(QStringLiteral("true"), "utf-8");
m_msg->setHeader(header);
} else {
......@@ -353,13 +353,13 @@ void MessageComposer::ComposerViewBase::send(MessageComposer::MessageSender::Sen
if (m_neverEncrypt && saveIn != MessageComposer::MessageSender::SaveInNone) {
// we can't use the state of the mail itself, to remember the
// signing and encryption state, so let's add a header instead
auto header = new KMime::Headers::Generic("X-KMail-SignatureActionEnabled", m_msg.data());
auto header = new KMime::Headers::Generic("X-KMail-SignatureActionEnabled");
header->fromUnicodeString(m_sign ? QLatin1String("true") : QLatin1String("false"), "utf-8");
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-EncryptActionEnabled", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-EncryptActionEnabled");
header->fromUnicodeString(m_encrypt ? QLatin1String("true") : QLatin1String("false"), "utf-8");
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-CryptoMessageFormat", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-CryptoMessageFormat");
header->fromUnicodeString(QString::number(m_cryptoMessageFormat), "utf-8");
m_msg->setHeader(header);
} else {
......@@ -457,13 +457,13 @@ void MessageComposer::ComposerViewBase::slotEmailAddressResolved(KJob *job)
unExpandedBcc << exp;
}
}
auto header = new KMime::Headers::Generic("X-KMail-UnExpanded-To", m_msg.data());
auto header = new KMime::Headers::Generic("X-KMail-UnExpanded-To");
header->from7BitString(unExpandedTo.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-UnExpanded-CC", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-UnExpanded-CC");
header->from7BitString(unExpandedCc.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
header = new KMime::Headers::Generic("X-KMail-UnExpanded-BCC", m_msg.data());
header = new KMime::Headers::Generic("X-KMail-UnExpanded-BCC");
header->from7BitString(unExpandedBcc.join(QStringLiteral(", ")).toLatin1());
m_msg->setHeader(header);
autoresizeImage = false;
......@@ -961,7 +961,7 @@ void MessageComposer::ComposerViewBase::queueMessage(KMime::Message::Ptr message
QMapIterator<QByteArray, QString> customHeader(m_customHeader);
while (customHeader.hasNext()) {
customHeader.next();
auto header = new KMime::Headers::Generic(customHeader.key(), message.data());
auto header = new KMime::Headers::Generic(customHeader.key());
header->fromUnicodeString(customHeader.value(), "utf-8");
message->setHeader(header);
}
......
......@@ -323,14 +323,14 @@ MessageFactory::MessageReply MessageFactory::createReply()
MessageCore::Util::addLinkInformation(msg, m_id, Akonadi::MessageStatus::statusReplied());
if (m_parentFolderId > 0) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc");
header->fromUnicodeString(QString::number(m_parentFolderId), "utf-8");
msg->setHeader(header);
}
if (m_origMsg->hasHeader("X-KMail-EncryptActionEnabled") &&
m_origMsg->headerByType("X-KMail-EncryptActionEnabled")->as7BitString().contains("true")) {
auto header = new KMime::Headers::Generic("X-KMail-EncryptActionEnabled", msg.data());
auto header = new KMime::Headers::Generic("X-KMail-EncryptActionEnabled");
header->fromUnicodeString(QStringLiteral("true"), "utf-8");
msg->setHeader(header);
}
......@@ -487,7 +487,7 @@ KMime::Message::Ptr MessageFactory::createResend()
uint originalIdentity = identityUoid(m_origMsg);
// Set the identity from above
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity");
header->fromUnicodeString(QString::number(originalIdentity), "utf-8");
msg->setHeader(header);
......@@ -547,59 +547,59 @@ KMime::Message::Ptr MessageFactory::createRedirect(const QString &toStr, const Q
if (MessageComposer::MessageComposerSettings::useCustomMessageIdSuffix()) {
msgIdSuffix = MessageComposer::MessageComposerSettings::customMsgIDSuffix();
}
KMime::Headers::Generic *header = new KMime::Headers::Generic("Resent-Message-ID", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("Resent-Message-ID");
header->fromUnicodeString(MessageCore::StringUtil::generateMessageId(msg->sender()->asUnicodeString(), msgIdSuffix), "utf-8");
msg->setHeader(header);
header = new KMime::Headers::Generic("Resent-Date", msg.data());
header = new KMime::Headers::Generic("Resent-Date");
header->fromUnicodeString(newDate, "utf-8");
msg->setHeader(header);
header = new KMime::Headers::Generic("Resent-From", msg.data());
header = new KMime::Headers::Generic("Resent-From");
header->fromUnicodeString(strFrom, "utf-8");
msg->setHeader(header);
if (msg->to(false)) {
KMime::Headers::To *headerT = new KMime::Headers::To(msg.data());
KMime::Headers::To *headerT = new KMime::Headers::To;
headerT->fromUnicodeString(m_origMsg->to()->asUnicodeString(), "utf-8");
msg->setHeader(headerT);
}
header = new KMime::Headers::Generic("Resent-To", msg.data());
header = new KMime::Headers::Generic("Resent-To");
header->fromUnicodeString(toStr, "utf-8");
msg->setHeader(header);
if (!ccStr.isEmpty()) {
header = new KMime::Headers::Generic("Resent-Cc", msg.data());
header = new KMime::Headers::Generic("Resent-Cc");
header->fromUnicodeString(ccStr, "utf-8");
msg->setHeader(header);
}
if (!bccStr.isEmpty()) {
header = new KMime::Headers::Generic("Resent-Bcc", msg.data());
header = new KMime::Headers::Generic("Resent-Bcc");
header->fromUnicodeString(bccStr, "utf-8");
msg->setHeader(header);
}
header = new KMime::Headers::Generic("X-KMail-Redirect-From", msg.data());
header = new KMime::Headers::Generic("X-KMail-Redirect-From");
header->fromUnicodeString(strByWayOf, "utf-8");
msg->setHeader(header);
if (transportId != -1) {
header = new KMime::Headers::Generic("X-KMail-Transport", msg.data());
header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(QString::number(transportId), "utf-8");
msg->setHeader(header);
}
if (!fcc.isEmpty()) {
header = new KMime::Headers::Generic("X-KMail-Fcc", msg.data());
header = new KMime::Headers::Generic("X-KMail-Fcc");
header->fromUnicodeString(fcc, "utf-8");
msg->setHeader(header);
}
const bool fccIsDisabled = ident.disabledFcc();
if (fccIsDisabled) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled");
header->fromUnicodeString(QStringLiteral("true"), "utf-8");
msg->setHeader(header);
} else {
......@@ -722,7 +722,7 @@ KMime::Message::Ptr MessageFactory::createMDN(KMime::MDN::ActionMode a,
receipt->to()->fromUnicodeString(receiptTo, "utf-8");
//Laurent: We don't translate subject ?
receipt->subject()->from7BitString("Message Disposition Notification");
KMime::Headers::InReplyTo *header = new KMime::Headers::InReplyTo(receipt.data());
KMime::Headers::InReplyTo *header = new KMime::Headers::InReplyTo;
header->fromUnicodeString(m_origMsg->messageID()->asUnicodeString(), "utf-8");
receipt->setHeader(header);
......
......@@ -59,14 +59,14 @@ void initFromMessage(const KMime::Message::Ptr &msg, const KMime::Message::Ptr &
if (idHeaders) {
MessageHelper::initHeader(msg, identMan, id);
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity");
header->fromUnicodeString(QString::number(id), "utf-8");
msg->setHeader(header);
}
if (origMsg->headerByType("X-KMail-Transport")) {
const QString transport = origMsg->headerByType("X-KMail-Transport")->asUnicodeString();
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport", msg.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(transport, "utf-8");
msg->setHeader(header);
}
......@@ -110,7 +110,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.organization().isEmpty()) {
message->removeHeader("Organization");
} else {
KMime::Headers::Organization *const organization = new KMime::Headers::Organization(message.data());
KMime::Headers::Organization *const organization = new KMime::Headers::Organization;
organization->fromUnicodeString(ident.organization(), "utf-8");
message->setHeader(organization);
}
......@@ -118,7 +118,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.isDefault()) {
message->removeHeader("X-KMail-Identity");
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Identity");
header->fromUnicodeString(QString::number(ident.uoid()), "utf-8");
message->setHeader(header);
}
......@@ -126,7 +126,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.transport().isEmpty()) {
message->removeHeader("X-KMail-Transport");
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Transport");
header->fromUnicodeString(ident.transport(), "utf-8");
message->setHeader(header);
}
......@@ -134,7 +134,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.fcc().isEmpty()) {
message->removeHeader("X-KMail-Fcc");
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc");
header->fromUnicodeString(ident.fcc(), "utf-8");
message->setHeader(header);
}
......@@ -142,7 +142,7 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.drafts().isEmpty()) {
message->removeHeader("X-KMail-Drafts");
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Drafts", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Drafts");
header->fromUnicodeString(ident.drafts(), "utf-8");
message->setHeader(header);
}
......@@ -150,13 +150,13 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
if (ident.templates().isEmpty()) {
message->removeHeader("X-KMail-Templates");
} else {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Templates", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Templates");
header->fromUnicodeString(ident.templates(), "utf-8");
message->setHeader(header);
}
if (ident.disabledFcc()) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled", message.data());
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-FccDisabled");
header->fromUnicodeString(QLatin1String("true"), "utf-8");
message->setHeader(header);
} else {
......
......@@ -179,25 +179,19 @@ void SinglepartJob::process()
// Set headers.
if (d->contentDescription) {
d->resultContent->setHeader(d->contentDescription);
d->contentDescription->setParent(d->resultContent);
}
if (d->contentDisposition) {
d->resultContent->setHeader(d->contentDisposition);
d->contentDisposition->setParent(d->resultContent);
}
if (d->contentID) {
d->resultContent->setHeader(d->contentID);
d->contentID->setParent(d->resultContent);
}
Q_ASSERT(d->contentTransferEncoding); // chooseCTE() created it if it didn't exist.
{
d->resultContent->setHeader(d->contentTransferEncoding);
d->contentTransferEncoding->setParent(d->resultContent);
}
if (d->contentType) {
d->resultContent->setHeader(d->contentType);
d->contentType->setParent(d->resultContent);
}
// Set data.
......
......@@ -68,7 +68,7 @@ void SkeletonMessageJobPrivate::doStart()
// From:
{
KMime::Headers::From *from = new KMime::Headers::From(message);
KMime::Headers::From *from = new KMime::Headers::From;
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(infoPart->from()));
from->addAddress(address);
......@@ -77,7 +77,7 @@ void SkeletonMessageJobPrivate::doStart()
// To:
{
KMime::Headers::To *to = new KMime::Headers::To(message);
KMime::Headers::To *to = new KMime::Headers::To;
foreach (const QString &a, infoPart->to()) {
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(a));
......@@ -88,7 +88,7 @@ void SkeletonMessageJobPrivate::doStart()
// Reply To:
if (!infoPart->replyTo().isEmpty()) {
KMime::Headers::ReplyTo *replyTo = new KMime::Headers::ReplyTo(message);
KMime::Headers::ReplyTo *replyTo = new KMime::Headers::ReplyTo;
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(infoPart->replyTo()));
replyTo->addAddress(address);
......@@ -97,7 +97,7 @@ void SkeletonMessageJobPrivate::doStart()
// Cc:
{
KMime::Headers::Cc *cc = new KMime::Headers::Cc(message);
KMime::Headers::Cc *cc = new KMime::Headers::Cc;
foreach (const QString &a, infoPart->cc()) {
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(a));
......@@ -108,7 +108,7 @@ void SkeletonMessageJobPrivate::doStart()
// Bcc:
{
KMime::Headers::Bcc *bcc = new KMime::Headers::Bcc(message);
KMime::Headers::Bcc *bcc = new KMime::Headers::Bcc;
foreach (const QString &a, infoPart->bcc()) {
KMime::Types::Mailbox address;
address.fromUnicodeString(KEmailAddress::normalizeAddressesAndEncodeIdn(a));
......@@ -119,7 +119,7 @@ void SkeletonMessageJobPrivate::doStart()
// Subject:
{
KMime::Headers::Subject *subject = new KMime::Headers::Subject(message);
KMime::Headers::Subject *subject = new KMime::Headers::Subject;
subject->fromUnicodeString(infoPart->subject(), "utf-8");
// TODO should we be more specific about the charset?
message->setHeader(subject);
......@@ -127,21 +127,21 @@ void SkeletonMessageJobPrivate::doStart()
// Date:
{
KMime::Headers::Date *date = new KMime::Headers::Date(message);
KMime::Headers::Date *date = new KMime::Headers::Date;
date->setDateTime(QDateTime::currentDateTime());
message->setHeader(date);
}
// Fcc:
if (!infoPart->fcc().isEmpty()) {
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc", message);
KMime::Headers::Generic *header = new KMime::Headers::Generic("X-KMail-Fcc");
header->fromUnicodeString(infoPart->fcc(), "utf-8");
message->setHeader(header);
}