Only remove shortcuts on applet removal not destruction

Applets are destroyed every time we close plasma as well as user
actions.

We only want to remove the shortcut from the registry from when an
applet is actually removed.

The end-user impact was limited as when we restart plasma we re-register
and plasma keeps it's own cache of what the shortcut should be so it
doesn't matter that kglobalaccel lost it's version.

The problem is that it means we send bogus calls to kglobalaccel after
kglobalaccel is potentially closed.

Testing done:
 - set a shortcut on an applet
 - confirmed it still worked after plasma restart
- removed an applet (and closed notificaiton so it wasn't in the
transient state)
- confirmed the entry was gone from system settings and the global
shortcut no-opped.
This commit is contained in:
David Edmundson 2020-12-08 09:50:45 +00:00
parent ec113adffe
commit c920ea86a1

View File

@ -82,10 +82,6 @@ AppletPrivate::AppletPrivate(const KPluginMetaData &info, int uniqueID, Applet *
AppletPrivate::~AppletPrivate()
{
if (activationAction && globalShortcutEnabled) {
//qCDebug(LOG_PLASMA) << "resetting global action for" << q->title() << activationAction->objectName();
KGlobalAccel::self()->removeAllShortcuts(activationAction);
}
if (deleteNotification) {
deleteNotification->close();
@ -215,6 +211,11 @@ void AppletPrivate::cleanUpAndDelete()
resetConfigurationObject();
if (activationAction && globalShortcutEnabled) {
//qCDebug(LOG_PLASMA) << "resetting global action for" << q->title() << activationAction->objectName();
KGlobalAccel::self()->removeAllShortcuts(activationAction);
}
if (q->isContainment()) {
// prematurely emit our destruction if we are a Containment,
// giving Corona a chance to remove this Containment from its collection