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

Fix update "move all to trash" action.

Bug found by Allen
parent db0a735e
Pipeline #103795 passed with stage
in 7 minutes and 53 seconds
......@@ -3890,10 +3890,7 @@ void KMMainWidget::slotAkonadiStandardActionUpdated()
&& folderWithContent);
}
if (QAction *act = mAkonadiStandardActionManager->action(Akonadi::StandardMailActionManager::MoveAllToTrash)) {
act->setEnabled(folderWithContent && (mCurrentFolderSettings->count() > 0) && mCurrentFolderSettings->canDeleteMessages());
act->setText((mCurrentFolderSettings && CommonKernel->folderIsTrash(mCurrentCollection)) ? i18n("E&mpty Trash") : i18n("&Move All Messages to Trash"));
}
updateMoveAllToTrash();
QList<QAction *> addToFavorite;
QAction *actionAddToFavoriteCollections = akonadiStandardAction(Akonadi::StandardActionManager::AddToFavoriteCollections);
......@@ -3992,6 +3989,8 @@ void KMMainWidget::updateFolderMenu()
const bool isInTrashFolder = (mCurrentFolderSettings && CommonKernel->folderIsTrash(mCurrentCollection));
QAction *moveToTrash = akonadiStandardAction(Akonadi::StandardMailActionManager::MoveToTrash);
updateMoveAllToTrash();
KMail::Util::setActionTrashOrDelete(moveToTrash, isInTrashFolder);
mTrashThreadAction->setIcon(isInTrashFolder ? QIcon::fromTheme(QStringLiteral("edit-delete-shred")) : QIcon::fromTheme(QStringLiteral("edit-delete")));
......@@ -4040,6 +4039,15 @@ void KMMainWidget::updateFolderMenu()
}
}
void KMMainWidget::updateMoveAllToTrash()
{
if (QAction *act = mAkonadiStandardActionManager->action(Akonadi::StandardMailActionManager::MoveAllToTrash)) {
const bool folderWithContent = mCurrentFolderSettings && !mCurrentFolderSettings->isStructural();
act->setEnabled(folderWithContent && (mCurrentFolderSettings->count() > 0) && mCurrentFolderSettings->canDeleteMessages());
act->setText((mCurrentFolderSettings && CommonKernel->folderIsTrash(mCurrentCollection)) ? i18n("E&mpty Trash") : i18n("&Move All Messages to Trash"));
}
}
//-----------------------------------------------------------------------------
void KMMainWidget::slotIntro()
{
......
......@@ -532,6 +532,7 @@ private:
void slotHistorySwitchFolder(const Akonadi::Collection &collection);
void redoSwitchFolder();
void undoSwitchFolder();
void updateMoveAllToTrash();
// Message actions
QAction *mDeleteAction = nullptr;
......
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