Changeset View
Changeset View
Standalone View
Standalone View
messageviewer/src/viewer/bodypartformatter.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 133 | { | |||
---|---|---|---|---|---|
137 | if (mp && !otp->attachmentStrategy()->inlineNestedMessages() && !otp->showOnlyOneMimePart()) { | 137 | if (mp && !otp->attachmentStrategy()->inlineNestedMessages() && !otp->showOnlyOneMimePart()) { | ||
138 | return Failed; | 138 | return Failed; | ||
139 | } else { | 139 | } else { | ||
140 | mp->html(true); | 140 | mp->html(true); | ||
141 | return Ok; | 141 | return Ok; | ||
142 | } | 142 | } | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | class MultiPartSignedBodyPartFormatter | ||||
146 | : public MessageViewer::Interface::BodyPartFormatter | ||||
147 | { | ||||
148 | public: | ||||
149 | MessagePart::Ptr process(const Interface::BodyPart &part) const; | ||||
150 | MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; | ||||
151 | using MessageViewer::Interface::BodyPartFormatter::format; | ||||
152 | static const MessageViewer::Interface::BodyPartFormatter *create(); | ||||
153 | private: | ||||
154 | static const MultiPartSignedBodyPartFormatter *self; | ||||
155 | }; | ||||
156 | | ||||
157 | const MultiPartSignedBodyPartFormatter *MultiPartSignedBodyPartFormatter::self; | ||||
158 | | ||||
159 | const MessageViewer::Interface::BodyPartFormatter *MultiPartSignedBodyPartFormatter::create() | ||||
160 | { | ||||
161 | if (!self) { | ||||
162 | self = new MultiPartSignedBodyPartFormatter(); | ||||
163 | } | ||||
164 | return self; | ||||
165 | } | ||||
166 | | ||||
167 | MessagePart::Ptr MultiPartSignedBodyPartFormatter::process(const Interface::BodyPart &part) const | ||||
168 | { | ||||
169 | return part.objectTreeParser()->processMultiPartSignedSubtype(part.content(), *part.processResult()); | ||||
170 | } | ||||
171 | | ||||
172 | MessageViewer::Interface::BodyPartFormatter::Result MultiPartSignedBodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const | ||||
173 | { | ||||
174 | Q_UNUSED(writer) | ||||
175 | MessagePart::Ptr mp = process(*part); | ||||
176 | if (!mp.isNull()) { | ||||
177 | mp->html(false); | ||||
178 | return Ok; | ||||
179 | } | ||||
180 | | ||||
181 | return Failed; | ||||
182 | } | ||||
183 | | ||||
145 | #define CREATE_BODY_PART_FORMATTER(subtype) \ | 184 | #define CREATE_BODY_PART_FORMATTER(subtype) \ | ||
146 | class subtype##BodyPartFormatter \ | 185 | class subtype##BodyPartFormatter \ | ||
147 | : public MessageViewer::Interface::BodyPartFormatter \ | 186 | : public MessageViewer::Interface::BodyPartFormatter \ | ||
148 | { \ | 187 | { \ | ||
149 | static const subtype##BodyPartFormatter *self; \ | 188 | static const subtype##BodyPartFormatter *self; \ | ||
150 | public: \ | 189 | public: \ | ||
151 | bool process(ObjectTreeParser *, KMime::Content *, ProcessResult &) const;\ | 190 | bool process(ObjectTreeParser *, KMime::Content *, ProcessResult &) const;\ | ||
152 | MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; \ | 191 | MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; \ | ||
Show All 24 Lines | |||||
177 | //CREATE_BODY_PART_FORMATTER(TextEnriched) | 216 | //CREATE_BODY_PART_FORMATTER(TextEnriched) | ||
178 | 217 | | |||
179 | CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime) | 218 | CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime) | ||
180 | CREATE_BODY_PART_FORMATTER(ApplicationChiasmusText) | 219 | CREATE_BODY_PART_FORMATTER(ApplicationChiasmusText) | ||
181 | //CREATE_BODY_PART_FORMATTER(ApplicationPgp) | 220 | //CREATE_BODY_PART_FORMATTER(ApplicationPgp) | ||
182 | 221 | | |||
183 | CREATE_BODY_PART_FORMATTER(MultiPartMixed) | 222 | CREATE_BODY_PART_FORMATTER(MultiPartMixed) | ||
184 | CREATE_BODY_PART_FORMATTER(MultiPartAlternative) | 223 | CREATE_BODY_PART_FORMATTER(MultiPartAlternative) | ||
185 | CREATE_BODY_PART_FORMATTER(MultiPartSigned) | | |||
186 | CREATE_BODY_PART_FORMATTER(MultiPartEncrypted) | 224 | CREATE_BODY_PART_FORMATTER(MultiPartEncrypted) | ||
187 | 225 | | |||
188 | typedef TextPlainBodyPartFormatter ApplicationPgpBodyPartFormatter; | 226 | typedef TextPlainBodyPartFormatter ApplicationPgpBodyPartFormatter; | ||
189 | 227 | | |||
190 | #undef CREATE_BODY_PART_FORMATTER | 228 | #undef CREATE_BODY_PART_FORMATTER | ||
191 | } // anon namespace | 229 | } // anon namespace | ||
192 | 230 | | |||
193 | // FIXME: port some more BodyPartFormatters to Interface::BodyPartFormatters | 231 | // FIXME: port some more BodyPartFormatters to Interface::BodyPartFormatters | ||
Show All 30 Lines |