Bug 385463

Summary: favourite system actions are no longer removable via right click menu - breaks/prevents sidebar hiding
Product: [Plasma] plasmashell Reporter: Rik Mills <rikmills>
Component: Application Menu (Kicker) widgetAssignee: Eike Hein <hein>
Status: RESOLVED FIXED    
Severity: normal CC: fabian, plasma-bugs
Priority: NOR    
Version: 5.11.0   
Target Milestone: 1.0   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: PoC that fixes the API mismatch

Description Rik Mills 2017-10-07 11:11:28 UTC
Since at least the 5.11 beta, and probably since:

https://cgit.kde.org/plasma-desktop.git/commit/?h=Plasma/5.11&id=4ba9b01e2d6acc361f4ac0c7e4c21066eb575146

it is no longer possible to right click the 'favourite system actions' in kicker and remove them. Normal favourites are still removable.

The error output to console is:

/usr/share/plasma/plasmoids/org.kde.plasma.kicker/contents/code/tools.js:47: TypeError: Cannot read property 'runningActivities' of undefined

Hence the advertised feature in the draft plasma 5.11 announcement

"The Kicker application launcher now hides its sidebar if no favorites are present, leading to a cleaner look."

simply cannot be activated, as it is not possible to removal both types of favourites from the sidebar via the GUI.
Comment 1 Fabian Vogt 2017-10-07 11:14:13 UTC
Created attachment 108220 [details]
PoC that fixes the API mismatch

The reason for this bug is that tools.js does not support SimpleFavoritesModel anymore.

I attached a patch that changes KAStatsFavoritesModel to be a superset of SimpleFavoritesModel and adjusts tools.js to use the SimpleFavoritesModel API if necessary.
Comment 2 Rik Mills 2017-10-08 07:02:21 UTC
Update proposed revision from Fabian Vogt here I believe 

https://phabricator.kde.org/D8178
Comment 3 Fabian Vogt 2017-10-10 16:53:22 UTC
Git commit 06f01ed291ca21057497fd0ceaa69f6e4d324bc3 by Fabian Vogt.
Committed on 10/10/2017 at 16:53.
Pushed by fvogt into branch 'Plasma/5.11'.

Fix editing items in SimpleFavoritesModel

Summary:
tools.js is supposed to support both KaStatsFavoritesModel (used for
favorite applications) and SimpleFavoritesModel (used for system actions,
like poweroff/reboot/logout). The latter did not work though, as tools.js
unconditionally calls methods only present in KaStatsFavoritesModel.
This commit makes KaStatsFavoritesModel API compatible to SimpleFavoritesModel
and changes the relevant code in tools.js to support both.

Additionally, this syncs applets/kickoff/package/contents/code/tools.js again.

Test Plan:
Before this patch it wasn't possible to remove system actions from
the favorites bar.

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: hein, davidedmundson, rikmills, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8178

M  +6    -6    applets/kicker/package/contents/code/tools.js
M  +2    -2    applets/kicker/plugin/kastatsfavoritesmodel.cpp
M  +13   -11   applets/kickoff/package/contents/code/tools.js

https://commits.kde.org/plasma-desktop/06f01ed291ca21057497fd0ceaa69f6e4d324bc3