Commit 32a6105e authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Disable 'Delete Collections' action for system folders

Do not allow to delete system folders (e.g. inbox, sent-mail, outbox)
by disabling the actions.

BUG: 262484

svn path=/trunk/KDE/kdepimlibs/; revision=1213472
(cherry picked from commit 2fbc331b)
parent 3fd56352
......@@ -27,6 +27,7 @@
#include "markascommand_p.h"
#include "movetotrashcommand_p.h"
#include "removeduplicatescommand_p.h"
#include "specialmailcollections.h"
#include "akonadi/agentfilterproxymodel.h"
#include "akonadi/agentinstance.h"
......@@ -309,6 +310,19 @@ class StandardMailActionManager::Private
const Akonadi::CollectionStatistics stats = collection.statistics();
enableMarkAllAsRead = (stats.unreadCount() > 0);
enableMarkAllAsUnread = (stats.count() != stats.unreadCount());
const bool isSystemFolder = (collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Inbox ) ||
collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox ) ||
collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::SentMail ) ||
collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Trash ) ||
collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Drafts ) ||
collection == SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Templates ));
if ( isSystemFolder ) {
if ( mGenericManager->action( StandardActionManager::DeleteCollections ) ) {
mGenericManager->action( StandardActionManager::DeleteCollections )->setEnabled( false );
}
}
}
}
......
Supports Markdown
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