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
This commit is contained in:
parent
59bf2a52ed
commit
b186f86786
1 changed files with 9 additions and 1 deletions
|
@ -224,9 +224,17 @@ qint64 Manager::scheduledTransitionDuration() const
|
||||||
|
|
||||||
void Manager::initShortcuts()
|
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);
|
QAction *toggleAction = new QAction(this);
|
||||||
toggleAction->setProperty("componentName", QStringLiteral(KWIN_NAME));
|
toggleAction->setProperty("componentName", QStringLiteral(KWIN_NAME));
|
||||||
toggleAction->setObjectName(i18n("Toggle Night Color"));
|
toggleAction->setObjectName(QStringLiteral("Toggle Night Color"));
|
||||||
toggleAction->setText(i18n("Toggle Night Color"));
|
toggleAction->setText(i18n("Toggle Night Color"));
|
||||||
KGlobalAccel::setGlobalShortcut(toggleAction, QList<QKeySequence>());
|
KGlobalAccel::setGlobalShortcut(toggleAction, QList<QKeySequence>());
|
||||||
input()->registerShortcut(QKeySequence(), toggleAction, this, &Manager::toggle);
|
input()->registerShortcut(QKeySequence(), toggleAction, this, &Manager::toggle);
|
||||||
|
|
Loading…
Reference in a new issue