Commit c1133022 authored by Sandro Knauß's avatar Sandro Knauß 🐝
Browse files

Split decrypted and signed messagepart

parent 4dfe01a2
......@@ -920,13 +920,11 @@ public:
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
if (metaData.isSigned) {
c.insert(QStringLiteral("content"), renderSigned(mp));
} else if (node) {
if (node || mp->hasSubParts()) {
auto _htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter));
{
HTMLBlock::Ptr rBlock;
if (mp->isRoot()) {
if (node && mp->isRoot()) {
rBlock = HTMLBlock::Ptr(new RootBlock(_htmlWriter.data()));
}
renderSubParts(mp, _htmlWriter);
......@@ -956,7 +954,7 @@ public:
return html;
}
QString renderSigned(const CryptoMessagePart::Ptr &mp)
QString renderSigned(const SignedMessagePart::Ptr &mp)
{
KMime::Content *node = mp->mNode;
const auto metaData = mp->mMetaData;
......@@ -1186,29 +1184,46 @@ public:
return html;
}
QString render(const CryptoMessagePart::Ptr &mp)
QString render(const SignedMessagePart::Ptr &mp)
{
auto htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter));
const auto metaData = mp->mMetaData;
if (metaData.isEncrypted) {
if (metaData.isSigned) {
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
htmlWriter->queue(renderEncrypted(mp));
htmlWriter->queue(renderSigned(mp));
}
return htmlWriter->html;
}
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
if (mp->hasSubParts()) {
renderSubParts(mp, htmlWriter);
} else {
htmlWriter->queue(render(mp.dynamicCast<MessagePart>()));
}
}
return htmlWriter->html;
}
QString render(const CryptoMessagePart::Ptr &mp)
{
auto htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter));
const auto metaData = mp->mMetaData;
if (metaData.isSigned) {
if (metaData.isEncrypted) {
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
htmlWriter->queue(renderSigned(mp));
htmlWriter->queue(renderEncrypted(mp));
}
return htmlWriter->html;
}
......@@ -1219,7 +1234,7 @@ public:
aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
if (mp->mNode) {
if (mp->hasSubParts()) {
renderSubParts(mp, htmlWriter);
} else {
htmlWriter->queue(render(mp.dynamicCast<MessagePart>()));
......@@ -1321,6 +1336,11 @@ public:
if (mp) {
return render(mp);
}
} else if (className == QStringLiteral("MimeTreeParser::SignedMessagePart")) {
auto mp = msgPart.dynamicCast<SignedMessagePart>();
if (mp) {
return render(mp);
}
} else if (className == QStringLiteral("MimeTreeParser::CryptoMessagePart")) {
auto mp = msgPart.dynamicCast<CryptoMessagePart>();
if (mp) {
......
......@@ -4,6 +4,6 @@
* MimeTreeParser::MessagePart
* MimeTreeParser::EncapsulatedRfc822MessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::TextMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::TextMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::TextMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::AttachmentMessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......@@ -5,7 +5,7 @@
* MimeTreeParser::MessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::EncapsulatedRfc822MessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MimeMessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::AttachmentMessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
......
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::MimeMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::EncapsulatedRfc822MessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
* MimeTreeParser::MessagePartList
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::CryptoMessagePart
* MimeTreeParser::SignedMessagePart
* MimeTreeParser::TextMessagePart
* MimeTreeParser::MessagePart
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment