From 3e006a0c42769356ea6ee1672692617a13f4710d Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 17 Jun 2021 09:41:05 +0200 Subject: [PATCH] Connect to global shortcut changes The intent behind this code seemingly was that KGlobalAccel would update the shortcut of the QAction but that is not the case. This leads to our config going out of sync when global shortcuts are changed from the oustide (the kcm) and resetting on next start since we set shortcuts with NoAutoLoading. BUG:438662 FIXED-IN:5.84 --- src/plasma/applet.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index c6bb1c43e..c16de9d43 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -744,7 +744,12 @@ void Applet::setGlobalShortcut(const QKeySequence &shortcut) d->activationAction->setText(i18n("Activate %1 Widget", title())); d->activationAction->setObjectName(QStringLiteral("activate widget %1").arg(id())); // NO I18N connect(d->activationAction, &QAction::triggered, this, &Applet::activated); - connect(d->activationAction, SIGNAL(changed()), this, SLOT(globalShortcutChanged())); + connect(KGlobalAccel::self(), &KGlobalAccel::globalShortcutChanged, this, [this](QAction *action, const QKeySequence &shortcut) { + if (action == d->activationAction) { + d->activationAction->setShortcut(shortcut); + d->globalShortcutChanged(); + } + }); } else if (d->activationAction->shortcut() == shortcut) { return; }