Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 88b70d5e authored by Sandro Knauß's avatar Sandro Knauß

get rid of more friend classes in messageparts

parent 68d0765b
......@@ -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;
}
......@@ -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();
......
......@@ -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
......
......@@ -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());
......
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