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 b73f706f authored by Sandro Knauß's avatar Sandro Knauß

move complete logic from AttachmentMessagePart -> TextMessagePart

parent ed5d1c63
......@@ -912,20 +912,21 @@ void DefaultRendererPrivate::renderFactory(const MessagePart::Ptr &msgPart, Html
bool DefaultRendererPrivate::isHiddenHint(const MimeTreeParser::MessagePart::Ptr &msgPart)
{
auto mp = msgPart.dynamicCast<MimeTreeParser::AttachmentMessagePart>();
auto mp = msgPart.dynamicCast<MimeTreeParser::TextMessagePart>();
auto content = msgPart->content();
if (!mp) {
auto _mp = msgPart.dynamicCast<MimeTreeParser::TextMessagePart>();
if (_mp) {
return msgPart->nodeHelper()->isNodeDisplayedHidden(content);
} else {
return false;
}
if (mShowOnlyOneMimePart && mMsgPart.data() == msgPart->parentPart()) {
if (mMsgPart->subParts().at(0) == msgPart.data()) {
return false;
}
}
if (mShowOnlyOneMimePart) {
return false;
if (msgPart->nodeHelper()->isNodeDisplayedHidden(content)) {
return true;
}
const AttachmentStrategy *const as = mAttachmentStrategy;
......@@ -970,7 +971,7 @@ bool DefaultRendererPrivate::isHiddenHint(const MimeTreeParser::MessagePart::Ptr
MimeTreeParser::IconType DefaultRendererPrivate::displayHint(const MimeTreeParser::MessagePart::Ptr& msgPart)
{
auto mp = msgPart.dynamicCast<MimeTreeParser::AttachmentMessagePart>();
auto mp = msgPart.dynamicCast<MimeTreeParser::TextMessagePart>();
auto content = msgPart->content();
if (!mp) {
return MimeTreeParser::IconType::NoIcon;
......
......@@ -61,6 +61,8 @@ public:
QString mText;
PartMetaData mMetaData;
bool mRoot = false;
bool mIsImage = false;
bool mNeverDisplayInline = false;
};
}
......@@ -241,6 +243,26 @@ void MessagePart::clearSubParts()
d->mBlocks.clear();
}
bool MessagePart::neverDisplayInline() const
{
return d->mNeverDisplayInline;
}
void MessagePart::setNeverDisplayInline(bool displayInline)
{
d->mNeverDisplayInline = displayInline;
}
bool MessagePart::isImage() const
{
return d->mIsImage;
}
void MessagePart::setIsImage(bool image)
{
d->mIsImage = image;
}
//-----MessagePartList----------------------
MessagePartList::MessagePartList(ObjectTreeParser *otp)
: MessagePart(otp, QString())
......@@ -421,8 +443,6 @@ QString TextMessagePart::temporaryFilePath() const
AttachmentMessagePart::AttachmentMessagePart(ObjectTreeParser *otp, KMime::Content *node, bool decryptMessage)
: TextMessagePart(otp, node, decryptMessage)
, mIsImage(false)
, mNeverDisplayInline(false)
{
}
......@@ -430,26 +450,6 @@ AttachmentMessagePart::~AttachmentMessagePart()
{
}
bool AttachmentMessagePart::neverDisplayInline() const
{
return mNeverDisplayInline;
}
void AttachmentMessagePart::setNeverDisplayInline(bool displayInline)
{
mNeverDisplayInline = displayInline;
}
bool AttachmentMessagePart::isImage() const
{
return mIsImage;
}
void AttachmentMessagePart::setIsImage(bool image)
{
mIsImage = image;
}
//-----HtmlMessageBlock----------------------
HtmlMessagePart::HtmlMessagePart(ObjectTreeParser *otp, KMime::Content *node, Interface::ObjectTreeSource *source)
......
......@@ -68,6 +68,8 @@ class MIMETREEPARSER_EXPORT MessagePart : public QObject
Q_PROPERTY(bool isAttachment READ isAttachment)
Q_PROPERTY(bool root READ isRoot)
Q_PROPERTY(bool isHtml READ isHtml)
Q_PROPERTY(bool isImage READ isImage CONSTANT)
Q_PROPERTY(bool neverDisplayInline READ neverDisplayInline CONSTANT)
Q_PROPERTY(QString attachmentIndex READ attachmentIndex CONSTANT)
Q_PROPERTY(QString link READ attachmentLink CONSTANT)
public:
......@@ -112,6 +114,11 @@ public:
virtual bool isHtml() const;
bool neverDisplayInline() const;
void setNeverDisplayInline(bool displayInline);
bool isImage() const;
void setIsImage(bool image);
PartMetaData *partMetaData() const;
Interface::BodyPartMemento *memento() const;
......@@ -211,8 +218,6 @@ private:
KMMsgSignatureState mSignatureState;
KMMsgEncryptionState mEncryptionState;
bool mDecryptMessage;
friend class ObjectTreeParser;
};
class MIMETREEPARSER_EXPORT AttachmentMessagePart : public TextMessagePart
......@@ -222,15 +227,6 @@ public:
typedef QSharedPointer<AttachmentMessagePart> Ptr;
AttachmentMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, bool decryptMessage);
virtual ~AttachmentMessagePart();
bool neverDisplayInline() const;
void setNeverDisplayInline(bool displayInline);
bool isImage() const;
void setIsImage(bool image);
private:
bool mIsImage;
bool mNeverDisplayInline;
};
class MIMETREEPARSER_EXPORT HtmlMessagePart : public MessagePart
......
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