From 4a1ccac745ee6cfc56469448b37bab472de400ee Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 16 Oct 2018 08:06:07 +0200 Subject: [PATCH] Add status bar support for convertertext plugin --- CMakeLists.txt | 2 +- src/editor/kmcomposerwin.cpp | 4 ++++ ...kmailplugineditorconverttextmanagerinterface.cpp | 13 +++++++++++++ .../kmailplugineditorconverttextmanagerinterface.h | 3 +++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2918f961e..17c4f0649 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widget set(LIBGRAVATAR_VERSION_LIB "5.9.40") set(MAILCOMMON_LIB_VERSION_LIB "5.9.41") set(KDEPIM_APPS_LIB_VERSION_LIB "5.9.40") -set(MESSAGELIB_LIB_VERSION_LIB "5.9.55") +set(MESSAGELIB_LIB_VERSION_LIB "5.9.57") set(LIBKLEO_LIB_VERSION_LIB "5.9.40") set(PIMCOMMON_LIB_VERSION_LIB "5.9.42") set(LIBKDEPIM_LIB_VERSION_LIB "5.9.40") diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp index defe6197b..9c2d07748 100644 --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -1402,6 +1402,10 @@ void KMComposerWin::initializePluginActions() for (int i = 0; i < statusbarWidgetList.count(); ++i) { statusBar()->addPermanentWidget(statusbarWidgetList.at(i), 0); } + const QList statusbarWidgetListConverter = mPluginEditorConvertTextManagerInterface->statusBarWidgetList(); + for (int i = 0; i < statusbarWidgetListConverter.count(); ++i) { + statusBar()->addPermanentWidget(statusbarWidgetListConverter.at(i), 0); + } } } diff --git a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp index 58cdcc08a..3e4961493 100644 --- a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp +++ b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.cpp @@ -125,6 +125,7 @@ void KMailPluginEditorConvertTextManagerInterface::initializePlugins() MessageComposer::PluginEditorConvertTextInterface *interface = static_cast(plugin->createInterface(mActionCollection, this)); interface->setRichTextEditor(mRichTextEditor); interface->setParentWidget(mParentWidget); + interface->setPlugin(plugin); mListPluginInterface.append(interface); } } @@ -191,3 +192,15 @@ QList KMailPluginEditorConvertTextManagerInterface::actionsType(Messa { return mActionHash.value(type); } + +QList KMailPluginEditorConvertTextManagerInterface::statusBarWidgetList() +{ + if (mStatusBarWidget.isEmpty() && !mListPluginInterface.isEmpty()) { + for (MessageComposer::PluginEditorConvertTextInterface *interface : qAsConst(mListPluginInterface)) { + if (interface->plugin()->hasStatusBarSupport()) { + mStatusBarWidget.append(interface->statusBarWidget()); + } + } + } + return mStatusBarWidget; +} diff --git a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h index 33bdd8131..6b6fbfe57 100644 --- a/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h +++ b/src/editor/plugininterface/kmailplugineditorconverttextmanagerinterface.h @@ -54,6 +54,8 @@ public: void setInitialData(const MessageComposer::PluginEditorConverterInitialData &data); void setDataBeforeConvertingText(const MessageComposer::PluginEditorConverterBeforeConvertingData &data); void enableDisablePluginActions(bool richText); + + QList statusBarWidgetList(); Q_SIGNALS: void reformatingTextDone(); @@ -64,6 +66,7 @@ private: KPIMTextEdit::RichTextComposer *mRichTextEditor = nullptr; QWidget *mParentWidget = nullptr; KActionCollection *mActionCollection = nullptr; + QList mStatusBarWidget; }; #endif // KMAILPLUGINEDITORCONVERTTEXTMANAGERINTERFACE_H