[pim/kdepim-addons] kmail/editorconvertertextplugins/markdown/plugin: Don't duplicate connection

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 1260ca5d33972831d30d53deec741f1975d0c34b by Laurent Montel.
Committed on 16/08/2026 at 07:36.
Pushed by mlaurent into branch 'master'.

Don't duplicate connection

M  +5    -5    kmail/editorconvertertextplugins/markdown/plugin/markdowninterface.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/1260ca5d33972831d30d53deec741f1975d0c34b

diff --git a/kmail/editorconvertertextplugins/markdown/plugin/markdowninterface.cpp b/kmail/editorconvertertextplugins/markdown/plugin/markdowninterface.cpp
index 1942c120b..42aad4bba 100644
--- a/kmail/editorconvertertextplugins/markdown/plugin/markdowninterface.cpp
+++ b/kmail/editorconvertertextplugins/markdown/plugin/markdowninterface.cpp
@@ -82,6 +82,11 @@ void MarkdownInterface::createAction(KActionCollection *ac)
     MessageComposer::PluginActionType typePopup(mPopupMenuAction, MessageComposer::PluginActionType::PopupMenu);
     addActionType(typePopup);
     connect(richTextEditor(), &KPIMTextEdit::RichTextComposer::selectionChanged, this, &MarkdownInterface::slotSelectionChanged);
+    connect(richTextEditor(), &TextCustomEditor::RichTextEditor::textChanged, this, [this]() {
+        if (mDialog) {
+            mDialog->setText(richTextEditor()->toPlainText());
+        }
+    });
 }
 
 void MarkdownInterface::slotSelectionChanged()
@@ -282,11 +287,6 @@ void MarkdownInterface::slotActivated(bool checked)
     if (mDialog.isNull()) {
         mDialog = new MarkdownPreviewDialog(parentWidget());
         mDialog->setText(richTextEditor()->toPlainText());
-        connect(richTextEditor(), &TextCustomEditor::RichTextEditor::textChanged, this, [this]() {
-            if (mDialog) {
-                mDialog->setText(richTextEditor()->toPlainText());
-            }
-        });
     }
     mStatusBarLabel->setToggleMode(checked);
     if (checked) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.