Changeset View
Changeset View
Standalone View
Standalone View
messageviewer/src/viewer/bodypartformatter.cpp
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Line(s) | |||||
222 | } | 222 | } | ||
223 | 223 | | |||
224 | #define CREATE_BODY_PART_FORMATTER(subtype) \ | 224 | #define CREATE_BODY_PART_FORMATTER(subtype) \ | ||
225 | class subtype##BodyPartFormatter \ | 225 | class subtype##BodyPartFormatter \ | ||
226 | : public MessageViewer::Interface::BodyPartFormatter \ | 226 | : public MessageViewer::Interface::BodyPartFormatter \ | ||
227 | { \ | 227 | { \ | ||
228 | static const subtype##BodyPartFormatter *self; \ | 228 | static const subtype##BodyPartFormatter *self; \ | ||
229 | public: \ | 229 | public: \ | ||
230 | bool process(ObjectTreeParser *, KMime::Content *, ProcessResult &) const;\ | 230 | MessagePart::Ptr process(const Interface::BodyPart &part) const; \ | ||
231 | MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; \ | 231 | MessageViewer::Interface::BodyPartFormatter::Result format(Interface::BodyPart *, HtmlWriter *) const Q_DECL_OVERRIDE; \ | ||
232 | using MessageViewer::Interface::BodyPartFormatter::format; \ | 232 | using MessageViewer::Interface::BodyPartFormatter::format; \ | ||
233 | static const MessageViewer::Interface::BodyPartFormatter *create(); \ | 233 | static const MessageViewer::Interface::BodyPartFormatter *create(); \ | ||
234 | }; \ | 234 | }; \ | ||
235 | \ | 235 | \ | ||
236 | const subtype##BodyPartFormatter *subtype##BodyPartFormatter::self; \ | 236 | const subtype##BodyPartFormatter *subtype##BodyPartFormatter::self; \ | ||
237 | \ | 237 | \ | ||
238 | const MessageViewer::Interface::BodyPartFormatter *subtype##BodyPartFormatter::create() { \ | 238 | const MessageViewer::Interface::BodyPartFormatter *subtype##BodyPartFormatter::create() { \ | ||
239 | if ( !self ) { \ | 239 | if ( !self ) { \ | ||
240 | self = new subtype##BodyPartFormatter(); \ | 240 | self = new subtype##BodyPartFormatter(); \ | ||
241 | } \ | 241 | } \ | ||
242 | return self; \ | 242 | return self; \ | ||
243 | } \ | 243 | } \ | ||
244 | bool subtype##BodyPartFormatter::process(ObjectTreeParser *otp, KMime::Content *node, ProcessResult &result) const { \ | 244 | MessagePart::Ptr subtype##BodyPartFormatter::process(const Interface::BodyPart &part) const { \ | ||
245 | return otp->process##subtype##Subtype(node, result); \ | 245 | return part.objectTreeParser()->process##subtype##Subtype(part.content(), *part.processResult()); \ | ||
246 | } \ | 246 | } \ | ||
247 | \ | 247 | \ | ||
248 | MessageViewer::Interface::BodyPartFormatter::Result subtype##BodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const { \ | 248 | MessageViewer::Interface::BodyPartFormatter::Result subtype##BodyPartFormatter::format(Interface::BodyPart *part, HtmlWriter *writer) const { \ | ||
249 | Q_UNUSED(writer) \ | 249 | Q_UNUSED(writer) \ | ||
250 | const bool result = process(part->objectTreeParser(), part->content(), *part->processResult()); \ | 250 | MessagePart::Ptr mp = process(*part);\ | ||
251 | return result ? Ok : Failed; \ | 251 | if (!mp.isNull()) {\ | ||
252 | mp->html(false);\ | ||||
253 | return Ok;\ | ||||
254 | }\ | ||||
255 | return Failed;\ | ||||
252 | } | 256 | } | ||
253 | 257 | | |||
254 | CREATE_BODY_PART_FORMATTER(TextPlain) | 258 | CREATE_BODY_PART_FORMATTER(TextPlain) | ||
255 | CREATE_BODY_PART_FORMATTER(TextHtml) | 259 | CREATE_BODY_PART_FORMATTER(TextHtml) | ||
256 | 260 | | |||
257 | CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime) | 261 | CREATE_BODY_PART_FORMATTER(ApplicationPkcs7Mime) | ||
258 | 262 | | |||
259 | CREATE_BODY_PART_FORMATTER(MultiPartMixed) | 263 | CREATE_BODY_PART_FORMATTER(MultiPartMixed) | ||
Show All 37 Lines |