summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandro Knauß <[email protected]>2017-11-02 21:10:38 +0100
committerSandro Knauß <[email protected]>2017-11-14 15:43:31 +0100
commit88b70d5ee33cea2279afa9a2ac6eab6350809cd8 (patch)
treebdab4349ccac22a3abf0de49105c9da58d1d2d19
parent68d0765bc0df59034e2fc14e4155d650ed10b8bf (diff)
get rid of more friend classes in messageparts
-rw-r--r--mimetreeparser/src/bodyformatter/multipartalternative.cpp10
-rw-r--r--mimetreeparser/src/messagepart.cpp5
-rw-r--r--mimetreeparser/src/messagepart.h8
-rw-r--r--mimetreeparser/src/objecttreeparser.cpp4
4 files changed, 13 insertions, 14 deletions
diff --git a/mimetreeparser/src/bodyformatter/multipartalternative.cpp b/mimetreeparser/src/bodyformatter/multipartalternative.cpp
index 19518c7..16c9128 100644
--- a/mimetreeparser/src/bodyformatter/multipartalternative.cpp
+++ b/mimetreeparser/src/bodyformatter/multipartalternative.cpp
@@ -49,14 +49,14 @@ MessagePart::Ptr MultiPartAlternativeBodyPartFormatter::process(Interface::BodyP
auto preferredMode = part.source()->preferredMode();
AlternativeMessagePart::Ptr mp(new AlternativeMessagePart(part.objectTreeParser(), node, preferredMode));
- if (mp->mChildNodes.isEmpty()) {
+ if (mp->childParts().isEmpty()) {
MimeMessagePart::Ptr _mp(new MimeMessagePart(part.objectTreeParser(), node->contents().at(0), false));
return _mp;
}
- KMime::Content *dataIcal = mp->mChildNodes.contains(Util::MultipartIcal) ? mp->mChildNodes[Util::MultipartIcal] : nullptr;
- KMime::Content *dataHtml = mp->mChildNodes.contains(Util::MultipartHtml) ? mp->mChildNodes[Util::MultipartHtml] : nullptr;
- KMime::Content *dataPlain = mp->mChildNodes.contains(Util::MultipartPlain) ? mp->mChildNodes[Util::MultipartPlain] : nullptr;
+ KMime::Content *dataIcal = mp->childParts().contains(Util::MultipartIcal) ? mp->childParts()[Util::MultipartIcal]->content() : nullptr;
+ KMime::Content *dataHtml = mp->childParts().contains(Util::MultipartHtml) ? mp->childParts()[Util::MultipartHtml]->content() : nullptr;
+ KMime::Content *dataPlain = mp->childParts().contains(Util::MultipartPlain) ? mp->childParts()[Util::MultipartPlain]->content() : nullptr;
// Make sure that in default ical is prefered over html and plain text
if (dataIcal && ((preferredMode != Util::MultipartHtml && preferredMode != Util::MultipartPlain))) {
@@ -78,6 +78,6 @@ MessagePart::Ptr MultiPartAlternativeBodyPartFormatter::process(Interface::BodyP
preferredMode = Util::MultipartPlain;
}
part.source()->setHtmlMode(preferredMode, mp->availableModes());
- mp->mPreferredMode = preferredMode;
+ mp->setPreferredMode(preferredMode);
return mp;
}
diff --git a/mimetreeparser/src/messagepart.cpp b/mimetreeparser/src/messagepart.cpp
index b50982f..0ee1efb 100644
--- a/mimetreeparser/src/messagepart.cpp
+++ b/mimetreeparser/src/messagepart.cpp
@@ -587,6 +587,11 @@ Util::HtmlMode AlternativeMessagePart::preferredMode() const
return mPreferredMode;
}
+void AlternativeMessagePart::setPreferredMode(Util::HtmlMode preferredMode)
+{
+ mPreferredMode = preferredMode;
+}
+
QList<Util::HtmlMode> AlternativeMessagePart::availableModes()
{
return mChildParts.keys();
diff --git a/mimetreeparser/src/messagepart.h b/mimetreeparser/src/messagepart.h
index 5c35293..bb4a9a8 100644
--- a/mimetreeparser/src/messagepart.h
+++ b/mimetreeparser/src/messagepart.h
@@ -52,10 +52,8 @@ class Content;
}
namespace MimeTreeParser {
-class ObjectTreeParser;
class CryptoBodyPartMemento;
class MessagePartPrivate;
-class MultiPartAlternativeBodyPartFormatter;
namespace Interface {
class ObjectTreeSource;
}
@@ -159,8 +157,6 @@ public:
QString htmlContent() const override;
private:
bool mOnlyOneMimePart;
-
- friend class AlternativeMessagePart;
};
class MIMETREEPARSER_EXPORT MessagePartList : public MessagePart
@@ -261,6 +257,7 @@ public:
QString text() const override;
Util::HtmlMode preferredMode() const;
+ void setPreferredMode(Util::HtmlMode preferredMode);
bool isHtml() const override;
@@ -278,9 +275,6 @@ private:
QMap<Util::HtmlMode, KMime::Content *> mChildNodes;
QMap<Util::HtmlMode, MimeMessagePart::Ptr> mChildParts;
-
- friend class ObjectTreeParser;
- friend class MultiPartAlternativeBodyPartFormatter;
};
class MIMETREEPARSER_EXPORT CertMessagePart : public MessagePart
diff --git a/mimetreeparser/src/objecttreeparser.cpp b/mimetreeparser/src/objecttreeparser.cpp
index 32678e8..f7ff5ff 100644
--- a/mimetreeparser/src/objecttreeparser.cpp
+++ b/mimetreeparser/src/objecttreeparser.cpp
@@ -159,8 +159,8 @@ void ObjectTreeParser::parseObjectTree(KMime::Content *node, bool parseOnlySingl
if (auto _mp = mp.dynamicCast<TextMessagePart>()) {
extractNodeInfos(_mp->content(), true);
} else if (auto _mp = mp.dynamicCast<AlternativeMessagePart>()) {
- if (_mp->mChildNodes.contains(Util::MultipartPlain)) {
- extractNodeInfos(_mp->mChildNodes[Util::MultipartPlain], true);
+ if (_mp->childParts().contains(Util::MultipartPlain)) {
+ extractNodeInfos(_mp->childParts()[Util::MultipartPlain]->content(), true);
}
}
setPlainTextContent(mp->text());