summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2017-03-02 15:27:04 (GMT)
committerKai Uwe Broulik <kde@privat.broulik.de>2017-03-02 15:27:04 (GMT)
commit30b875939abf3e465030680b5e97e80490dfb12d (patch)
treee10228d52312edc243d5aac338374db177438430
parent0accf128d4cd18162e663940bca65b1a47f57314 (diff)
[Folder View] Offer "Empty Trash" also for trash link
So far we offered "Empty Trash" only when Folder View points to trash:/ but on the desktop you have a trash link which didn't have this. Differential Revision: https://phabricator.kde.org/D4886
-rw-r--r--containments/desktop/plugins/folder/foldermodel.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/containments/desktop/plugins/folder/foldermodel.cpp b/containments/desktop/plugins/folder/foldermodel.cpp
index c3a25f4..9fa6887 100644
--- a/containments/desktop/plugins/folder/foldermodel.cpp
+++ b/containments/desktop/plugins/folder/foldermodel.cpp
@@ -1454,8 +1454,19 @@ void FolderModel::openContextMenu()
KConfigGroup cg(globalConfig, "KDE");
bool showDeleteCommand = cg.readEntry("ShowDeleteCommand", false);
- // Don't add the "Move to Trash" action if we're showing the menu for the trash link
- if (!isTrashLink) {
+ // When we're showing the menu for the trash link, offer "Empty Trash" instead
+ // of the "Move to Trash" action.
+ if (isTrashLink) {
+ QAction *emptyTrashAction = m_actionCollection.action(QStringLiteral("emptyTrash"));
+ if (emptyTrashAction) {
+ // We explicitly force the action visible here, as it relies on the KFileItemList
+ // we collected above. In updateActions() we don't have it and since this is always
+ // called before we open the menu, it would correct visibility again when opening
+ // the context menu for other items later.
+ emptyTrashAction->setVisible(true);
+ menu->addAction(emptyTrashAction);
+ }
+ } else {
if (!hasRemoteFiles) {
menu->addAction(m_actionCollection.action(QStringLiteral("trash")));
} else {