diff --git a/CMakeLists.txt b/CMakeLists.txt index 195ee7709..f26647d9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ set(KLDAP_LIB_VERSION "5.10.80") set(KMAILTRANSPORT_LIB_VERSION "5.10.80") set(KONTACTINTERFACE_LIB_VERSION "5.10.80") set(KMIME_LIB_VERSION "5.10.80") -set(KPIMTEXTEDIT_LIB_VERSION "5.10.80") +set(KPIMTEXTEDIT_LIB_VERSION "5.10.91") set(AKONADI_VERSION "5.10.80") set(KTNEF_LIB_VERSION "5.10.80") diff --git a/src/editor/kmcomposerglobalaction.cpp b/src/editor/kmcomposerglobalaction.cpp index c910b85d7..48e6fc375 100644 --- a/src/editor/kmcomposerglobalaction.cpp +++ b/src/editor/kmcomposerglobalaction.cpp @@ -128,3 +128,21 @@ void KMComposerGlobalAction::slotMarkAll() static_cast(fw)->selectAll(); } } + + +void KMComposerGlobalAction::slotInsertEmoticon(const QString &str) +{ + QWidget *fw = mComposerWin->focusWidget(); + if (!fw) { + return; + } + + if (::qobject_cast(fw)) { + static_cast(fw)->insertPlainText(str); + } else if (::qobject_cast(fw)) { + //Don't insert emoticon in mail linedit + //static_cast(fw)->insert(str); + } else if (::qobject_cast(fw)) { + static_cast(fw)->insertPlainText(str); + } +} diff --git a/src/editor/kmcomposerglobalaction.h b/src/editor/kmcomposerglobalaction.h index 86e4dda3d..275caaae2 100644 --- a/src/editor/kmcomposerglobalaction.h +++ b/src/editor/kmcomposerglobalaction.h @@ -34,6 +34,7 @@ public Q_SLOTS: void slotCopy(); void slotPaste(); void slotMarkAll(); + void slotInsertEmoticon(const QString &str); private: Q_DISABLE_COPY(KMComposerGlobalAction) KMComposerWin *mComposerWin = nullptr; diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp index 89233ed04..e9c95181c 100644 --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -363,6 +363,7 @@ KMComposerWin::KMComposerWin(const KMime::Message::Ptr &aMsg, bool lastSignState KMComposerEditorNg *composerEditorNg = new KMComposerEditorNg(this, mCryptoStateIndicatorWidget); mRichTextEditorwidget = new KPIMTextEdit::RichTextEditorWidget(composerEditorNg, mCryptoStateIndicatorWidget); + connect(composerEditorNg, &KMComposerEditorNg::insertEmoticon, mGlobalAction, &KMComposerGlobalAction::slotInsertEmoticon); //Don't use new connect api here. It crashs connect(composerEditorNg, SIGNAL(textChanged()), this, SLOT(slotEditorTextChanged())); connect(composerEditorNg, &KMComposerEditorNg::selectionChanged, this, &KMComposerWin::slotSelectionChanged);