diff --git a/CMakeLists.txt b/CMakeLists.txt index b2af5b167..cb291c837 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Network Test Widgets WebEngine WebEngineWidgets) set(LIBGRAVATAR_VERSION_LIB "5.12.40") -set(MAILCOMMON_LIB_VERSION_LIB "5.12.46") +set(MAILCOMMON_LIB_VERSION_LIB "5.12.50") set(KDEPIM_APPS_LIB_VERSION_LIB "5.12.43") set(MESSAGELIB_LIB_VERSION_LIB "5.12.68") set(LIBKLEO_LIB_VERSION_LIB "5.12.40") diff --git a/src/editor/kmcomposerwin.cpp b/src/editor/kmcomposerwin.cpp index 5d5c09830..410459853 100644 --- a/src/editor/kmcomposerwin.cpp +++ b/src/editor/kmcomposerwin.cpp @@ -383,7 +383,7 @@ KMComposerWin::KMComposerWin(const KMime::Message::Ptr &aMsg, bool lastSignState connect(composerEditorNg, &KMComposerEditorNg::insertModeChanged, this, &KMComposerWin::slotOverwriteModeChanged); connect(composerEditorNg, &KMComposerEditorNg::spellCheckingFinished, this, &KMComposerWin::slotDelayedCheckSendNow); mSnippetWidget = new MailCommon::SnippetTreeView(actionCollection(), mSnippetSplitter); - connect(mSnippetWidget, &MailCommon::SnippetTreeView::insertSnippetText, this, &KMComposerWin::insertSnippetText); + connect(mSnippetWidget, &MailCommon::SnippetTreeView::insertSubjectAndPlainText, this, &KMComposerWin::insertSubjectAndPlainText); connect(composerEditorNg, &KMComposerEditorNg::insertSnippet, mSnippetWidget->snippetsManager(), &MailCommon::SnippetsManager::insertSnippet); mSnippetWidget->setVisible(KMailSettings::self()->showSnippetManager()); mSnippetSplitter->addWidget(mSnippetWidget); @@ -513,16 +513,36 @@ KMComposerWin::~KMComposerWin() delete mComposerBase; } -void KMComposerWin::insertSnippetText(const QString &str) +void KMComposerWin::insertSubjectAndPlainText(const QString &subject, const QString &str) { - MessageComposer::ConvertSnippetVariablesJob *job = new MessageComposer::ConvertSnippetVariablesJob(this); - job->setText(str); - MessageComposer::ComposerViewInterface *interface = new MessageComposer::ComposerViewInterface(mComposerBase); - job->setComposerViewInterface(interface); - connect(job, &MessageComposer::ConvertSnippetVariablesJob::textConverted, this, [this](const QString &str) { - mComposerBase->editor()->insertPlainText(str); - }); - job->start(); + { + //Convert plain text + MessageComposer::ConvertSnippetVariablesJob *job = new MessageComposer::ConvertSnippetVariablesJob(this); + job->setText(str); + MessageComposer::ComposerViewInterface *interface = new MessageComposer::ComposerViewInterface(mComposerBase); + job->setComposerViewInterface(interface); + connect(job, &MessageComposer::ConvertSnippetVariablesJob::textConverted, this, [this](const QString &str) { + mComposerBase->editor()->insertPlainText(str); + }); + job->start(); + } + + { + //Convert subject + MessageComposer::ConvertSnippetVariablesJob *job = new MessageComposer::ConvertSnippetVariablesJob(this); + job->setText(subject); + MessageComposer::ComposerViewInterface *interface = new MessageComposer::ComposerViewInterface(mComposerBase); + job->setComposerViewInterface(interface); + connect(job, &MessageComposer::ConvertSnippetVariablesJob::textConverted, this, [this](const QString &str) { + if (!str.isEmpty()) { + if (mComposerBase->subject().isEmpty()) { //Add subject only if we don't have subject + mEdtSubject->setText(str); + } + } + }); + job->start(); + } + } void KMComposerWin::slotSpellCheckingLanguage(const QString &language) diff --git a/src/editor/kmcomposerwin.h b/src/editor/kmcomposerwin.h index 236af0b86..7efda9587 100644 --- a/src/editor/kmcomposerwin.h +++ b/src/editor/kmcomposerwin.h @@ -548,7 +548,7 @@ private: void slotSelectionChanged(); void slotMessage(const QString &str); void slotEditorPluginInsertText(const QString &str); - void insertSnippetText(const QString &str); + void insertSubjectAndPlainText(const QString &subject, const QString &str); bool sendLaterRegistered() const; Akonadi::Collection mCollectionForNewMessage;