Commit 7981442e authored by Laurent Montel's avatar Laurent Montel 😁

Returns actions from interceptor plugin

parent 6a8753bd
......@@ -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);
......
......@@ -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;
}
......@@ -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;
};
......
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