Allow to insert emoticon in subject too

wilder
Laurent Montel 7 years ago
parent c47e4a73e6
commit c0310aa4db
  1. 2
      CMakeLists.txt
  2. 18
      src/editor/kmcomposerglobalaction.cpp
  3. 1
      src/editor/kmcomposerglobalaction.h
  4. 1
      src/editor/kmcomposerwin.cpp

@ -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")

@ -128,3 +128,21 @@ void KMComposerGlobalAction::slotMarkAll()
static_cast<QTextEdit *>(fw)->selectAll();
}
}
void KMComposerGlobalAction::slotInsertEmoticon(const QString &str)
{
QWidget *fw = mComposerWin->focusWidget();
if (!fw) {
return;
}
if (::qobject_cast<PimCommon::LineEditWithAutoCorrection *>(fw)) {
static_cast<PimCommon::LineEditWithAutoCorrection *>(fw)->insertPlainText(str);
} else if (::qobject_cast<KLineEdit *>(fw)) {
//Don't insert emoticon in mail linedit
//static_cast<KLineEdit *>(fw)->insert(str);
} else if (::qobject_cast<KMComposerEditorNg *>(fw)) {
static_cast<QTextEdit *>(fw)->insertPlainText(str);
}
}

@ -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;

@ -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);

Loading…
Cancel
Save