Commit af18cee9 authored by Volker Krause's avatar Volker Krause

Move the remaining attachment processing code to the corresponding BPF

parent 0b873bb5
......@@ -69,12 +69,16 @@ public:
return AsIcon;
}
// unhide the overload with three arguments
using MimeTreeParser::Interface::BodyPartFormatter::format;
void adaptProcessResult(ProcessResult &result) const override
Interface::MessagePart::Ptr process(Interface::BodyPart &part) const override
{
result.setNeverDisplayInline(true);
KMime::Content *node = part.content();
const auto mp = AttachmentMessagePart::Ptr(new AttachmentMessagePart(part.objectTreeParser(), node, false, true, part.source()->decryptMessage()));
part.processResult()->setInlineSignatureState(mp->signatureState());
part.processResult()->setInlineEncryptionState(mp->encryptionState());
part.processResult()->setNeverDisplayInline(true);
mp->setNeverDisplayInline(true);
mp->setIsImage(false);
return mp;
}
static const MimeTreeParser::Interface::BodyPartFormatter *create()
......
......@@ -221,12 +221,14 @@ bool ObjectTreeParser::processType(KMime::Content *node, ProcessResult &processR
bRendered = true;
break;
} else if (dynamic_cast<MimeTreeParser::Interface::MessagePart *>(result.data())) {
Q_ASSERT(mimeType != "application/octet-stream"); // can't happen, the above branch will be taken for that
const auto r = formatter->format(&part, result->htmlWriter());
if (r == Interface::BodyPartFormatter::AsIcon) {
processResult.setNeverDisplayInline(true);
formatter->adaptProcessResult(processResult);
mNodeHelper->setNodeDisplayedEmbedded(node, false);
const Interface::MessagePart::Ptr mp = defaultHandling(node, processResult, onlyOneMimePart);
Interface::MessagePart::Ptr mp;
processType(node, processResult, QByteArrayLiteral("application/octet-stream"), mp, onlyOneMimePart);
if (mp) {
if (auto _mp = mp.dynamicCast<MessagePart>()) {
_mp->setAttachmentFlag(node);
......
Markdown is supported
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