From b186f867861f3613b2c1d3a077f4cf1048aad8e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zi=C4=85bkowski?= Date: Sun, 25 Oct 2020 16:01:31 +0100 Subject: [PATCH] Fixed Toggle Night Color global shortcut, which used i18n in object name, leading to erratic behavior e.g. when system locale or translations changed. BUG: 428024 --- colorcorrection/manager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/colorcorrection/manager.cpp b/colorcorrection/manager.cpp index 8f64fa4d2e..d2c968fd16 100644 --- a/colorcorrection/manager.cpp +++ b/colorcorrection/manager.cpp @@ -224,9 +224,17 @@ qint64 Manager::scheduledTransitionDuration() const void Manager::initShortcuts() { + // legacy shortcut with localized key (to avoid breaking existing config) + if (i18n("Toggle Night Color") != QStringLiteral("Toggle Night Color")) { + QAction toggleActionLegacy; + toggleActionLegacy.setProperty("componentName", QStringLiteral(KWIN_NAME)); + toggleActionLegacy.setObjectName(i18n("Toggle Night Color")); + KGlobalAccel::self()->removeAllShortcuts(&toggleActionLegacy); + } + QAction *toggleAction = new QAction(this); toggleAction->setProperty("componentName", QStringLiteral(KWIN_NAME)); - toggleAction->setObjectName(i18n("Toggle Night Color")); + toggleAction->setObjectName(QStringLiteral("Toggle Night Color")); toggleAction->setText(i18n("Toggle Night Color")); KGlobalAccel::setGlobalShortcut(toggleAction, QList()); input()->registerShortcut(QKeySequence(), toggleAction, this, &Manager::toggle);