[pim/akonadi-mime] /: Prepare to implement undo/redo change message status

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

Prepare to implement undo/redo change message status

M  +1    -1    CMakeLists.txt
M  +17   -6    src/standardmailactionmanager.cpp
M  +17   -1    src/standardmailactionmanager.h

https://invent.kde.org/pim/akonadi-mime/-/commit/b8913e71084e25da16b4173bccec44ba08366e66

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05b5755..e4bdf3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 cmake_minimum_required(VERSION 3.29)
 
-set(PIM_VERSION "6.8.40")
+set(PIM_VERSION "6.8.41")
 project(Akonadi-Mime VERSION ${PIM_VERSION})
 
 # ECM setup
diff --git a/src/standardmailactionmanager.cpp b/src/standardmailactionmanager.cpp
index 473284e..72fd613 100644
--- a/src/standardmailactionmanager.cpp
+++ b/src/standardmailactionmanager.cpp
@@ -28,7 +28,6 @@
 #include <Akonadi/MimeTypeChecker>
 #include <Akonadi/SubscriptionDialog>
 
-#include "messagestatus.h"
 #include <KMime/Message>
 
 #include <KActionCollection>
@@ -475,8 +474,7 @@ public:
             return;
         }
 
-        auto command = new MarkAsCommand(targetStatus, items, invert, mParent);
-        command->execute();
+        mParent->executeMarkAsCommand(targetStatus, items, invert);
     }
 
     void slotMarkAs()
@@ -525,9 +523,7 @@ public:
         if (mInterceptedActions.contains(type) && checkIntercept) {
             return;
         }
-
-        auto command = new MarkAsCommand(targetStatus, collections, invert, recursive, mParent);
-        command->execute();
+        mParent->executeMarkAsCommand(targetStatus, collections, invert, recursive);
     }
 
     void slotMarkAllAs()
@@ -995,4 +991,19 @@ void StandardMailActionManager::markAllItemsAs(const QByteArray &typeStr, const
     d->markAllItemsAs(typeStr, collections, checkIntercept);
 }
 
+void StandardMailActionManager::executeMarkAsCommand(Akonadi::MessageStatus targetStatus, const Akonadi::Item::List &items, bool invert)
+{
+    auto command = new MarkAsCommand(targetStatus, items, invert, this);
+    command->execute();
+}
+
+void StandardMailActionManager::executeMarkAsCommand(Akonadi::MessageStatus targetStatus,
+                                                     const Akonadi::Collection::List &collections,
+                                                     bool invert,
+                                                     bool recursive)
+{
+    auto command = new MarkAsCommand(targetStatus, collections, invert, recursive, this);
+    command->execute();
+}
+
 #include "moc_standardmailactionmanager.cpp"
diff --git a/src/standardmailactionmanager.h b/src/standardmailactionmanager.h
index d96e3a2..b06f3ad 100644
--- a/src/standardmailactionmanager.h
+++ b/src/standardmailactionmanager.h
@@ -9,7 +9,7 @@
 #pragma once
 
 #include "akonadi-mime_export.h"
-
+#include "messagestatus.h"
 #include <Akonadi/StandardActionManager>
 
 #include <QObject>
@@ -225,6 +225,22 @@ public:
      */
     void setItems(const Item::List &selectedItems);
 
+    /*!
+     * \brief executeMarkAsCommand
+     * \param targetStatus
+     * \param items
+     * \param invert
+     */
+    virtual void executeMarkAsCommand(Akonadi::MessageStatus targetStatus, const Akonadi::Item::List &items, bool invert);
+
+    /*!
+     * \brief executeMarkAsCommand
+     * \param targetStatus
+     * \param items
+     * \param invert
+     * \param recursive
+     */
+    virtual void executeMarkAsCommand(Akonadi::MessageStatus targetStatus, const Akonadi::Collection::List &items, bool invert, bool recursive);
 Q_SIGNALS:
     /*!
      * This signal is emitted whenever the action state has been updated.
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.