Commit 0fb0bf98 authored by Laurent Montel's avatar Laurent Montel 😁

Implement more plugin manager

parent bcd57703
...@@ -17,9 +17,14 @@ ...@@ -17,9 +17,14 @@
#include "kmailplugineditorcheckbeforesendmanagerinterface.h" #include "kmailplugineditorcheckbeforesendmanagerinterface.h"
#include "kmail_debug.h"
#include <MessageComposer/PluginEditorCheckBeforeSendInterface>
#include <MessageComposer/PluginEditorCheckBeforeSend>
#include <MessageComposer/PluginEditorCheckBeforeSendManager>
KMailPluginEditorCheckBeforeSendManagerInterface::KMailPluginEditorCheckBeforeSendManagerInterface(QObject *parent) KMailPluginEditorCheckBeforeSendManagerInterface::KMailPluginEditorCheckBeforeSendManagerInterface(QObject *parent)
: QObject(parent) : QObject(parent),
mParentWidget(Q_NULLPTR)
{ {
} }
...@@ -28,3 +33,27 @@ KMailPluginEditorCheckBeforeSendManagerInterface::~KMailPluginEditorCheckBeforeS ...@@ -28,3 +33,27 @@ KMailPluginEditorCheckBeforeSendManagerInterface::~KMailPluginEditorCheckBeforeS
{ {
} }
QWidget *KMailPluginEditorCheckBeforeSendManagerInterface::parentWidget() const
{
return mParentWidget;
}
void KMailPluginEditorCheckBeforeSendManagerInterface::setParentWidget(QWidget *parentWidget)
{
mParentWidget = parentWidget;
}
void KMailPluginEditorCheckBeforeSendManagerInterface::initializePlugins()
{
if (!mListPluginInterface.isEmpty()) {
qCDebug(KMAIL_LOG) << "Plugin was already initialized. This is a bug";
return;
}
const QVector<MessageComposer::PluginEditorCheckBeforeSend *> lstPlugin = MessageComposer::PluginEditorCheckBeforeSendManager::self()->pluginsList();
Q_FOREACH (MessageComposer::PluginEditorCheckBeforeSend *plugin, lstPlugin) {
MessageComposer::PluginEditorCheckBeforeSendInterface *interface = plugin->createInterface(this);
interface->setParentWidget(mParentWidget);
mListPluginInterface.append(interface);
}
}
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
#include <QObject> #include <QObject>
namespace MessageComposer
{
class PluginEditorCheckBeforeSendInterface;
}
class KMailPluginEditorCheckBeforeSendManagerInterface : public QObject class KMailPluginEditorCheckBeforeSendManagerInterface : public QObject
{ {
Q_OBJECT Q_OBJECT
...@@ -27,6 +32,14 @@ public: ...@@ -27,6 +32,14 @@ public:
explicit KMailPluginEditorCheckBeforeSendManagerInterface(QObject *parent = Q_NULLPTR); explicit KMailPluginEditorCheckBeforeSendManagerInterface(QObject *parent = Q_NULLPTR);
~KMailPluginEditorCheckBeforeSendManagerInterface(); ~KMailPluginEditorCheckBeforeSendManagerInterface();
QWidget *parentWidget() const;
void setParentWidget(QWidget *parentWidget);
void initializePlugins();
private:
QList<MessageComposer::PluginEditorCheckBeforeSendInterface *> mListPluginInterface;
QWidget *mParentWidget;
}; };
#endif // KMAILPLUGINEDITORCHECKBEFORESENDMANAGERINTERFACE_H #endif // KMAILPLUGINEDITORCHECKBEFORESENDMANAGERINTERFACE_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