Bug 424230

Summary: Plasma Widget installed from KDE Store is not listed in system tray settings until Plasma is restarted
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: System TrayAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, materka, nate
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.21.0
Sentry Crash Report:

Description Patrick Silva 2020-07-15 11:52:28 UTC
STEPS TO REPRODUCE
1. install Weather Widget or Redshift Control widgets from KDE Store
https://store.kde.org/p/998917/
https://store.kde.org/p/998916/
2. open system tray settings, click on "Entries" section: the just installed widget is not listed
3. restart Plasma by pressing alt+space and running "plasmashell --replace"
4. reopen system tray settings, "Entries" section: now the widget installed in the step 1 is listed

EXPECTED RESULT
a widget from KDE Store should be listed in system tray settings immediately
after it to be installed

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0
Qt Version: 5.14.2
Comment 1 David Edmundson 2020-07-15 12:16:42 UTC
Potentially we can do something like

shell/containmentconfigview.cpp

      QDBusConnection::sessionBus().connect(QString(), QStringLiteral("/KPackage/Plasma/Wallpaper"), QStringLiteral("org.kde.plasma.kpackage"), QStringLiteral("packageInstalled"),

(but with applets instead of wallpapers obviously)  to watch changes


It's that or just rebuild the model anew everytime the config is opened,
Comment 2 Nate Graham 2020-07-16 03:47:10 UTC
Watching for changes makes sense to me, but what do you think, Konrad?
Comment 3 Konrad Materka 2020-07-16 18:00:19 UTC
(In reply to Nate Graham from comment #2)
> Watching for changes makes sense to me, but what do you think, Konrad?

Good idea, I didn't know there is such signal! :) IT should also listen on package uninstall, so that we can immediately remove applet (I think there is a separate bug for this).

It requires some refactoring in systemtray.cpp, not only in model - applet can be "DBus-able" (m_dbusActivatableTasks) or enabled by default (m_defaultPlasmoids).
Comment 4 Bug Janitor Service 2020-09-27 20:16:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/297
Comment 5 Konrad Materka 2020-10-08 17:40:19 UTC
Git commit 371e91b93209206cee3a7146a35b090569e3fd24 by Konrad Materka.
Committed on 08/10/2020 at 17:00.
Pushed by kmaterka into branch 'master'.

[applets/systemtray] Refactor systemtray

Major refactoring of SystemTray logic, mainly around Applets/Plasmoids
lifecycle. It is now more event based.
FIXED-IN: 5.21.0

M  +3    -0    applets/systemtray/CMakeLists.txt
M  +7    -2    applets/systemtray/autotests/CMakeLists.txt
M  +76   -15   applets/systemtray/autotests/systemtraymodeltest.cpp
A  +188  -0    applets/systemtray/dbusserviceobserver.cpp     [License: GPL (v2+)]
A  +70   -0    applets/systemtray/dbusserviceobserver.h     [License: GPL (v2+)]
M  +0    -8    applets/systemtray/package/contents/ui/main.qml
A  +171  -0    applets/systemtray/plasmoidregistry.cpp     [License: GPL (v2+)]
A  +95   -0    applets/systemtray/plasmoidregistry.h     [License: GPL (v2+)]
M  +98   -339  applets/systemtray/systemtray.cpp
M  +17   -33   applets/systemtray/systemtray.h
M  +33   -23   applets/systemtray/systemtraymodel.cpp
M  +32   -11   applets/systemtray/systemtraymodel.h
A  +177  -0    applets/systemtray/systemtraysettings.cpp     [License: GPL (v2+)]
A  +70   -0    applets/systemtray/systemtraysettings.h     [License: GPL (v2+)]

https://invent.kde.org/plasma/plasma-workspace/commit/371e91b93209206cee3a7146a35b090569e3fd24