Commit 0e021e3f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor optimization

parent 60d8b4f7
Pipeline #25539 failed with stage
in 69 minutes and 13 seconds
...@@ -549,10 +549,11 @@ public: ...@@ -549,10 +549,11 @@ public:
msg->date()->setDateTime(QDateTime::currentDateTime()); msg->date()->setDateTime(QDateTime::currentDateTime());
if (MessageViewer::MessageViewerSettings::self()->legacyBodyInvites()) { if (MessageViewer::MessageViewerSettings::self()->legacyBodyInvites()) {
msg->contentType()->setMimeType("text/calendar"); auto ct = msg->contentType(); //create
msg->contentType()->setCharset("utf-8"); ct->setMimeType("text/calendar");
msg->contentType()->setName(QStringLiteral("cal.ics"), "utf-8"); ct->setCharset("utf-8");
msg->contentType()->setParameter(QStringLiteral("method"), QStringLiteral("reply")); ct->setName(QStringLiteral("cal.ics"), "utf-8");
ct->setParameter(QStringLiteral("method"), QStringLiteral("reply"));
KMime::Headers::ContentDisposition *disposition = new KMime::Headers::ContentDisposition; KMime::Headers::ContentDisposition *disposition = new KMime::Headers::ContentDisposition;
disposition->setDisposition(KMime::Headers::CDinline); disposition->setDisposition(KMime::Headers::CDinline);
...@@ -574,8 +575,9 @@ public: ...@@ -574,8 +575,9 @@ public:
KMime::Content *bodyMessage = new KMime::Content; KMime::Content *bodyMessage = new KMime::Content;
KMime::Headers::ContentDisposition *bodyDisposition = new KMime::Headers::ContentDisposition; KMime::Headers::ContentDisposition *bodyDisposition = new KMime::Headers::ContentDisposition;
bodyDisposition->setDisposition(KMime::Headers::CDinline); bodyDisposition->setDisposition(KMime::Headers::CDinline);
bodyMessage->contentType()->setMimeType("text/plain"); auto bodyMessageCt = bodyMessage->contentType();
bodyMessage->contentType()->setCharset("utf-8"); bodyMessageCt->setMimeType("text/plain");
bodyMessageCt->setCharset("utf-8");
bodyMessage->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr); bodyMessage->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr);
const QString answer = i18n("Invitation answer attached."); const QString answer = i18n("Invitation answer attached.");
bodyMessage->setBody(answer.toUtf8()); bodyMessage->setBody(answer.toUtf8());
...@@ -586,10 +588,11 @@ public: ...@@ -586,10 +588,11 @@ public:
KMime::Content *attachMessage = new KMime::Content; KMime::Content *attachMessage = new KMime::Content;
KMime::Headers::ContentDisposition *attachDisposition = new KMime::Headers::ContentDisposition; KMime::Headers::ContentDisposition *attachDisposition = new KMime::Headers::ContentDisposition;
attachDisposition->setDisposition(KMime::Headers::CDattachment); attachDisposition->setDisposition(KMime::Headers::CDattachment);
attachMessage->contentType()->setMimeType("text/calendar"); auto attachCt = attachMessage->contentType();
attachMessage->contentType()->setCharset("utf-8"); attachCt->setMimeType("text/calendar");
attachMessage->contentType()->setName(QStringLiteral("cal.ics"), "utf-8"); attachCt->setCharset("utf-8");
attachMessage->contentType()->setParameter(QStringLiteral("method"), attachCt->setName(QStringLiteral("cal.ics"), "utf-8");
attachCt->setParameter(QStringLiteral("method"),
QStringLiteral("reply")); QStringLiteral("reply"));
attachMessage->setHeader(attachDisposition); attachMessage->setHeader(attachDisposition);
attachMessage->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr); attachMessage->contentTransferEncoding()->setEncoding(KMime::Headers::CEquPr);
......
...@@ -73,8 +73,9 @@ public: ...@@ -73,8 +73,9 @@ public:
return false; return false;
} }
if (mp->content()->contentType()->mimeType() != QByteArrayLiteral("application/vnd.ms-tnef") const QByteArray mimetype = mp->content()->contentType()->mimeType();
&& mp->content()->contentType()->mimeType() != QByteArrayLiteral("application/ms-tnef")) { if (mimetype != QByteArrayLiteral("application/vnd.ms-tnef")
&& mimetype != QByteArrayLiteral("application/ms-tnef")) {
return false; return false;
} }
......
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