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 30776ba7 authored by Volker Krause's avatar Volker Krause

Add attachment link to MessagePart too

parent b286b82f
......@@ -67,7 +67,6 @@ bool AttachmentMessagePartRenderer::render(const MimeTreeParser::MessagePartPtr&
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
c.insert(QStringLiteral("block"), msgPart.data());
msgPart->setProperty("link", nodeHelper->asHREF(node, QStringLiteral("body")));
msgPart->setProperty("inline", (tmpAsIcon == MimeTreeParser::IconInline));
QString iconPath;
......
......@@ -47,19 +47,15 @@ bool TextMessagePartRenderer::render(const MimeTreeParser::MessagePartPtr& msgPa
if (!mp)
return false;
auto node = mp->content();
auto nodeHelper = mp->mOtp->nodeHelper();
if (mp->isHidden()) {
return true;
}
Grantlee::Template t;
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
Grantlee::Context c = MessagePartRendererManager::self()->createContext();
c.insert(QStringLiteral("block"), msgPart.data());
msgPart->setProperty("link", nodeHelper->asHREF(node, QStringLiteral("body")));
t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
":/textmessagepart.html"));
t = MessagePartRendererManager::self()->loadByName(QStringLiteral(":/textmessagepart.html"));
QString content;
foreach (const auto &_m, mp->subParts()) {
......
......@@ -129,6 +129,11 @@ QString MessagePart::attachmentIndex() const
return attachmentContent()->index().toString();
}
QString MessagePart::attachmentLink() const
{
return mOtp->nodeHelper()->asHREF(content(), QStringLiteral("body"));
}
void MessagePart::setIsRoot(bool root)
{
d->mRoot = root;
......
......@@ -38,7 +38,6 @@
class QTextCodec;
namespace MessageViewer {
class TextMessagePartRenderer;
class AttachmentMessagePartRenderer;
}
......@@ -74,6 +73,7 @@ class MIMETREEPARSER_EXPORT MessagePart : public QObject
Q_PROPERTY(bool isHtml READ isHtml)
Q_PROPERTY(bool isHidden READ isHidden)
Q_PROPERTY(QString attachmentIndex READ attachmentIndex CONSTANT)
Q_PROPERTY(QString link READ attachmentLink CONSTANT)
public:
typedef QSharedPointer<MessagePart> Ptr;
MessagePart(ObjectTreeParser *otp, const QString &text);
......@@ -103,6 +103,8 @@ public:
bool isAttachment() const;
/** @see KMime::Content::index() */
QString attachmentIndex() const;
/** @see NodeHelper::asHREF */
QString attachmentLink() const;
void setIsRoot(bool root);
bool isRoot() const;
......@@ -221,7 +223,6 @@ private:
bool mDecryptMessage;
bool mIsHidden;
friend class MessageViewer::TextMessagePartRenderer;
friend class MessageViewer::AttachmentMessagePartRenderer;
friend class ObjectTreeParser;
};
......
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