Bug 482216

Summary: Hiding .desktop file services from context menu does not work
Product: [Applications] dolphin Reporter: harle-quin
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dolphin-bugs-null, fanzhuyifan
Priority: NOR Keywords: qt6
Version First Reported In: 24.02.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: possible fix (kio)

Description harle-quin 2024-03-02 08:59:47 UTC
Created attachment 166294 [details]
possible fix (kio)

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. install a service .desktop file (into ~/.local/share/kio/servicemenus/)
2. open dolphin settings -> context menu page
3. uncheck previously installed service menu entry

OBSERVED RESULT
the service entry is still present in the context menu for applicable files

EXPECTED RESULT
the service entry should not be shown in the context menu


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
The problem seems to be that Dolphin uses KServiceAction::name() to identify the action in kservicemenurc, but in KIO KDesktopFileAction::name() is used which does not give the same value, but KDesktopFileAction::actionsKey() would.

The attached patch fixes the problem, but I don't know what value is expected in the excludeList. It is not set by Dolphin, but probably the actionsKey is expected as well.

Note that you need to restart Dolphin for the context menu settings changes to take effect.
Comment 1 fanzhuyifan 2024-03-02 19:16:29 UTC
Would you be interested in submitting a merge request? More information can be found at https://community.kde.org/Get_Involved/development

Thanks!
Comment 2 Bug Janitor Service 2024-03-03 07:48:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1569
Comment 3 Alexander Lohnau 2024-03-05 20:33:15 UTC
Git commit a0abd2cfb50411417de045380cdcd971c2ab8fde by Alexander Lohnau, on behalf of Martin Seher.
Committed on 05/03/2024 at 19:22.
Pushed by alex into branch 'master'.

fix hide service menu items in context menu

M  +1    -1    src/widgets/kfileitemactions.cpp

https://invent.kde.org/frameworks/kio/-/commit/a0abd2cfb50411417de045380cdcd971c2ab8fde