Commit 67359706 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to show akonadiUrl

parent 39957193
Pipeline #58753 canceled with stage
......@@ -47,6 +47,7 @@ ViewerPluginExternalEditWidget::ViewerPluginExternalEditWidget(QWidget *parent)
"<li>%bcc - the list of bcc email address</li>"
"<li>%body - the body of message</li>"
"<li>%inreplyto - the reply email address</li>"
"<li>%akonadiUrl - the akonadi url (as akonadi:?item=187020)</li>"
"</ul>"
"</strong></p></qt>");
formatHelp->setWhatsThis(mCommandWhatsThis);
......
......@@ -42,6 +42,11 @@ void ViewerPluginExternalscriptInterface::refreshActionList(KActionCollection *a
createAction(ac);
}
void ViewerPluginExternalscriptInterface::setMessageItem(const Akonadi::Item &item)
{
mAkonadiUrl = item.url().toString();
}
void ViewerPluginExternalscriptInterface::setMessage(const KMime::Message::Ptr &msg)
{
mMessage = msg;
......@@ -128,5 +133,6 @@ QStringList ViewerPluginExternalscriptInterface::adaptArguments(const QStringLis
{
ViewerPluginExternalScriptParseArgument parser;
parser.setMessage(mMessage);
parser.setAkonadiUrl(mAkonadiUrl);
return parser.parse(scriptArguments);
}
......@@ -25,6 +25,7 @@ public:
void setText(const QString &text) override;
void setMessage(const KMime::Message::Ptr &msg) override;
void refreshActionList(KActionCollection *ac) override;
void setMessageItem(const Akonadi::Item &item) override;
private Q_SLOTS:
void slotScriptActivated(QAction *act);
......@@ -35,6 +36,7 @@ private:
QStringList adaptArguments(const QStringList &scriptArguments);
QStringList mCurrentInfo;
QString mText;
QString mAkonadiUrl;
KMime::Message::Ptr mMessage;
QActionGroup *mActionGroup = nullptr;
};
......
......@@ -5,7 +5,7 @@
*/
#include "viewerpluginexternalscriptparseargument.h"
#include <QDebug>
ViewerPluginExternalScriptParseArgument::ViewerPluginExternalScriptParseArgument()
{
}
......@@ -15,6 +15,11 @@ void ViewerPluginExternalScriptParseArgument::setMessage(const KMime::Message::P
mMessage = msg;
}
void ViewerPluginExternalScriptParseArgument::setAkonadiUrl(const QString &akonadiUrl)
{
mAkonadiUrl = akonadiUrl;
}
QStringList ViewerPluginExternalScriptParseArgument::parse(const QStringList &scriptArguments)
{
if (mMessage.isNull()) {
......@@ -45,6 +50,8 @@ QStringList ViewerPluginExternalScriptParseArgument::parse(const QStringList &sc
} else if (arg == QLatin1String("%inreplyto")) {
KMime::Headers::InReplyTo *inReplyTo = mMessage ? mMessage->inReplyTo(false) : nullptr;
newArguments << QStringLiteral("\"%1\"").arg(inReplyTo ? inReplyTo->asUnicodeString() : QString());
} else if (arg == QLatin1String("%akonadiUrl")) {
newArguments << mAkonadiUrl;
} else {
newArguments << arg;
}
......
......@@ -15,9 +15,12 @@ public:
void setMessage(const KMime::Message::Ptr &msg);
QStringList parse(const QStringList &lst);
Q_REQUIRED_RESULT QStringList parse(const QStringList &lst);
void setAkonadiUrl(const QString &akonadiUrl);
private:
QString mAkonadiUrl;
KMime::Message::Ptr mMessage;
};
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