Commit 66e52c14 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to create actions

parent 5ab44082
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(MESSAGELIB_LIB_VERSION "5.1.74")
set(MESSAGELIB_LIB_VERSION "5.1.75")
set(KF5_VERSION "5.19.0")
set(KDEPIMLIBS_LIB_VERSION "5.1.42")
......
......@@ -33,11 +33,11 @@ public:
MessageViewer::NetworkUrlInterceptorManager *mManager;
};
NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(QObject *parent)
NetworkAccessManagerWebEngine::NetworkAccessManagerWebEngine(KActionCollection *ac, QObject *parent)
: QNetworkAccessManager(parent),
d(new NetworkAccessManagerWebEnginePrivate)
{
d->mManager = new MessageViewer::NetworkUrlInterceptorManager(this);
d->mManager = new MessageViewer::NetworkUrlInterceptorManager(ac, this);
MessageViewer::NetworkUrlInterceptor *networkUrlInterceptor = new MessageViewer::NetworkUrlInterceptor(this);
Q_FOREACH (MessageViewer::NetworkPluginUrlInterceptorInterface *interface, d->mManager->interfaceList()) {
......
......@@ -20,6 +20,7 @@
#include <QNetworkAccessManager>
#include "messageviewer_export.h"
class KActionCollection;
namespace MessageViewer
{
class NetworkAccessManagerWebEnginePrivate;
......@@ -27,7 +28,7 @@ class MESSAGEVIEWER_EXPORT NetworkAccessManagerWebEngine : public QNetworkAccess
{
Q_OBJECT
public:
explicit NetworkAccessManagerWebEngine(QObject *parent = Q_NULLPTR);
explicit NetworkAccessManagerWebEngine(KActionCollection *ac, QObject *parent = Q_NULLPTR);
~NetworkAccessManagerWebEngine();
private:
NetworkAccessManagerWebEnginePrivate *const d;
......
......@@ -25,27 +25,28 @@ using namespace MessageViewer;
class MessageViewer::NetworkUrlInterceptorManagerPrivate
{
public:
NetworkUrlInterceptorManagerPrivate(NetworkUrlInterceptorManager *qq)
NetworkUrlInterceptorManagerPrivate(KActionCollection *ac, NetworkUrlInterceptorManager *qq)
: q(qq)
{
createInterfaces();
createInterfaces(ac);
}
void createInterfaces();
void createInterfaces(KActionCollection *ac);
QVector<MessageViewer::NetworkPluginUrlInterceptorInterface *> mListInterface;
NetworkUrlInterceptorManager *q;
};
void NetworkUrlInterceptorManagerPrivate::createInterfaces()
void NetworkUrlInterceptorManagerPrivate::createInterfaces(KActionCollection *ac)
{
Q_FOREACH (NetworkPluginUrlInterceptor *plugin, NetworkUrlInterceptorPluginManager::self()->pluginsList()) {
MessageViewer::NetworkPluginUrlInterceptorInterface *interface = plugin->createInterface(q);
plugin->createActions(ac);
mListInterface.append(interface);
}
}
NetworkUrlInterceptorManager::NetworkUrlInterceptorManager(QObject *parent)
NetworkUrlInterceptorManager::NetworkUrlInterceptorManager(KActionCollection *ac, QObject *parent)
: QObject(parent),
d(new NetworkUrlInterceptorManagerPrivate(this))
d(new NetworkUrlInterceptorManagerPrivate(ac, this))
{
}
......
......@@ -29,7 +29,7 @@ class MESSAGEVIEWER_EXPORT NetworkUrlInterceptorManager : public QObject
{
Q_OBJECT
public:
explicit NetworkUrlInterceptorManager(QObject *parent = Q_NULLPTR);
explicit NetworkUrlInterceptorManager(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