Created attachment 156516 [details] Context sub-menu with and without horizontal lines in Dolphin 19.12.3 and 21.12.3 For as long as I can remember, a personalized service sub-menu in Dolphin could contain horizontal lines to separate items. To do so, you had to add _SEPARATOR_ in the semicolon separated action list of your service file, for example Actions=action_a;action_b;_SEPARATOR_;action_c;action_d;_SEPARATOR_;action_e; This feature disappeared between Dolphin 19.12.3 (Kubuntu 20.04) and Dolphin 21.12.3 (Kubuntu 22.04). The code above does not produce lines/bars anymore (see attachment). I was not able to pinpoint the exact release that came with the regression. These horizontal lines are very handy and quite frankly irreplaceable when it comes to add visual clarity to custom sub-menus, especially long ones. My guess is that this is not a conscious design choice but rather a side-effect of some code optimization. That's why I'm reporting this as minor bug. I would love to see them back and I suspect others would too.
It seems that actions now get sorted by the action ID. Because you have to specify the separator as _SEPARATOR_, it begins with an underscore, which comes after all the uppers letters in ASCII order, but before the lowercase letters. I think KDE then ignores any separators that appear at the start or end of the menu. If you only need a single separator, you can ID your actions like this, which will fix the issue (note the uppercase `A` in the IDs of the actions before the separator)... Actions=Action_a;Action_b;_SEPARATOR_;action_c;action_d;action_e; Unfortunately, you cannot have multiple separators, as they will all get ordered into the same position. I'm not sure why KDE is now ordering the actions by action ID, it seems very strange. The actions used to appear in the order they appeared in the action list. Ordering by action ID is completely arbitrary. If you are trying to make the menus more usable by putting stuff in alphabetical order, you should be ordering by the "Name" parameter, not the ID. The ID does not take any localization into account, and anyway, you may not want stuff in alphabetical order anyway.
Thank a lot for these clarifications. You're perfectly right. I've noticed the new alphabetical sorting too, but failed to make the connection. Having one separator is better than none (thanks for that trick too), but I'm still hoping Dolphin will let us organize sub-menus with multiple separators again.
In Dolphin 24.02.1 this behavior is worst because service menu is ordered using name instead of action name.
Created attachment 168265 [details] Before fix
Created attachment 168266 [details] After fix
Fix proposal: https://invent.kde.org/frameworks/kio/-/merge_requests/1608 Commit 33785332 has purposely ordered actions by their name. However, this break separators in service context menus. For example: Actions=progressive;optimize;SEPARATOR;compress_50;compress_70;compress_75 The separator would end up at the end of the list: Actions=compress_50;compress_70;compress_75;progressive|optimize;SEPARATOR And since the logic check is the separator is the last item to add it: !actions.last()->isSeparator() separators basically disappear from service context menus. The purpose of this commit is then to create groups of actions between each separator. Actions will be sorted withing these groups, but it will keep service menus original organisation.
Thanks a lot, Monsieur Mauchin! I hope your fix can find its way to master and to us soon.
(In reply to Robert-André Mauchin from comment #6) > Fix proposal: > > https://invent.kde.org/frameworks/kio/-/merge_requests/1608 > > > Commit 33785332 has purposely ordered actions by their name. However, this > break separators in service context menus. > > For example: > > Actions=progressive;optimize;SEPARATOR;compress_50;compress_70;compress_75 > > The separator would end up at the end of the list: > > Actions=compress_50;compress_70;compress_75;progressive|optimize;SEPARATOR > > And since the logic check is the separator is the last item to add it: > > !actions.last()->isSeparator() > > separators basically disappear from service context menus. > > The purpose of this commit is then to create groups of actions between each > separator. Actions will be sorted withing these groups, but it will keep > service menus original organisation. I don't understand the main reason for 33785332 commit, previous behavior, the sort is the one in Actions property, seems the right one behavior for me.
Git commit b154c9d2f4fc86e6efdcf50bd11bba1f4a365033 by Alexander Lohnau, on behalf of Robert-André Mauchin. Committed on 27/04/2024 at 15:24. Pushed by alex into branch 'master'. KFileItemActions: Add logic to order actions between separators Commit 337853329c61c9cfe5e369acf65a8eca94e5e7fd has purposedly ordered actions by their name. However, this breaks separators in service context menus. For example: Actions=progressive;optimize;\_SEPARATOR\_;compress_50;compress_70;compress_75 The separator would end up at the end of the list: Actions=compress_50;compress_70;compress_75;progressive|optimize;\_SEPARATOR\_ And since the logic check if the separator is the last item to add it: !actions.last()->isSeparator() separators basically disappear from service context menus. The purpose of this commit is then to create groups of actions between each separator. Actions will be sorted within these groups, but it will keep service menus original order. M +47 -18 src/widgets/kfileitemactions.cpp https://invent.kde.org/frameworks/kio/-/commit/b154c9d2f4fc86e6efdcf50bd11bba1f4a365033
Thank you so much to Robert-André Mauchin for it's fix