summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandro Knauß <sknauss@kde.org>2016-11-09 11:18:54 +0100
committerSandro Knauß <sknauss@kde.org>2016-11-09 11:19:07 +0100
commit4795cb5ce35fa74d00976b972edcc4b84d296a34 (patch)
treeae87922609f169b81d3babd2e2cbac62214e65ac
parent96c0b73e6086fabb002eb82b76cdd9929d65e43e (diff)
downloadkube-4795cb5ce35fa74d00976b972edcc4b84d296a34.tar.gz
kube-4795cb5ce35fa74d00976b972edcc4b84d296a34.zip
Generate correct contents for AttachmentsParts
-rw-r--r--framework/domain/mimetreeparser/interface.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/framework/domain/mimetreeparser/interface.cpp b/framework/domain/mimetreeparser/interface.cpp
index 181aa0a9..283ced9b 100644
--- a/framework/domain/mimetreeparser/interface.cpp
+++ b/framework/domain/mimetreeparser/interface.cpp
@@ -805,10 +805,19 @@ void SinglePartPrivate::fillFrom(MimeTreeParser::HtmlMessagePart::Ptr part)
805 805
806void SinglePartPrivate::fillFrom(MimeTreeParser::AttachmentMessagePart::Ptr part) 806void SinglePartPrivate::fillFrom(MimeTreeParser::AttachmentMessagePart::Ptr part)
807{ 807{
808 q->reachParentD()->createMailMime(part.staticCast<MimeTreeParser::TextMessagePart>()); 808 QMimeDatabase mimeDb;
809 mType = q->mailMime()->mimetype().name().toUtf8(); 809 q->reachParentD()->createMailMime(part.staticCast<MimeTreeParser::TextMessagePart>());
810 mContent.clear(); 810 const auto mimetype = q->mailMime()->mimetype();
811 mContent.append(std::make_shared<Content>(q->mailMime()->decodedContent(), q)); 811 const auto content = q->mailMime()->decodedContent();
812 mType = mimetype.name().toUtf8();
813 mContent.clear();
814 if (mimetype == mimeDb.mimeTypeForName("text/plain")) {
815 mContent.append(std::make_shared<PlainTextContent>(content, q));
816 } else if (mimetype == mimeDb.mimeTypeForName("text/html")) {
817 mContent.append(std::make_shared<HtmlContent>(content, q));
818 } else {
819 mContent.append(std::make_shared<Content>(content, q));
820 }
812} 821}
813 822
814SinglePart::SinglePart() 823SinglePart::SinglePart()
@@ -978,16 +987,13 @@ QVector<Part::Ptr> Parser::collectContentParts() const
978 } 987 }
979 988
980 const auto ctname = mime->mimetype().name().trimmed().toLower(); 989 const auto ctname = mime->mimetype().name().trimmed().toLower();
981 bool mightContent = false; 990 bool mightContent = (content->type() != "Content"); //Content we understand
982
983 if (ctname.startsWith("text/") || ctname.startsWith("image/") || ctname.isEmpty()) {
984 mightContent = true;
985 }
986 991
987 const auto cd = mime->disposition(); 992 const auto cd = mime->disposition();
988 if (cd && cd == MailMime::Inline) { 993 if (cd && cd == MailMime::Inline) {
989 return mightContent; 994 return mightContent;
990 } 995 }
996
991 if (cd && cd == MailMime::Attachment) { 997 if (cd && cd == MailMime::Attachment) {
992 return false; 998 return false;
993 } 999 }
@@ -1039,11 +1045,7 @@ QVector<Part::Ptr> Parser::collectAttachmentParts() const
1039 } 1045 }
1040 1046
1041 const auto ctname = mime->mimetype().name().trimmed().toLower(); 1047 const auto ctname = mime->mimetype().name().trimmed().toLower();
1042 bool mightContent = false; 1048 bool mightContent = (content->type() != "Content"); //Content we understand
1043
1044 if (ctname.startsWith("text/") || ctname.startsWith("image/") || ctname.isEmpty()) {
1045 mightContent = true;
1046 }
1047 1049
1048 const auto cd = mime->disposition(); 1050 const auto cd = mime->disposition();
1049 if (cd && cd == MailMime::Inline) { 1051 if (cd && cd == MailMime::Inline) {