Commit a6e9762a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to update actions when we show only one items

parent 8a54b26d
Pipeline #34446 passed with stage
in 23 minutes and 48 seconds
cmake_minimum_required(VERSION 3.5)
set(PIM_VERSION "5.15.41")
set(PIM_VERSION "5.15.42")
project(Akonadi-Mime VERSION ${PIM_VERSION})
# ECM setup
......
......@@ -322,14 +322,9 @@ public:
updateActions(selectedCollections, {}, selectedItems);
}
void updateActions(const Collection::List &selectedCollections,
const Collection::List &selectedFavoriteCollections,
const Item::List &selectedItems)
void updateActionsFromSelectedItems(const Item::List &selectedItems)
{
Q_UNUSED(selectedFavoriteCollections);
const bool itemIsSelected = !selectedItems.isEmpty();
const bool collectionIsSelected = !selectedCollections.isEmpty();
if (itemIsSelected) {
bool allMarkedAsImportant = true;
bool allMarkedAsRead = true;
......@@ -405,6 +400,16 @@ public:
action->setEnabled(false);
}
}
}
void updateActions(const Collection::List &selectedCollections,
const Collection::List &selectedFavoriteCollections,
const Item::List &selectedItems)
{
Q_UNUSED(selectedFavoriteCollections);
const bool itemIsSelected = !selectedItems.isEmpty();
const bool collectionIsSelected = !selectedCollections.isEmpty();
updateActionsFromSelectedItems(selectedItems);
bool enableMarkAllAsRead = false;
bool enableMarkAllAsUnread = false;
......@@ -709,6 +714,11 @@ void StandardMailActionManager::setCollectionSelectionModel(QItemSelectionModel
d->updateActions();
}
void StandardMailActionManager::setItems(const Item::List &selectedItems)
{
d->updateActionsFromSelectedItems(selectedItems);
}
void StandardMailActionManager::setItemSelectionModel(QItemSelectionModel *selectionModel)
{
d->mItemSelectionModel = selectionModel;
......
......@@ -192,6 +192,9 @@ public:
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);
void setItems(const Item::List &selectedItems);
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