Commit 493205cd authored by Laurent Montel's avatar Laurent Montel 😁

Add singleton for plugin interface

parent ee3941fe
......@@ -82,6 +82,7 @@ if (QTWEBENGINE_EXPERIMENTAL_OPTION)
viewer/webengine/mailwebhittestresult.cpp
viewer/webengine/mailnetworkulrinterceptor.cpp
viewer/webengine/mailnetworkpluginulrinterceptorinterface.cpp
viewer/webengine/mailnetworkulrinterceptorpluginmanager.cpp
${libmessageviewer_mailviewer_SRCS}
findbar/findbarwebengineview.cpp
)
......
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mailnetworkpluginulrinterceptorinterface.h"
using namespace MessageViewer;
MailNetworkPluginUlrInterceptorInterface::MailNetworkPluginUlrInterceptorInterface(QObject *parent)
: QObject(parent)
{
}
MailNetworkPluginUlrInterceptorInterface::~MailNetworkPluginUlrInterceptorInterface()
{
}
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MAILNETWORKPLUGINULRINTERCEPTORINTERFACE_H
#define MAILNETWORKPLUGINULRINTERCEPTORINTERFACE_H
#include <QObject>
class QWebEngineUrlRequestInfo;
namespace MessageViewer
{
class MailNetworkPluginUlrInterceptorInterface : public QObject
{
Q_OBJECT
public:
explicit MailNetworkPluginUlrInterceptorInterface(QObject *parent = Q_NULLPTR);
~MailNetworkPluginUlrInterceptorInterface();
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0;
};
}
#endif // MAILNETWORKPLUGINULRINTERCEPTORINTERFACE_H
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mailnetworkulrinterceptorpluginmanager.h"
using namespace MessageViewer;
class MailNetworkUlrInterceptorPluginManagerInstancePrivate
{
public:
MailNetworkUlrInterceptorPluginManagerInstancePrivate()
: mailNetworkUrlInterceptorPluginManager(new MailNetworkUlrInterceptorPluginManager)
{
}
~MailNetworkUlrInterceptorPluginManagerInstancePrivate()
{
delete mailNetworkUrlInterceptorPluginManager;
}
MailNetworkUlrInterceptorPluginManager *mailNetworkUrlInterceptorPluginManager;
};
Q_GLOBAL_STATIC(MailNetworkUlrInterceptorPluginManagerInstancePrivate, sInstance)
class MessageViewer::MailNetworkUlrInterceptorPluginManagerPrivate
{
public:
MailNetworkUlrInterceptorPluginManagerPrivate()
{
}
};
MailNetworkUlrInterceptorPluginManager *MailNetworkUlrInterceptorPluginManager::self()
{
return sInstance->mailNetworkUrlInterceptorPluginManager;
}
MailNetworkUlrInterceptorPluginManager::MailNetworkUlrInterceptorPluginManager(QObject *parent)
: QObject(parent),
d(new MailNetworkUlrInterceptorPluginManagerPrivate)
{
}
MailNetworkUlrInterceptorPluginManager::~MailNetworkUlrInterceptorPluginManager()
{
delete d;
}
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MAILNETWORKULRINTERCEPTORPLUGINMANAGER_H
#define MAILNETWORKULRINTERCEPTORPLUGINMANAGER_H
#include <QObject>
namespace MessageViewer
{
class MailNetworkUlrInterceptorPluginManagerPrivate;
class MailNetworkUlrInterceptorPluginManager : public QObject
{
Q_OBJECT
public:
static MailNetworkUlrInterceptorPluginManager *self();
explicit MailNetworkUlrInterceptorPluginManager(QObject *parent = Q_NULLPTR);
~MailNetworkUlrInterceptorPluginManager();
private:
MailNetworkUlrInterceptorPluginManagerPrivate *const d;
};
}
#endif // MAILNETWORKULRINTERCEPTORPLUGINMANAGER_H
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