summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-03-29 23:09:49 +0200
committerMontel Laurent <[email protected]>2016-03-29 23:09:49 +0200
commite43f2f124e24b504f371f145d73cc6134024ed1e (patch)
tree2efd59e7ec7783ac4967e4c40c8900fb7e65e3a5
parentdb6678561adf88da8ad3b274cb1a84159ee52f5c (diff)
Allow to add new interceptor
-rw-r--r--messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp15
-rw-r--r--messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h2
2 files changed, 13 insertions, 4 deletions
diff --git a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
index da39c85..0525d6c 100644
--- a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
+++ b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.cpp
@@ -26,11 +26,13 @@ class MessageViewer::NetworkAccessManagerWebEnginePrivate
{
public:
NetworkAccessManagerWebEnginePrivate()
- : mManager(Q_NULLPTR)
+ : mManager(Q_NULLPTR),
+ mNetworkUrlInterceptor(Q_NULLPTR)
{
}
MessageViewer::NetworkUrlInterceptorManager *mManager;
+ MessageViewer::NetworkUrlInterceptor *mNetworkUrlInterceptor;
};
NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent)
@@ -40,14 +42,19 @@ NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(QWebEngineView *web
d->mManager = new MessageViewer::NetworkUrlInterceptorManager(webEngine, ac, this);
// Add interceptor.
- MessageViewer::NetworkUrlInterceptor *networkUrlInterceptor = new MessageViewer::NetworkUrlInterceptor(this);
+ d->mNetworkUrlInterceptor = new MessageViewer::NetworkUrlInterceptor(this);
Q_FOREACH (MessageViewer::NetworkPluginUrlInterceptorInterface *interface, d->mManager->interfaceList()) {
- networkUrlInterceptor->addInterceptor(interface);
+ d->mNetworkUrlInterceptor->addInterceptor(interface);
}
- QWebEngineProfile::defaultProfile()->setRequestInterceptor(networkUrlInterceptor);
+ QWebEngineProfile::defaultProfile()->setRequestInterceptor(d->mNetworkUrlInterceptor);
}
NetworkAccessManagerWebEngine::~NetworkAccessManagerWebEngine()
{
delete d;
}
+
+void NetworkAccessManagerWebEngine::addInterceptor(MessageViewer::NetworkPluginUrlInterceptorInterface *interceptor)
+{
+ d->mNetworkUrlInterceptor->addInterceptor(interceptor);
+}
diff --git a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
index b3cd943..d3f06bc 100644
--- a/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
+++ b/messageviewer/src/webengine/networkmanager/networkaccessmanagerwebengine.h
@@ -24,6 +24,7 @@ class KActionCollection;
class QWebEngineView;
namespace MessageViewer
{
+class NetworkPluginUrlInterceptorInterface;
class NetworkAccessManagerWebEnginePrivate;
class MESSAGEVIEWER_EXPORT NetworkAccessManagerWebEngine : public QNetworkAccessManager
{
@@ -31,6 +32,7 @@ class MESSAGEVIEWER_EXPORT NetworkAccessManagerWebEngine : public QNetworkAccess
public:
explicit NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkAccessManagerWebEngine();
+ void addInterceptor(MessageViewer::NetworkPluginUrlInterceptorInterface *interceptor);
private:
NetworkAccessManagerWebEnginePrivate *const d;
};