diff --git a/src/kcmkwin/kwintabbox/main.cpp b/src/kcmkwin/kwintabbox/main.cpp index 13e9410868..2cb147eac2 100644 --- a/src/kcmkwin/kwintabbox/main.cpp +++ b/src/kcmkwin/kwintabbox/main.cpp @@ -81,12 +81,12 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args) addConfig(m_data->tabBoxConfig(), m_primaryTabBoxUi); addConfig(m_data->tabBoxAlternativeConfig(), m_alternativeTabBoxUi); - connect(this, &KWinTabBoxConfig::defaultsIndicatorsVisibleChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + initLayoutLists(); + + connect(this, &KWinTabBoxConfig::defaultsIndicatorsVisibleChanged, this, &KWinTabBoxConfig::updateDefaultIndicator); createConnections(m_primaryTabBoxUi); createConnections(m_alternativeTabBoxUi); - initLayoutLists(); - // check focus policy - we don't offer configs for unreasonable focus policies KConfigGroup config(m_config, "Windows"); QString policy = config.readEntry("FocusPolicy", "ClickToFocus"); @@ -240,6 +240,15 @@ void KWinTabBoxConfig::updateUnmanagedState() isDefault &= updateUnmanagedIsDefault(m_alternativeTabBoxUi, m_data->tabBoxAlternativeConfig()); unmanagedWidgetDefaultState(isDefault); + + updateDefaultIndicator(); +} + +void KWinTabBoxConfig::updateDefaultIndicator() +{ + const bool visible = defaultsIndicatorsVisible(); + updateUiDefaultIndicator(visible, m_primaryTabBoxUi, m_data->tabBoxConfig()); + updateUiDefaultIndicator(visible, m_alternativeTabBoxUi, m_data->tabBoxAlternativeConfig()); } bool KWinTabBoxConfig::updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *form, const TabBoxSettings *config) @@ -259,16 +268,6 @@ bool KWinTabBoxConfig::updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *for bool KWinTabBoxConfig::updateUnmanagedIsDefault(KWinTabBoxConfigForm *form, const TabBoxSettings *config) { - const bool visible = defaultsIndicatorsVisible(); - form->setFilterScreenDefaultIndicatorVisible(visible && form->filterScreen() != config->defaultMultiScreenModeValue()); - form->setFilterDesktopDefaultIndicatorVisible(visible && form->filterDesktop() != config->defaultDesktopModeValue()); - form->setFilterActivitiesDefaultIndicatorVisible(visible && form->filterActivities() != config->defaultActivitiesModeValue()); - form->setFilterMinimizationDefaultIndicatorVisible(visible && form->filterMinimization() != config->defaultMinimizedModeValue()); - form->setApplicationModeDefaultIndicatorVisible(visible && form->applicationMode() != config->defaultApplicationsModeValue()); - form->setShowDesktopModeDefaultIndicatorVisible(visible && form->showDesktopMode() != config->defaultShowDesktopModeValue()); - form->setSwitchingModeDefaultIndicatorVisible(visible && form->switchingMode() != config->defaultSwitchingModeValue()); - form->setLayoutNameDefaultIndicatorVisible(visible && form->layoutName() != config->defaultLayoutNameValue()); - bool isDefault = true; isDefault &= form->filterScreen() == config->defaultMultiScreenModeValue(); isDefault &= form->filterDesktop() == config->defaultDesktopModeValue(); @@ -282,6 +281,18 @@ bool KWinTabBoxConfig::updateUnmanagedIsDefault(KWinTabBoxConfigForm *form, cons return isDefault; } +void KWinTabBoxConfig::updateUiDefaultIndicator(bool visible, KWinTabBoxConfigForm *form, const TabBoxSettings *config) +{ + form->setFilterScreenDefaultIndicatorVisible(visible && form->filterScreen() != config->defaultMultiScreenModeValue()); + form->setFilterDesktopDefaultIndicatorVisible(visible && form->filterDesktop() != config->defaultDesktopModeValue()); + form->setFilterActivitiesDefaultIndicatorVisible(visible && form->filterActivities() != config->defaultActivitiesModeValue()); + form->setFilterMinimizationDefaultIndicatorVisible(visible && form->filterMinimization() != config->defaultMinimizedModeValue()); + form->setApplicationModeDefaultIndicatorVisible(visible && form->applicationMode() != config->defaultApplicationsModeValue()); + form->setShowDesktopModeDefaultIndicatorVisible(visible && form->showDesktopMode() != config->defaultShowDesktopModeValue()); + form->setSwitchingModeDefaultIndicatorVisible(visible && form->switchingMode() != config->defaultSwitchingModeValue()); + form->setLayoutNameDefaultIndicatorVisible(visible && form->layoutName() != config->defaultLayoutNameValue()); +} + void KWinTabBoxConfig::load() { KCModule::load(); diff --git a/src/kcmkwin/kwintabbox/main.h b/src/kcmkwin/kwintabbox/main.h index 0a2bc319f1..0a5de9ea65 100644 --- a/src/kcmkwin/kwintabbox/main.h +++ b/src/kcmkwin/kwintabbox/main.h @@ -41,6 +41,7 @@ public Q_SLOTS: private Q_SLOTS: void updateUnmanagedState(); + void updateDefaultIndicator(); void configureEffectClicked(); void slotGHNS(); @@ -53,6 +54,7 @@ private: void createConnections(KWinTabBoxConfigForm *form); bool updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config); bool updateUnmanagedIsDefault(KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config); + void updateUiDefaultIndicator(bool visible, KWinTabBoxConfigForm *form, const TabBox::TabBoxSettings *config); private: KWinTabBoxConfigForm *m_primaryTabBoxUi = nullptr;