Skip to content

[KFilePlacesView] Prepare for reunion with Dolphin

Kai Uwe Broulik requested to merge work/kbroulik/kfileplaces-refactoredmenu into master

This adds all the features needed for Dolphin to be able to use KFilePlacesView again for its places panel, dropping the fork, notably:

  • Refactor context menu code to be more linear and hopefully easier to follow
    • Make it similar to what the menu in Dolphin looks like and behaves
    • Add ability to add menu items at the top (e.g. "open in new window") and bottom (e.g. "unlock panels")
  • Add signals for item activation
    • which wait for storage setup, which then normal clicked signal does not
  • Add middle-click support (for opening in new tab)
  • Allow overriding teardown behavior
    • so that Dolphin can e.g. cd $HOME in places panel
  • Add getters and change signal for hidden items shown
  • Allow storing and retrieving the icon size so that the user's setting isn't lost in the port

The context menu is made more streamlined by putting actions like Mount/Unmount/Eject/Empty Trash always at the top and providing view actions (e.g. icon size) only on empty areas and group headers.

There was a concern of adding view actions (e.g. icon size) only on empty areas as in file dialog there's usually not much room at the bottom but we nowadays have section headers which you could also right-click to get the same actions.

The order of menu items is now always:

Empty Trash
Eject
Mount
Unmount
Teardown
---
Open in New Tab
Open in New Window
<High Priority Actions, e.g. "Configure trash">
Properties
---
Add...
Edit...
Remove
Hide
Hide Section
Show Hidden Items
Icon Size >
---
<Low Priority Actions, e.g. "Unlock panels">

with items being shown as needed, e.g. "Emptry Trash" only for trash, "Eject" only on CD drives, "Mount" on unmounted drives, "Open in New Tab" only if the signal is connected, "Properties" for local files/folders, "Show Hidden Items" if there are, etc. (I wanted to keep the shuffling of the menu separate but it was too hard to keep this diff cleanly separated, sorry)

@dfaure @ahmadsamir @meven @nicolasfella @alex @elvisangelaccio

Edited by Kai Uwe Broulik

Merge request reports