Commit 8a54b26d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Prepare fixing bug 424184 (Wrong message marked when using message

window)
parent 868d499f
Pipeline #34249 passed with stage
in 15 minutes and 40 seconds
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.15.40")
set(PIM_VERSION "5.15.41")
project(Akonadi-Mime VERSION ${PIM_VERSION})
# ECM setup
......
......@@ -483,18 +483,8 @@ public:
action->setData(data);
}
void slotMarkAs()
void markItemsAs(QByteArray typeStr, const Akonadi::Item::List &items, bool checkIntercept = true)
{
const Akonadi::Item::List items = mGenericManager->selectedItems();
if (items.isEmpty()) {
return;
}
const QAction *action = qobject_cast<QAction *>(mParent->sender());
Q_ASSERT(action);
QByteArray typeStr = action->data().toByteArray();
qCDebug(AKONADIMIME_LOG) << "Mark mail as: " << typeStr;
bool invert = false;
......@@ -517,7 +507,7 @@ public:
type = MarkMailAsImportant;
}
if (mInterceptedActions.contains(type)) {
if (mInterceptedActions.contains(type) && checkIntercept) {
return;
}
......@@ -525,17 +515,23 @@ public:
command->execute();
}
void slotMarkAllAs()
void slotMarkAs()
{
const Akonadi::Collection::List collections = mGenericManager->selectedCollections();
if (collections.isEmpty()) {
const Akonadi::Item::List items = mGenericManager->selectedItems();
if (items.isEmpty()) {
return;
}
const QAction *action = qobject_cast<QAction *>(mParent->sender());
Q_ASSERT(action);
QByteArray typeStr = action->data().toByteArray();
const QByteArray typeStr = action->data().toByteArray();
markItemsAs(typeStr, items, true);
}
void markAllItemsAs(QByteArray typeStr, const Akonadi::Collection::List &collections, bool checkIntercept = true)
{
qCDebug(AKONADIMIME_LOG) << "Mark all as: " << typeStr;
......@@ -564,7 +560,7 @@ public:
type = MarkAllMailAsImportant;
}
if (mInterceptedActions.contains(type)) {
if (mInterceptedActions.contains(type) && checkIntercept) {
return;
}
......@@ -572,6 +568,19 @@ public:
command->execute();
}
void slotMarkAllAs()
{
const Akonadi::Collection::List collections = mGenericManager->selectedCollections();
if (collections.isEmpty()) {
return;
}
const QAction *action = qobject_cast<QAction *>(mParent->sender());
Q_ASSERT(action);
const QByteArray typeStr = action->data().toByteArray();
markAllItemsAs(typeStr, collections, true);
}
void slotMoveToTrash()
{
if (mInterceptedActions.contains(StandardMailActionManager::MoveToTrash)) {
......@@ -1011,4 +1020,14 @@ Akonadi::StandardActionManager *StandardMailActionManager::standardActionManager
return d->mGenericManager;
}
void StandardMailActionManager::markItemsAs(const QByteArray &typeStr, const Item::List &items, bool checkIntercept)
{
d->markItemsAs(typeStr, items, checkIntercept);
}
void StandardMailActionManager::markAllItemsAs(const QByteArray &typeStr, const Collection::List &collections, bool checkIntercept)
{
d->markAllItemsAs(typeStr, collections, checkIntercept);
}
#include "moc_standardmailactionmanager.cpp"
......@@ -189,6 +189,9 @@ public:
void setCollectionPropertiesPageNames(const QStringList &names);
Akonadi::StandardActionManager *standardActionManager() const;
void markItemsAs(const QByteArray &typeStr, const Akonadi::Item::List &items, bool checkIntercept = true);
void markAllItemsAs(const QByteArray &typeStr, const Akonadi::Collection::List &collections, bool checkIntercept = true);
Q_SIGNALS:
/**
* This signal is emitted whenever the action state has been updated.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment