From ebc831129a574863942e170df7445a36ba47aff6 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Fri, 25 Sep 2020 14:52:40 +0000 Subject: [PATCH] Use correct way of binding shortcut and setting defaultShortcut setGlobalShortcut sets the default shortcut and binds the current shortcut to the action. It will not overwrite the current shortcut if the user configure a different one. (cherry picked from commit 78ca6af1835be77b575d325e61f770b2b436a01e) --- ksmserver/server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index 501cfbc3f..f9bbc64e9 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -955,22 +955,22 @@ void KSMServer::setupShortcuts() QAction* a; a = actionCollection->addAction(QStringLiteral("Log Out")); a->setText(i18n("Log Out")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::Key_Delete); + KGlobalAccel::self()->setGlobalShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::Key_Delete); connect(a, &QAction::triggered, this, &KSMServer::defaultLogout); a = actionCollection->addAction(QStringLiteral("Log Out Without Confirmation")); a->setText(i18n("Log Out Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete); + KGlobalAccel::self()->setGlobalShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete); connect(a, &QAction::triggered, this, &KSMServer::logoutWithoutConfirmation); a = actionCollection->addAction(QStringLiteral("Halt Without Confirmation")); a->setText(i18n("Halt Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown); + KGlobalAccel::self()->setGlobalShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown); connect(a, &QAction::triggered, this, &KSMServer::haltWithoutConfirmation); a = actionCollection->addAction(QStringLiteral("Reboot Without Confirmation")); a->setText(i18n("Reboot Without Confirmation")); - KGlobalAccel::self()->setShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp); + KGlobalAccel::self()->setGlobalShortcut(a, QList() << Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp); connect(a, &QAction::triggered, this, &KSMServer::rebootWithoutConfirmation); } }