Changeset View
Changeset View
Standalone View
Standalone View
messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
Show First 20 Lines • Show All 1191 Lines • ▼ Show 20 Line(s) | 433 | public: | |||
---|---|---|---|---|---|
1192 | { | 1192 | { | ||
1193 | auto htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter)); | 1193 | auto htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter)); | ||
1194 | { | 1194 | { | ||
1195 | HTMLBlock::Ptr aBlock; | 1195 | HTMLBlock::Ptr aBlock; | ||
1196 | if (mp->isAttachment()) { | 1196 | if (mp->isAttachment()) { | ||
1197 | aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode())); | 1197 | aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode())); | ||
1198 | } | 1198 | } | ||
1199 | 1199 | | |||
1200 | MimeMessagePart::Ptr part(mp->mTextPart); | 1200 | Grantlee::Template t = getGrantleeTemplate(QStringLiteral(":/alternativepart.html")); | ||
1201 | if (mp->viewHtml() && mp->mHTMLPart) { | 1201 | Grantlee::Context c; | ||
1202 | part = mp->mHTMLPart; | 1202 | QObject block; | ||
1203 | } else if (mp->text().trimmed().isEmpty()) { | 1203 | | ||
1204 | part = mp->mHTMLPart; | 1204 | c.insert(QStringLiteral("block"), &block); | ||
1205 | block.setProperty("viewHtml", mp->viewHtml()); | ||||
1206 | block.setProperty("textEmpty", mp->text().trimmed().isEmpty()); | ||||
1207 | if (mp->isAttachment()) { | ||||
1208 | block.setProperty("index", mp->attachmentNode()->index().toString()); | ||||
1209 | } else { | ||||
1210 | block.setProperty("index", QStringLiteral("0")); | ||||
1205 | } | 1211 | } | ||
1206 | 1212 | | |||
1207 | htmlWriter->queue(render(part)); | 1213 | if (mp->mHTMLPart) { | ||
1214 | c.insert(QStringLiteral("htmlBlock"), render(mp->mHTMLPart)); | ||||
1215 | } | ||||
1216 | | ||||
1217 | if (mp->mTextPart) { | ||||
1218 | c.insert(QStringLiteral("textBlock"), render(mp->mTextPart)); | ||||
1219 | } | ||||
1220 | | ||||
1221 | const auto html = t->render(&c); | ||||
1222 | htmlWriter->queue(html); | ||||
1208 | } | 1223 | } | ||
1209 | return htmlWriter->html; | 1224 | return htmlWriter->html; | ||
1210 | } | 1225 | } | ||
1211 | 1226 | | |||
1212 | QString render(const CertMessagePart::Ptr &mp) | 1227 | QString render(const CertMessagePart::Ptr &mp) | ||
1213 | { | 1228 | { | ||
1214 | const GpgME::ImportResult &importResult(mp->mImportResult); | 1229 | const GpgME::ImportResult &importResult(mp->mImportResult); | ||
1215 | Grantlee::Template t = getGrantleeTemplate(QStringLiteral(":/certmessagepart.html")); | 1230 | Grantlee::Template t = getGrantleeTemplate(QStringLiteral(":/certmessagepart.html")); | ||
▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines |