kcms/tabbox: Highlight non-default shortcuts

This sets the property on the shortcut widgets when they
should get highlighted: the option is selected in System
Settings and the shortcut is not the default.

It requires a change in `KXMLGui/KKeyShortcutWidget` to
actually paint the highlihgt ring.
(commit 47572c26, KF103)

CCBUG: 459318
This commit is contained in:
Ismael Asensio 2023-01-11 20:44:57 +01:00
parent 73005fcd72
commit b11416c396
3 changed files with 13 additions and 0 deletions

View file

@ -410,6 +410,17 @@ void KWinTabBoxConfigForm::setLayoutNameDefaultIndicatorVisible(bool visible)
setDefaultIndicatorVisible(ui->effectCombo, visible);
}
void KWinTabBoxConfigForm::setShortcutsDefaultIndicatorVisible(bool visible)
{
for (const auto &widget : {ui->scAll, ui->scAllReverse, ui->scCurrent, ui->scCurrentReverse}) {
const QString actionName = widget->property("shortcutAction").toString();
QAction *action = m_actionCollection->action(actionName);
const bool isDefault = (action->shortcut() == m_actionCollection->defaultShortcut(action));
setDefaultIndicatorVisible(widget, visible && !isDefault);
}
}
void KWinTabBoxConfigForm::tabBoxToggled(bool on)
{
// Highlight Windows options is availabled if no TabBox effect is selected

View file

@ -96,6 +96,7 @@ public:
void setShowDesktopModeDefaultIndicatorVisible(bool visible);
void setSwitchingModeDefaultIndicatorVisible(bool visible);
void setLayoutNameDefaultIndicatorVisible(bool visible);
void setShortcutsDefaultIndicatorVisible(bool visible);
Q_SIGNALS:
void filterScreenChanged(int value);

View file

@ -286,6 +286,7 @@ void KWinTabBoxConfig::updateUiDefaultIndicator(bool visible, KWinTabBoxConfigFo
form->setShowDesktopModeDefaultIndicatorVisible(visible && form->showDesktopMode() != config->defaultShowDesktopModeValue());
form->setSwitchingModeDefaultIndicatorVisible(visible && form->switchingMode() != config->defaultSwitchingModeValue());
form->setLayoutNameDefaultIndicatorVisible(visible && form->layoutName() != config->defaultLayoutNameValue());
form->setShortcutsDefaultIndicatorVisible(visible);
}
void KWinTabBoxConfig::load()