broulik created this revision. broulik added reviewers: Plasma, davidedmundson, hein. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. broulik requested review of this revision.
REVISION SUMMARY Folder View is built on the assumption that actions can only be triggered from the context menu. This isn't true as keyboard shortcuts can trigger actions which will only get their correct state just before the menu opens. Moreover, often the action itself isn't disabled/hidden but just not added to the menu, which means it can still be triggered using a keyboard shortcut. This patch changes the context menu to always include all (most of them, anyway) actions but instead have `updateActions()` disable or hide them as needed. Also, take into account `KFileItemListProperties` for more actions (e.g. Cut, Paste, Rename, Trash, …) like Dolphin does it. TEST PLAN This change is a bit delicate as there's quite a few states to be in: remote files selected, a file inside trash, trash itself, link to trash on the desktop, readonly directory, etc - Made my desktop folder read-only (requires D15161 <https://phabricator.kde.org/D15161> to work properly) - Paste, Cut, Rename options were disabled, Trash option was hidden - In trash:/ "Delete" and "Empty Trash" showed up fine - Some options that make no sense for trash (Rename, "Create New") are hidden, like in Dolphin - F2 still unconditionally allows renaming but that is because QML doesn't check Together with D15160 <https://phabricator.kde.org/D15160> this allows locking down the desktop for the user when you make the desktop folder read-only REPOSITORY R119 Plasma Desktop REVISION DETAIL https://phabricator.kde.org/D15162 AFFECTED FILES containments/desktop/plugins/folder/foldermodel.cpp To: broulik, #plasma, davidedmundson, hein Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart