Commit c5feee19 authored by Laurent Montel's avatar Laurent Montel 😁

We need QWebEngineView too

parent cf39342c
......@@ -47,7 +47,7 @@ MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
d->mWebViewAccessKey->setActionCollection(ac);
d->mScamDetection = new ScamDetectionWebEngine(this);
new MessageViewer::NetworkAccessManagerWebEngine(ac, this);
new MessageViewer::NetworkAccessManagerWebEngine(this, ac, this);
MailWebEnginePage *pageEngine = new MailWebEnginePage(this);
setPage(pageEngine);
......
......@@ -33,11 +33,11 @@ public:
MessageViewer::NetworkUrlInterceptorManager *mManager;
};
NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(KActionCollection *ac, QObject *parent)
NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent)
: QNetworkAccessManager(parent),
d(new NetworkAccessManagerWebEnginePrivate)
{
d->mManager = new MessageViewer::NetworkUrlInterceptorManager(ac, this);
d->mManager = new MessageViewer::NetworkUrlInterceptorManager(webEngine, ac, this);
// Add interceptor.
MessageViewer::NetworkUrlInterceptor *networkUrlInterceptor = new MessageViewer::NetworkUrlInterceptor(this);
......
......@@ -21,6 +21,7 @@
#include <QNetworkAccessManager>
#include "messageviewer_export.h"
class KActionCollection;
class QWebEngineView;
namespace MessageViewer
{
class NetworkAccessManagerWebEnginePrivate;
......@@ -28,7 +29,7 @@ class MESSAGEVIEWER_EXPORT NetworkAccessManagerWebEngine : public QNetworkAccess
{
Q_OBJECT
public:
explicit NetworkAccessManagerWebEngine(KActionCollection *ac, QObject *parent = Q_NULLPTR);
explicit NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkAccessManagerWebEngine();
private:
NetworkAccessManagerWebEnginePrivate *const d;
......
......@@ -22,6 +22,7 @@
#include "messageviewer_export.h"
class QAction;
class KActionCollection;
class QWebEngineView;
namespace MessageViewer
{
class NetworkPluginUrlInterceptorConfigureWidget;
......@@ -32,7 +33,7 @@ class MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptor : public QObject
public:
explicit NetworkPluginUrlInterceptor(QObject *parent = Q_NULLPTR);
~NetworkPluginUrlInterceptor();
virtual NetworkPluginUrlInterceptorInterface *createInterface(QObject *parent = Q_NULLPTR) = 0;
virtual NetworkPluginUrlInterceptorInterface *createInterface(QWebEngineView *webEngine, QObject *parent = Q_NULLPTR) = 0;
virtual bool hasConfigureSupport() const;
virtual MessageViewer::NetworkPluginUrlInterceptorConfigureWidget *createConfigureWidget(QWidget *parent = Q_NULLPTR);
......
......@@ -24,28 +24,28 @@ using namespace MessageViewer;
class MessageViewer::NetworkUrlInterceptorManagerPrivate
{
public:
NetworkUrlInterceptorManagerPrivate(KActionCollection *ac, NetworkUrlInterceptorManager *qq)
NetworkUrlInterceptorManagerPrivate(QWebEngineView *webEngine, KActionCollection *ac, NetworkUrlInterceptorManager *qq)
: q(qq)
{
createInterfaces(ac);
createInterfaces(webEngine, ac);
}
void createInterfaces(KActionCollection *ac);
void createInterfaces(QWebEngineView *webEngine, KActionCollection *ac);
QVector<MessageViewer::NetworkPluginUrlInterceptorInterface *> mListInterface;
NetworkUrlInterceptorManager *q;
};
void NetworkUrlInterceptorManagerPrivate::createInterfaces(KActionCollection *ac)
void NetworkUrlInterceptorManagerPrivate::createInterfaces(QWebEngineView *webEngine, KActionCollection *ac)
{
Q_FOREACH (NetworkPluginUrlInterceptor *plugin, NetworkUrlInterceptorPluginManager::self()->pluginsList()) {
MessageViewer::NetworkPluginUrlInterceptorInterface *interface = plugin->createInterface(q);
MessageViewer::NetworkPluginUrlInterceptorInterface *interface = plugin->createInterface(webEngine, q);
interface->createActions(ac);
mListInterface.append(interface);
}
}
NetworkUrlInterceptorManager::NetworkUrlInterceptorManager(KActionCollection *ac, QObject *parent)
NetworkUrlInterceptorManager::NetworkUrlInterceptorManager(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent)
: QObject(parent),
d(new NetworkUrlInterceptorManagerPrivate(ac, this))
d(new NetworkUrlInterceptorManagerPrivate(webEngine, ac, this))
{
}
......
......@@ -29,7 +29,7 @@ class MESSAGEVIEWER_EXPORT NetworkUrlInterceptorManager : public QObject
{
Q_OBJECT
public:
explicit NetworkUrlInterceptorManager(KActionCollection *ac, QObject *parent = Q_NULLPTR);
explicit NetworkUrlInterceptorManager(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkUrlInterceptorManager();
QVector<NetworkPluginUrlInterceptorInterface *> interfaceList() const;
......
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