summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp')
-rw-r--r--framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp b/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp
index 882dfc05..d4dfd647 100644
--- a/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp
+++ b/framework/src/domain/mime/mimetreeparser/bodypartformatter_impl.cpp
@@ -115,14 +115,25 @@ const HeadersBodyPartFormatter *HeadersBodyPartFormatter::self = nullptr;
115class MultiPartRelatedBodyPartFormatter: public MimeTreeParser::Interface::BodyPartFormatter { 115class MultiPartRelatedBodyPartFormatter: public MimeTreeParser::Interface::BodyPartFormatter {
116 static const MultiPartRelatedBodyPartFormatter *self; 116 static const MultiPartRelatedBodyPartFormatter *self;
117public: 117public:
118 MessagePart::Ptr process(Interface::BodyPart &part) const Q_DECL_OVERRIDE { 118
119 QVector<MessagePart::Ptr> processList(Interface::BodyPart &part) const Q_DECL_OVERRIDE {
119 if (part.content()->contents().isEmpty()) { 120 if (part.content()->contents().isEmpty()) {
120 return MessagePart::Ptr(); 121 return {};
121 } 122 }
122 //We rely on the order of the parts. 123 //We rely on the order of the parts.
123 //Theoretically there could also be a Start parameter which would break this.. 124 //Theoretically there could also be a Start parameter which would break this..
124 //https://tools.ietf.org/html/rfc2387#section-4 125 //https://tools.ietf.org/html/rfc2387#section-4
125 return MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), part.content()->contents().at(0), true)); 126
127 //We want to display attachments even if displayed inline.
128 QVector<MessagePart::Ptr> list;
129 list.append(MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), part.content()->contents().at(0), true)));
130 for (int i = 1; i < part.content()->contents().size(); i++) {
131 auto p = part.content()->contents().at(i);
132 if (KMime::isAttachment(p)) {
133 list.append(MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), p, true)));
134 }
135 }
136 return list;
126 } 137 }
127 138
128 static const MimeTreeParser::Interface::BodyPartFormatter *create() { 139 static const MimeTreeParser::Interface::BodyPartFormatter *create() {
@@ -142,9 +153,6 @@ public:
142 if (part.content()->contents().isEmpty()) { 153 if (part.content()->contents().isEmpty()) {
143 return {}; 154 return {};
144 } 155 }
145 //FIXME sometimes we get attachments in here as well
146 //TODO look for attachment parts anyways
147 // normal treatment of the parts in the mp/mixed container
148 return MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), part.content()->contents().at(0), false)); 156 return MimeMessagePart::Ptr(new MimeMessagePart(part.objectTreeParser(), part.content()->contents().at(0), false));
149 } 157 }
150 158