Commit 1acd104e authored by Laurent Montel's avatar Laurent Montel 😁

Initialize plugin

parent 3ff80274
......@@ -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;
}
......@@ -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;
};
......
......@@ -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) {
......
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