[pim/kmail] src: Add create undo/redo action

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 66daa2bfeff58f72026c3e15ccb59092cb79416c by Laurent Montel.
Committed on 27/07/2026 at 05:59.
Pushed by mlaurent into branch 'master'.

Add create undo/redo action

M  +9    -0    src/kmmainwidget.cpp
M  +5    -0    src/kmundoredomanager.cpp
M  +2    -0    src/kmundoredomanager.h

https://invent.kde.org/pim/kmail/-/commit/66daa2bfeff58f72026c3e15ccb59092cb79416c

diff --git a/src/kmmainwidget.cpp b/src/kmmainwidget.cpp
index d34b6cf28..0d1671d4d 100644
--- a/src/kmmainwidget.cpp
+++ b/src/kmmainwidget.cpp
@@ -16,6 +16,7 @@
 #include "job/composenewmessagejob.h"
 #include "kmcommands.h"
 #include "kmreadermainwin.h"
+#include "kmundoredomanager.h"
 #include "searchdialog/searchwindowdialog.h"
 #include "undostack.h"
 #include "util.h"
@@ -3564,6 +3565,14 @@ void KMMainWidget::setupActions()
         connect(action, &QAction::triggered, this, &KMMainWidget::slotCreateAddressBookContact);
     }
 
+#if 0 // TODO
+    QAction *undoAct = actionCollection()->addAction(QStringLiteral("kmail_undo"), KMKernel::self()->undoRedoManager()->undoStack()->createUndoAction(this));
+    connect(undoAct, &QAction::triggered, this, &KMMainWidget::slotUndo);
+
+    QAction *redoAct = actionCollection()->addAction(QStringLiteral("kmail_redo"), KMKernel::self()->undoRedoManager()->undoStack()->createRedoAction(this));
+    connect(redoAct, &QAction::triggered, this, &KMMainWidget::slotRedo);
+#endif
+
     QAction *act = actionCollection()->addAction(KStandardAction::Undo, QStringLiteral("kmail_undo"));
     connect(act, &QAction::triggered, this, &KMMainWidget::slotUndo);
 
diff --git a/src/kmundoredomanager.cpp b/src/kmundoredomanager.cpp
index 3898b6965..d4bd7e648 100644
--- a/src/kmundoredomanager.cpp
+++ b/src/kmundoredomanager.cpp
@@ -33,6 +33,11 @@ void KMUndoRedoManager::slotMoveResult(KJob *job)
     }
 }
 
+QUndoStack *KMUndoRedoManager::undoStack() const
+{
+    return mUndoStack;
+}
+
 QUndoCommand *KMUndoRedoManager::newUndoMoveAction(const Akonadi::Collection &srcFolder, const Akonadi::Collection &destFolder)
 {
     auto info = new KMUndoInfoMoveItems(this);
diff --git a/src/kmundoredomanager.h b/src/kmundoredomanager.h
index 50c120e2b..758aa169e 100644
--- a/src/kmundoredomanager.h
+++ b/src/kmundoredomanager.h
@@ -25,6 +25,8 @@ public:
     void moveItems(const Akonadi::Item::List &list, const Akonadi::Collection &collection);
     void slotMoveResult(KJob *job);
 
+    [[nodiscard]] QUndoStack *undoStack() const;
+
 private:
     QUndoStack *const mUndoStack;
 };
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.