Cleanup Dolphin Context Menu and make components reusable
Open, Needs TriagePublic

Description

Currently the dolphin context menu looks a bit cluttered. See this screenshot:

An alternative to solve this would be to allow Dolphin to create QActions in the “Actions” submenu. This is currently not possible. We could achieve this by passing in the “Actions” QMenu or the actions we ant to add to an overload of the int KFileItemActions::addServiceActionsTo(QMenu *mainMenu) and plugin based method. In KF6 we could use a default parameter.

This way we could add actions to the menu from the dolphin side of things and populate it with the service based menus and better organize our actions and actually can reuse existing logic. Like the “open Terminal Here” functionality, which also has a shortcut assigned to it. This would make Dolphin more intuitive and also save us from writing an entire plugin to fix the bug that the “Open Terminal Here” action does not respect the “Default Applications” KCM. Also this change would make it work on windows too.

Also we could create a method which will add both the service+plugin actions(often there methods are called after one another). Once it is possible to add actions to the "Actions" menu we could debate how we can reorganize our menus. For example I feel like the "Compress" menu should really be inside of the "Actions" submenu. And we could implement logic like "if we already have an Actions menu we want to add this plugin to it, if not then in the root menu".

alex created this task.Oct 12 2020, 3:38 PM
alex added a comment.EditedOct 21 2020, 4:07 PM

I am also thinking about making it customizable where an action should be displayed, meaning if it should be in the root or the "Actions" submenu.
See https://www.reddit.com/r/kde/comments/jdxkt9/add_or_reorder_dolphin_service_menu/.

Then the users could customize the menu to their need if smaller things don't add up.

Also I want to throw in that the QActions that dolphin adds can not be disabled, maybe that should be customizable as well? Because the user can't tell a difference between the service based menu and one coming from dolphin.

And to handle the case that there are very few actions we could pass the actions list to the KIO logic and then check if we have less than three in total. If yes we add them all to the top-level menu and otherwise we create the "Actions" submenu.

alex added a subscriber: VDG.Oct 22 2020, 5:50 AM
alex updated the task description. (Show Details)Oct 24 2020, 8:50 PM
alex updated the task description. (Show Details)Nov 6 2020, 6:34 PM

I dunno, being able to totally customize the context menu seems like overkill to me.

Maybe instead we should remove the "Actions" sub-menu entirely, and put all items in the top-level menu. Then that part of the menu is implicitly customizable already because people can add and remove plugins.

The menu is already massive as it is. On my laptop it fills the entire screen height and a good portion of its width, I'd rather see it compacted and streamlined again than put even more items on the top level.

meven added a subscriber: meven.Nov 9 2020, 7:09 PM

I quite like the idea.

I agree with @broulik the number of actions should not make the context menu expand, and we should make users worry about the number of actions they have.
We could add the actions as a top level when there is less than X actions in it (X < 3), to be flexible and stay practical for users who don't need to be concerned about the numbers of actions they have.

We could add the actions as a top level when there is less than X actions in it (X < 3), to be flexible and stay practical for users who don't need to be concerned about the numbers of actions they have.

Isn't that what we already do?

alex moved this task from Backlog to Done on the KF6 board.Apr 19 2021, 2:59 PM