diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-29 17:27:31 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-06-29 17:27:31 +0200 |
commit | d81eea635c2151c2c9c62a53c08e427c38ad0acd (patch) | |
tree | 3dc1eda9702f060eac17581b74c7b848dcc7301c /framework/src/domain/mime/mimetreeparser/messagepart.cpp | |
parent | 4e338ae323fc6fcdfb641cf463f60946bcbbc60e (diff) | |
download | kube-d81eea635c2151c2c9c62a53c08e427c38ad0acd.tar.gz kube-d81eea635c2151c2c9c62a53c08e427c38ad0acd.zip |
Partial fix for multipart/mixed in alternative part
We only render the first part right now, which is not correct.
Diffstat (limited to 'framework/src/domain/mime/mimetreeparser/messagepart.cpp')
-rw-r--r-- | framework/src/domain/mime/mimetreeparser/messagepart.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/framework/src/domain/mime/mimetreeparser/messagepart.cpp b/framework/src/domain/mime/mimetreeparser/messagepart.cpp index 1a1b2003..9c17aafc 100644 --- a/framework/src/domain/mime/mimetreeparser/messagepart.cpp +++ b/framework/src/domain/mime/mimetreeparser/messagepart.cpp | |||
@@ -587,30 +587,35 @@ AlternativeMessagePart::AlternativeMessagePart(ObjectTreeParser *otp, KMime::Con | |||
587 | // when displaying plain text. | 587 | // when displaying plain text. |
588 | if (!dataHtml) { | 588 | if (!dataHtml) { |
589 | dataHtml = findTypeInDirectChilds(mNode, "multipart/mixed"); | 589 | dataHtml = findTypeInDirectChilds(mNode, "multipart/mixed"); |
590 | if (dataHtml) { | ||
591 | const auto parts = dataHtml->contents(); | ||
592 | for (int i = 0; i < parts.size(); i++) { | ||
593 | const auto p = parts.at(i); | ||
594 | if (i == 0 ) { | ||
595 | // FIXME multipart/mixed should display all types serially, not just one | ||
596 | dataHtml = p; | ||
597 | } else if (KMime::isAttachment(p)) { | ||
598 | appendSubPart(MimeMessagePart::Ptr(new MimeMessagePart(otp, p, true))); | ||
599 | } | ||
600 | } | ||
601 | } | ||
590 | } | 602 | } |
591 | } | 603 | } |
592 | 604 | ||
593 | if (dataIcal) { | 605 | if (dataIcal) { |
594 | mChildNodes[Util::MultipartIcal] = dataIcal; | 606 | mChildParts[Util::MultipartIcal] = MimeMessagePart::Ptr(new MimeMessagePart(mOtp, dataIcal, true)); |
595 | } | 607 | } |
596 | 608 | ||
597 | if (dataText) { | 609 | if (dataText) { |
598 | mChildNodes[Util::MultipartPlain] = dataText; | 610 | mChildParts[Util::MultipartPlain] = MimeMessagePart::Ptr(new MimeMessagePart(mOtp, dataText, true)); |
599 | } | 611 | } |
600 | 612 | ||
601 | if (dataHtml) { | 613 | if (dataHtml) { |
602 | mChildNodes[Util::MultipartHtml] = dataHtml; | 614 | mChildParts[Util::MultipartHtml] = MimeMessagePart::Ptr(new MimeMessagePart(mOtp, dataHtml, true)); |
603 | } | 615 | } |
604 | 616 | ||
605 | if (mChildNodes.isEmpty()) { | 617 | if (mChildParts.isEmpty()) { |
606 | qCWarning(MIMETREEPARSER_LOG) << "no valid nodes"; | 618 | qCWarning(MIMETREEPARSER_LOG) << "no valid nodes"; |
607 | return; | ||
608 | } | ||
609 | |||
610 | QMapIterator<Util::HtmlMode, KMime::Content *> i(mChildNodes); | ||
611 | while (i.hasNext()) { | ||
612 | i.next(); | ||
613 | mChildParts[i.key()] = MimeMessagePart::Ptr(new MimeMessagePart(mOtp, i.value(), true)); | ||
614 | } | 619 | } |
615 | } | 620 | } |
616 | 621 | ||