D15162: [Folder View] Disable the actions themselves rather than just not adding them to the menu

Kai Uwe Broulik noreply at phabricator.kde.org
Thu Aug 30 10:51:11 BST 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180830/bf5d9a2d/attachment.html>


More information about the Plasma-devel mailing list