KCM KWinTabbox on defaultsIndicatorsVisibleChanged do not update unmanagedWidgetDefaultState

BUG: 419014
This commit is contained in:
Cyril Rossi 2020-10-14 17:59:29 +02:00
parent 18af4032e4
commit c17914bc66
2 changed files with 26 additions and 13 deletions

View file

@ -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();

View file

@ -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;