summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Montel <[email protected]>2018-03-06 06:53:37 +0100
committerLaurent Montel <[email protected]>2018-03-06 06:53:37 +0100
commit1acd104e9a4a043bcbb6514e9d727eb2b96683f1 (patch)
treee800d9348732a49f1da22c233d2e273464af8972
parent3ff802743f397ce73a146bcd1128a98a886841b9 (diff)
Initialize plugin
-rw-r--r--src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp24
-rw-r--r--src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h7
-rw-r--r--src/editor/plugininterface/kmailplugineditorinitmanagerinterface.cpp1
3 files changed, 31 insertions, 1 deletions
diff --git a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp
index 481bd1d..6cdfa5d 100644
--- a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp
+++ b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp
@@ -57,5 +57,27 @@ void KMailPluginEditorConvertTextManagerInterface::setActionCollection(KActionCo
void KMailPluginEditorConvertTextManagerInterface::initializePlugins()
{
- //TODO
+ if (!mListPluginInterface.isEmpty()) {
+ qCDebug(KMAIL_LOG) << "KMailPluginEditorConvertTextManagerInterface : Plugin was already initialized. This is a bug";
+ return;
+ }
+ const QVector<MessageComposer::PluginEditorConvertText *> lstPlugin = MessageComposer::PluginEditorConvertTextManager::self()->pluginsList();
+ for (MessageComposer::PluginEditorConvertText *plugin : lstPlugin) {
+ if (plugin->isEnabled()) {
+ MessageComposer::PluginEditorConvertTextInterface *interface = static_cast<MessageComposer::PluginEditorConvertTextInterface *>(plugin->createInterface(mActionCollection, this));
+ interface->setRichTextEditor(mRichTextEditor);
+ interface->setParentWidget(mParentWidget);
+ mListPluginInterface.append(interface);
+ }
+ }
+}
+
+KPIMTextEdit::RichTextComposer *KMailPluginEditorConvertTextManagerInterface::richTextEditor() const
+{
+ return mRichTextEditor;
+}
+
+void KMailPluginEditorConvertTextManagerInterface::setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor)
+{
+ mRichTextEditor = richTextEditor;
}
diff --git a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h
index c721532..b7008b8 100644
--- a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h
+++ b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h
@@ -25,6 +25,9 @@ class QWidget;
namespace MessageComposer {
class PluginEditorConvertTextInterface;
}
+namespace KPIMTextEdit {
+class RichTextComposer;
+}
class KActionCollection;
class KMailPluginEditorConvertTextManagerInterface : public QObject
{
@@ -40,9 +43,13 @@ public:
void initializePlugins();
+ KPIMTextEdit::RichTextComposer *richTextEditor() const;
+ void setRichTextEditor(KPIMTextEdit::RichTextComposer *richTextEditor);
+
private:
Q_DISABLE_COPY(KMailPluginEditorConvertTextManagerInterface)
QList<MessageComposer::PluginEditorConvertTextInterface *> mListPluginInterface;
+ KPIMTextEdit::RichTextComposer *mRichTextEditor = nullptr;
QWidget *mParentWidget = nullptr;
KActionCollection *mActionCollection = nullptr;
};
diff --git a/src/editor/plugininterface/kmailplugineditorinitmanagerinterface.cpp b/src/editor/plugininterface/kmailplugineditorinitmanagerinterface.cpp
index e944a0b..05defb8 100644
--- a/src/editor/plugininterface/kmailplugineditorinitmanagerinterface.cpp
+++ b/src/editor/plugininterface/kmailplugineditorinitmanagerinterface.cpp
@@ -52,6 +52,7 @@ void KMailPluginEditorInitManagerInterface::initializePlugins()
{
if (mWasInitialized) {
qCDebug(KMAIL_LOG) << "KMailPluginEditorInitManagerInterface : Plugin was already initialized. This is a bug";
+ return;
}
const QVector<MessageComposer::PluginEditorInit *> lstPlugin = MessageComposer::PluginEditorInitManager::self()->pluginsList();
for (MessageComposer::PluginEditorInit *plugin : lstPlugin) {