From 20e08e1cc58fc6a9217c7592584c64d1e1fc3e5e Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 24 Sep 2019 08:57:12 +0200 Subject: [PATCH] Continue to implement processkeyevent --- CMakeLists.txt | 2 +- src/editor/kmcomposerwin.cpp | 4 +--- .../kmailplugineditormanagerinterface.cpp | 14 ++++++++++++++ .../kmailplugineditormanagerinterface.h | 2 ++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 999fbee8e..dcbca3c85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widget set(LIBGRAVATAR_VERSION_LIB "5.12.40") set(MAILCOMMON_LIB_VERSION_LIB "5.12.43") set(KDEPIM_APPS_LIB_VERSION_LIB "5.12.40") -set(MESSAGELIB_LIB_VERSION_LIB "5.12.56") +set(MESSAGELIB_LIB_VERSION_LIB "5.12.57") set(LIBKLEO_LIB_VERSION_LIB "5.12.40") set(PIMCOMMON_LIB_VERSION_LIB "5.12.40") set(LIBKDEPIM_LIB_VERSION_LIB "5.12.40") diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp index edb56d763..b6f7bf8e7 100644 --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -3336,9 +3336,7 @@ void KMComposerWin::addExtraCustomHeaders(const QMap &heade bool KMComposerWin::processModifyText(QKeyEvent *event) { - Q_UNUSED(event); - //TODO - return false; + return mPluginEditorManagerInterface->processProcessKeyEvent(event); } MessageComposer::PluginEditorConvertTextInterface::ConvertTextStatus KMComposerWin::convertPlainText(MessageComposer::TextPart *textPart) diff --git a/src/editor/plugininterface/kmailplugineditormanagerinterface.cpp b/src/editor/plugininterface/kmailplugineditormanagerinterface.cpp index 89bb723bf..e606c91de 100644 --- a/src/editor/plugininterface/kmailplugineditormanagerinterface.cpp +++ b/src/editor/plugininterface/kmailplugineditormanagerinterface.cpp @@ -103,6 +103,20 @@ void KMailPluginEditorManagerInterface::setComposerInterface(MessageComposer::Co mComposerInterface = composerInterface; } +bool KMailPluginEditorManagerInterface::processProcessKeyEvent(QKeyEvent *event) +{ + if (!mListPluginInterface.isEmpty()) { + for (MessageComposer::PluginEditorInterface *interface : qAsConst(mListPluginInterface)) { + if (static_cast(interface->plugin())->canProcessKeyEvent()) { + if (interface->processProcessKeyEvent(event)) { + return true; + } + } + } + } + return false; +} + KActionCollection *KMailPluginEditorManagerInterface::actionCollection() const { return mActionCollection; diff --git a/src/editor/plugininterface/kmailplugineditormanagerinterface.h b/src/editor/plugininterface/kmailplugineditormanagerinterface.h index 642ebbda8..7443cf95d 100644 --- a/src/editor/plugininterface/kmailplugineditormanagerinterface.h +++ b/src/editor/plugininterface/kmailplugineditormanagerinterface.h @@ -56,6 +56,8 @@ public: MessageComposer::ComposerViewBase *composerInterface() const; void setComposerInterface(MessageComposer::ComposerViewBase *composerInterface); + Q_REQUIRED_RESULT bool processProcessKeyEvent(QKeyEvent *event); + Q_SIGNALS: void textSelectionChanged(bool hasSelection); void message(const QString &str);