Commit e6ea9a3d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Other fix

parent f140496f
Pipeline #25536 passed with stage
in 58 minutes and 5 seconds
......@@ -1406,17 +1406,17 @@ void ComposerViewBase::addAttachmentPart(KMime::Content *partToAttach)
part->setData(partToAttach->decodedContent());
}
part->setMimeType(partToAttach->contentType()->mimeType());
if (partToAttach->contentDescription(false)) {
part->setDescription(partToAttach->contentDescription()->asUnicodeString());
if (auto cd = partToAttach->contentDescription(false)) {
part->setDescription(cd->asUnicodeString());
}
if (partToAttach->contentType(false)) {
if (partToAttach->contentType()->hasParameter(QStringLiteral("name"))) {
part->setName(partToAttach->contentType()->parameter(QStringLiteral("name")));
}
}
if (partToAttach->contentDisposition(false)) {
part->setFileName(partToAttach->contentDisposition()->filename());
part->setInline(partToAttach->contentDisposition()->disposition() == KMime::Headers::CDinline);
if (auto cd = partToAttach->contentDisposition(false)) {
part->setFileName(cd->filename());
part->setInline(cd->disposition() == KMime::Headers::CDinline);
}
if (part->name().isEmpty() && !part->fileName().isEmpty()) {
part->setName(part->fileName());
......
......@@ -429,9 +429,10 @@ KMime::Content *MessageFactoryNG::createForwardAttachmentMessage(const KMime::Me
KMime::Content *msgPart = new KMime::Content(fwdMsg.data());
msgPart->contentType()->setMimeType("message/rfc822");
msgPart->contentDisposition()->setParameter(QStringLiteral("filename"), i18n("forwarded message"));
msgPart->contentDisposition()->setDisposition(KMime::Headers::CDinline);
msgPart->contentDescription()->fromUnicodeString(fwdMsg->from()->asUnicodeString() + QLatin1String(": ") + fwdMsg->subject()->asUnicodeString(), "utf-8");
auto cd = msgPart->contentDisposition(); //create
cd->setParameter(QStringLiteral("filename"), i18n("forwarded message"));
cd->setDisposition(KMime::Headers::CDinline);
cd->fromUnicodeString(fwdMsg->from()->asUnicodeString() + QLatin1String(": ") + fwdMsg->subject()->asUnicodeString(), "utf-8");
msgPart->setBody(fwdMsg->encodedContent());
msgPart->assemble();
......
......@@ -89,8 +89,9 @@ KMime::Content *MessageComposer::Util::composeHeadersAndBody(KMime::Content *ori
if (sign) { // sign PGPMime, sign SMIME
if (format & Kleo::AnySMIME) { // sign SMIME
code->contentTransferEncoding()->setEncoding(KMime::Headers::CEbase64);
code->contentTransferEncoding()->needToEncode();
auto ct = code->contentTransferEncoding(); //create
ct->setEncoding(KMime::Headers::CEbase64);
ct->needToEncode();
code->setBody(encodedBody);
} else { // sign PGPMmime
setBodyAndCTE(encodedBody, orig->contentType(), code);
......@@ -114,8 +115,9 @@ KMime::Content *MessageComposer::Util::composeHeadersAndBody(KMime::Content *ori
}
} else { //enc SMIME, sign/enc SMIMEOpaque
result->contentTransferEncoding()->setEncoding(KMime::Headers::CEbase64);
result->contentDisposition()->setDisposition(KMime::Headers::CDattachment);
result->contentDisposition()->setFilename(QStringLiteral("smime.p7m"));
auto ct = result->contentDisposition(); //Create
ct->setDisposition(KMime::Headers::CDattachment);
ct->setFilename(QStringLiteral("smime.p7m"));
result->assemble();
//qCDebug(MESSAGECOMPOSER_LOG) << "processed header:" << result->head();
......
......@@ -781,7 +781,7 @@ void DefaultRendererPrivate::renderFactory(const MessagePart::Ptr &msgPart, Html
const QString className = QString::fromUtf8(msgPart->metaObject()->className());
if (isHiddenHint(msgPart)) {
QByteArray cid = msgPart->content()->contentID()->identifier();
const QByteArray cid = msgPart->content()->contentID()->identifier();
auto mp = msgPart.dynamicCast<MimeTreeParser::TextMessagePart>();
if (!cid.isEmpty() && mp) {
QString fileName = mp->temporaryFilePath();
......
......@@ -397,8 +397,8 @@ bool ViewerPrivate::deleteAttachment(KMime::Content *node, bool showWarning)
QString filename;
QString name;
QByteArray mimetype;
if (node->contentDisposition(false)) {
filename = node->contentDisposition()->filename();
if (auto cd = node->contentDisposition(false)) {
filename = cd->filename();
}
if (auto ct = node->contentType(false)) {
......@@ -408,10 +408,10 @@ bool ViewerPrivate::deleteAttachment(KMime::Content *node, bool showWarning)
// text/plain part:
KMime::Content *deletePart = new KMime::Content(parent);
deletePart->contentType()->setMimeType("text/x-moz-deleted");
deletePart->contentType()->setName(QStringLiteral("Deleted: %1").arg(name), "utf8");
deletePart->contentDisposition()->setDisposition(KMime::Headers::CDattachment);
deletePart->contentDisposition()->setFilename(QStringLiteral("Deleted: %1").arg(name));
deletePart->contentType(true)->setMimeType("text/x-moz-deleted");
deletePart->contentType(false)->setName(QStringLiteral("Deleted: %1").arg(name), "utf8");
deletePart->contentDisposition(true)->setDisposition(KMime::Headers::CDattachment);
deletePart->contentDisposition(false)->setFilename(QStringLiteral("Deleted: %1").arg(name));
deletePart->contentType()->setCharset("utf-8");
deletePart->contentTransferEncoding()->setEncoding(KMime::Headers::CE7Bit);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment