Fix insert text even in subject

wilder
Laurent Montel 7 years ago
parent 5bc246552d
commit d9f86c7cdd
  1. 4
      CMakeLists.txt
  2. 17
      src/editor/kmcomposerglobalaction.cpp
  3. 1
      src/editor/kmcomposerglobalaction.h
  4. 6
      src/editor/kmcomposerwin.cpp
  5. 1
      src/editor/kmcomposerwin.h
  6. 1
      src/editor/plugininterface/kmailplugineditormanagerinterface.cpp
  7. 1
      src/editor/plugininterface/kmailplugineditormanagerinterface.h

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
set(KDEPIM_VERSION_NUMBER "5.10.90")
set(KDEPIM_VERSION_NUMBER "5.10.91")
project(kmail VERSION ${KDEPIM_VERSION_NUMBER})
@ -66,7 +66,7 @@ find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widget
set(LIBGRAVATAR_VERSION_LIB "5.10.90")
set(MAILCOMMON_LIB_VERSION_LIB "5.10.90")
set(KDEPIM_APPS_LIB_VERSION_LIB "5.10.90")
set(MESSAGELIB_LIB_VERSION_LIB "5.10.90")
set(MESSAGELIB_LIB_VERSION_LIB "5.10.91")
set(LIBKLEO_LIB_VERSION_LIB "5.10.90")
set(PIMCOMMON_LIB_VERSION_LIB "5.10.90")
set(LIBKDEPIM_LIB_VERSION_LIB "5.10.90")

@ -146,3 +146,20 @@ void KMComposerGlobalAction::slotInsertEmoticon(const QString &str)
static_cast<QTextEdit *>(fw)->insertPlainText(str);
}
}
void KMComposerGlobalAction::slotInsertText(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);
}
}

@ -35,6 +35,7 @@ public Q_SLOTS:
void slotPaste();
void slotMarkAll();
void slotInsertEmoticon(const QString &str);
void slotInsertText(const QString &str);
private:
Q_DISABLE_COPY(KMComposerGlobalAction)
KMComposerWin *mComposerWin = nullptr;

@ -242,6 +242,7 @@ KMComposerWin::KMComposerWin(const KMime::Message::Ptr &aMsg, bool lastSignState
mPluginEditorManagerInterface = new KMailPluginEditorManagerInterface(this);
connect(mPluginEditorManagerInterface, &KMailPluginEditorManagerInterface::message, this, &KMComposerWin::slotMessage);
connect(mPluginEditorManagerInterface, &KMailPluginEditorManagerInterface::insertText, this, &KMComposerWin::slotEditorPluginInsertText);
mPluginEditorCheckBeforeSendManagerInterface = new KMailPluginEditorCheckBeforeSendManagerInterface(this);
mPluginEditorInitManagerInterface = new KMailPluginEditorInitManagerInterface(this);
mPluginEditorConvertTextManagerInterface = new KMailPluginEditorConvertTextManagerInterface(this);
@ -3630,3 +3631,8 @@ void KMComposerWin::slotMessage(const QString &str)
{
KMessageBox::information(this, str, i18n("Plugin Editor Information"));
}
void KMComposerWin::slotEditorPluginInsertText(const QString &str)
{
mGlobalAction->slotInsertText(str);
}

@ -546,6 +546,7 @@ private:
int validateLineWrapWidth();
void slotSelectionChanged();
void slotMessage(const QString &str);
void slotEditorPluginInsertText(const QString &str);
Akonadi::Collection mCollectionForNewMessage;
QMap<QByteArray, QString> mExtraHeaders;

@ -78,6 +78,7 @@ void KMailPluginEditorManagerInterface::initializePlugins()
interface->setPlugin(plugin);
connect(interface, &MessageComposer::PluginEditorInterface::emitPluginActivated, this, &KMailPluginEditorManagerInterface::slotPluginActivated);
connect(interface, &MessageComposer::PluginEditorInterface::message, this, &KMailPluginEditorManagerInterface::message);
connect(interface, &MessageComposer::PluginEditorInterface::insertText, this, &KMailPluginEditorManagerInterface::insertText);
mListPluginInterface.append(interface);
}
}

@ -55,6 +55,7 @@ public:
Q_SIGNALS:
void textSelectionChanged(bool hasSelection);
void message(const QString &str);
void insertText(const QString &str);
private:
Q_DISABLE_COPY(KMailPluginEditorManagerInterface)

Loading…
Cancel
Save