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

We need WebHitTestResult to specify which actions we need

parent db52c92a
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.2.50")
set(MESSAGELIB_LIB_VERSION "5.2.51")
set(KF5_VERSION "5.19.0")
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -341,9 +341,9 @@ void MailWebEngineView::setAllowExternalContent(bool b)
}
}
QList<QAction *> MailWebEngineView::interceptorUrlActions() const
QList<QAction *> MailWebEngineView::interceptorUrlActions(const MessageViewer::WebHitTestResult &result) const
{
return d->mNetworkAccessManager->actions();
return d->mNetworkAccessManager->actions(result);
}
void MailWebEngineView::slotLoadFinished()
......
......@@ -58,7 +58,7 @@ public:
void setAllowExternalContent(bool b);
QList<QAction *> interceptorUrlActions() const;
QList<QAction *> interceptorUrlActions(const MessageViewer::WebHitTestResult &result) const;
void toggleFullAddressList(const QString &field, const boost::function<QString ()> &delayedHtml, bool doShow);
public Q_SLOTS:
......
......@@ -60,11 +60,11 @@ void NetworkAccessManagerWebEngine::addInterceptor(MessageViewer::NetworkPluginU
d->mNetworkUrlInterceptor->addInterceptor(interceptor);
}
QList<QAction *> NetworkAccessManagerWebEngine::actions() const
QList<QAction *> NetworkAccessManagerWebEngine::actions(const MessageViewer::WebHitTestResult &result) const
{
QList<QAction *> actions;
Q_FOREACH (MessageViewer::NetworkPluginUrlInterceptorInterface *interface, d->mManager->interfaceList()) {
actions.append(interface->actions());
actions.append(interface->actions(result));
}
return actions;
}
......
......@@ -25,6 +25,7 @@ class QWebEngineView;
class QAction;
namespace MessageViewer
{
class WebHitTestResult;
class NetworkPluginUrlInterceptorInterface;
class NetworkAccessManagerWebEnginePrivate;
class NetworkPluginUrlInterceptorConfigureWidget;
......@@ -36,7 +37,7 @@ public:
explicit NetworkAccessManagerWebEngine(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkAccessManagerWebEngine();
void addInterceptor(MessageViewer::NetworkPluginUrlInterceptorInterface *interceptor);
QList<QAction *> actions() const;
QList<QAction *> actions(const MessageViewer::WebHitTestResult &result) const;
QVector<MessageViewer::NetworkPluginUrlInterceptorConfigureWidgetSetting> configureInterceptorList(QWidget *parent = Q_NULLPTR) const;
private:
NetworkAccessManagerWebEnginePrivate *const d;
......
......@@ -35,7 +35,8 @@ void NetworkPluginUrlInterceptorInterface::createActions(KActionCollection *ac)
Q_UNUSED(ac);
}
QList<QAction *> NetworkPluginUrlInterceptorInterface::actions() const
QList<QAction *> NetworkPluginUrlInterceptorInterface::actions(const MessageViewer::WebHitTestResult &result) const
{
Q_UNUSED(result);
return {};
}
......@@ -25,6 +25,7 @@ class KActionCollection;
class QAction;
namespace MessageViewer
{
class WebHitTestResult;
class MESSAGEVIEWER_EXPORT NetworkPluginUrlInterceptorInterface : public QObject
{
Q_OBJECT
......@@ -33,7 +34,7 @@ public:
~NetworkPluginUrlInterceptorInterface();
virtual void createActions(KActionCollection *ac);
virtual QList<QAction *> actions() const;
virtual QList<QAction *> actions(const MessageViewer::WebHitTestResult &result) const;
virtual bool interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
};
......
......@@ -19,6 +19,8 @@
#include "networkurlinterceptormanager.h"
#include "networkurlinterceptorpluginmanager.h"
#include <MessageViewer/WebHitTestResult>
using namespace MessageViewer;
class MessageViewer::NetworkUrlInterceptorManagerPrivate
......@@ -30,18 +32,18 @@ public:
createInterfaces(webEngine, ac);
}
QList<QAction *> actions() const;
QList<QAction *> actions(const MessageViewer::WebHitTestResult &result) const;
QVector<NetworkPluginUrlInterceptorConfigureWidgetSetting> configureInterceptorList(QWidget *parent) const;
void createInterfaces(QWebEngineView *webEngine, KActionCollection *ac);
QVector<MessageViewer::NetworkPluginUrlInterceptorInterface *> mListInterface;
NetworkUrlInterceptorManager *q;
};
QList<QAction *> NetworkUrlInterceptorManagerPrivate::actions() const
QList<QAction *> NetworkUrlInterceptorManagerPrivate::actions(const MessageViewer::WebHitTestResult &result) const
{
QList<QAction *> lstActions;
Q_FOREACH(MessageViewer::NetworkPluginUrlInterceptorInterface *interface, mListInterface) {
lstActions.append(interface->actions());
lstActions.append(interface->actions(result));
}
return lstActions;
}
......@@ -83,9 +85,9 @@ QVector<MessageViewer::NetworkPluginUrlInterceptorInterface *> NetworkUrlInterce
return d->mListInterface;
}
QList<QAction *> NetworkUrlInterceptorManager::actions() const
QList<QAction *> NetworkUrlInterceptorManager::actions(const MessageViewer::WebHitTestResult &result) const
{
return d->actions();
return d->actions(result);
}
QVector<NetworkPluginUrlInterceptorConfigureWidgetSetting> NetworkUrlInterceptorManager::configureInterceptorList(QWidget *parent) const
......
......@@ -25,6 +25,7 @@
namespace MessageViewer
{
class WebHitTestResult;
class NetworkUrlInterceptorManagerPrivate;
class MESSAGEVIEWER_EXPORT NetworkUrlInterceptorManager : public QObject
{
......@@ -34,7 +35,7 @@ public:
~NetworkUrlInterceptorManager();
QVector<NetworkPluginUrlInterceptorInterface *> interfaceList() const;
QList<QAction *> actions() const;
QList<QAction *> actions(const MessageViewer::WebHitTestResult &result) const;
QVector<NetworkPluginUrlInterceptorConfigureWidgetSetting> configureInterceptorList(QWidget *parent) const;
private:
NetworkUrlInterceptorManagerPrivate *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