summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-03-31 14:01:32 +0200
committerMontel Laurent <[email protected]>2016-03-31 14:01:46 +0200
commit7981442e53ab15bd3d8281b05d3edb72f371df1c (patch)
treebf6ce05f7f28e069f380f6df74919c4b723c7936
parent6a8753bde31c7c2e8e956e245d79a48e24fd5447 (diff)
Returns actions from interceptor plugin
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.cpp8
-rw-r--r--messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp10
-rw-r--r--messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h2
3 files changed, 17 insertions, 3 deletions
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
index fcd5cf0..3dc2a35 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
@@ -57,7 +57,8 @@ public:
: mScamDetection(Q_NULLPTR),
mWebViewAccessKey(Q_NULLPTR),
mExternalReference(Q_NULLPTR),
- mPageEngine(Q_NULLPTR)
+ mPageEngine(Q_NULLPTR),
+ mNetworkAccessManager(Q_NULLPTR)
{
}
@@ -65,6 +66,7 @@ public:
MailWebEngineAccessKey *mWebViewAccessKey;
MessageViewer::LoadExternalReferencesUrlInterceptor *mExternalReference;
MailWebEnginePage *mPageEngine;
+ MessageViewer::NetworkAccessManagerWebEngine *mNetworkAccessManager;
};
MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
@@ -79,9 +81,9 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
connect(d->mScamDetection, &ScamDetectionWebEngine::messageMayBeAScam, this, &MailWebEngineView::messageMayBeAScam);
connect(d->mWebViewAccessKey, &MailWebEngineAccessKey::openUrl, this, &MailWebEngineView::openUrl);
- MessageViewer::NetworkAccessManagerWebEngine *networkAccessManager = new MessageViewer::NetworkAccessManagerWebEngine(this, ac, this);
+ d->mNetworkAccessManager = new MessageViewer::NetworkAccessManagerWebEngine(this, ac, this);
d->mExternalReference = new MessageViewer::LoadExternalReferencesUrlInterceptor(this);
- networkAccessManager->addInterceptor(d->mExternalReference);
+ d->mNetworkAccessManager->addInterceptor(d->mExternalReference);
d->mPageEngine = new MailWebEnginePage(this);
setPage(d->mPageEngine);
diff --git a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
index 0525d6c..828b43c 100644
--- a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
+++ b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
@@ -19,6 +19,7 @@
#include "webengine/urlinterceptor/networkurlinterceptormanager.h"
#include "webengine/urlinterceptor/networkurlinterceptor.h"
#include <QWebEngineProfile>
+#include <MessageViewer/NetworkPluginUrlInterceptorInterface>
using namespace MessageViewer;
@@ -58,3 +59,12 @@ void NetworkAccessManagerWebEngine::addInterceptor(MessageViewer::NetworkPluginU
{
d->mNetworkUrlInterceptor->addInterceptor(interceptor);
}
+
+QList<QAction *> NetworkAccessManagerWebEngine::actions() const
+{
+ QList<QAction *> actions;
+ Q_FOREACH (MessageViewer::NetworkPluginUrlInterceptorInterface *interface, d->mManager->interfaceList()) {
+ actions.append(interface->actions());
+ }
+ return actions;
+}
diff --git a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
index d3f06bc..b9a95c2 100644
--- a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
+++ b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
@@ -22,6 +22,7 @@
#include "messageviewer_export.h"
class KActionCollection;
class QWebEngineView;
+class QAction;
namespace MessageViewer
{
class NetworkPluginUrlInterceptorInterface;
@@ -33,6 +34,7 @@ public:
explicit NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkAccessManagerWebEngine();
void addInterceptor(MessageViewer::NetworkPluginUrlInterceptorInterface *interceptor);
+ QList<QAction *> actions() const;
private:
NetworkAccessManagerWebEnginePrivate *const d;
};