[pim/kmail] src: Add undo/redo here too

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

Add undo/redo here too

M  +6    -1    src/kmcommands.cpp

https://invent.kde.org/pim/kmail/-/commit/22cc29b4e31b2985e7f5d83b154acf7586904c5c

diff --git a/src/kmcommands.cpp b/src/kmcommands.cpp
index 6434b821d..69526a635 100644
--- a/src/kmcommands.cpp
+++ b/src/kmcommands.cpp
@@ -1510,7 +1510,6 @@ KMCommand::Result KMMoveCommand::execute()
         if (mDestFolder.isValid()) {
             auto job = new Akonadi::ItemMoveJob(retrievedList, mDestFolder, this);
             connect(job, &KIO::Job::result, this, &KMMoveCommand::slotMoveResult);
-
             // group by source folder for undo
             std::sort(retrievedList.begin(), retrievedList.end(), [](const Akonadi::Item &lhs, const Akonadi::Item &rhs) {
                 return lhs.storageCollectionId() < rhs.storageCollectionId();
@@ -1523,10 +1522,16 @@ KMCommand::Result KMMoveCommand::execute()
                 }
                 if (parent.id() != item.storageCollectionId()) {
                     parent = Akonadi::Collection(item.storageCollectionId());
+                    if (command) {
+                        kmkernel->undoRedoManager()->undoStack()->push(command);
+                    }
                     command = kmkernel->undoRedoManager()->newUndoMoveAction(parent, mDestFolder);
                 }
                 kmkernel->undoRedoManager()->addMsgToMoveAction(command, item);
             }
+            if (command) {
+                kmkernel->undoRedoManager()->undoStack()->push(command);
+            }
         } else {
             auto job = new Akonadi::ItemDeleteJob(retrievedList, this);
             connect(job, &KIO::Job::result, this, &KMMoveCommand::slotMoveResult);
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.