kcms/options: port to KCModule methods
Remove code that duplicates functionality of KCModule. Previously the various config items were not fully ported to using KCModule methods, and kept custom versions of isSaveNeeded and isDefault. When called from KWinOptions::updateUnmanagedState, these methods incorrectly reports that there are still changes to be saved. This patch set ports all configs in window behavior to methods provided by KCModule, solving the problem. BUG: 477940
This commit is contained in:
parent
3353ed87ef
commit
faab23e914
5 changed files with 14 additions and 80 deletions
|
@ -144,21 +144,21 @@ void KWinOptions::defaults()
|
||||||
|
|
||||||
void KWinOptions::updateUnmanagedState()
|
void KWinOptions::updateUnmanagedState()
|
||||||
{
|
{
|
||||||
bool isNeedSave = false;
|
bool changed = false;
|
||||||
isNeedSave |= mFocus->isSaveNeeded();
|
changed |= mFocus->needsSave();
|
||||||
isNeedSave |= mTitleBarActions->isSaveNeeded();
|
changed |= mTitleBarActions->needsSave();
|
||||||
isNeedSave |= mWindowActions->isSaveNeeded();
|
changed |= mWindowActions->needsSave();
|
||||||
isNeedSave |= mMoving->isSaveNeeded();
|
changed |= mMoving->needsSave();
|
||||||
isNeedSave |= mAdvanced->isSaveNeeded();
|
changed |= mAdvanced->needsSave();
|
||||||
|
|
||||||
unmanagedWidgetChangeState(isNeedSave);
|
unmanagedWidgetChangeState(changed);
|
||||||
|
|
||||||
bool isDefault = true;
|
bool isDefault = true;
|
||||||
isDefault &= mFocus->isDefaults();
|
isDefault &= mFocus->representsDefaults();
|
||||||
isDefault &= mTitleBarActions->isDefaults();
|
isDefault &= mTitleBarActions->representsDefaults();
|
||||||
isDefault &= mWindowActions->isDefaults();
|
isDefault &= mWindowActions->representsDefaults();
|
||||||
isDefault &= mMoving->isDefaults();
|
isDefault &= mMoving->representsDefaults();
|
||||||
isDefault &= mAdvanced->isDefaults();
|
isDefault &= mAdvanced->representsDefaults();
|
||||||
|
|
||||||
unmanagedWidgetDefaultState(isDefault);
|
unmanagedWidgetDefaultState(isDefault);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,16 +50,6 @@ void KTitleBarActionsConfig::save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KTitleBarActionsConfig::isDefaults() const
|
|
||||||
{
|
|
||||||
return managedWidgetDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KTitleBarActionsConfig::isSaveNeeded() const
|
|
||||||
{
|
|
||||||
return managedWidgetChangeState();
|
|
||||||
}
|
|
||||||
|
|
||||||
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
|
||||||
: KCModule(parent, KPluginMetaData())
|
: KCModule(parent, KPluginMetaData())
|
||||||
, standAlone(_standAlone)
|
, standAlone(_standAlone)
|
||||||
|
@ -88,14 +78,4 @@ void KWindowActionsConfig::save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KWindowActionsConfig::isDefaults() const
|
|
||||||
{
|
|
||||||
return managedWidgetDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KWindowActionsConfig::isSaveNeeded() const
|
|
||||||
{
|
|
||||||
return managedWidgetChangeState();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_mouse.cpp"
|
#include "moc_mouse.cpp"
|
||||||
|
|
|
@ -44,9 +44,6 @@ public:
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
|
|
||||||
bool isDefaults() const;
|
|
||||||
bool isSaveNeeded() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(KWinOptionsSettings *settings);
|
void initialize(KWinOptionsSettings *settings);
|
||||||
|
|
||||||
|
|
|
@ -142,11 +142,9 @@ void KFocusConfig::focusPolicyChanged()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_unmanagedChangeState = m_settings->focusPolicy() != selectedFocusPolicy || loadedNextFocusPrefersMouseItem != selectedNextFocusPrefersMouseItem;
|
unmanagedWidgetChangeState(m_settings->focusPolicy() != selectedFocusPolicy || loadedNextFocusPrefersMouseItem != selectedNextFocusPrefersMouseItem);
|
||||||
unmanagedWidgetChangeState(m_unmanagedChangeState);
|
|
||||||
|
|
||||||
m_unmanagedDefaultState = focusPolicy == defaultFocusPolicyIndex;
|
unmanagedWidgetDefaultState(focusPolicy == defaultFocusPolicyIndex);
|
||||||
unmanagedWidgetDefaultState(m_unmanagedDefaultState);
|
|
||||||
|
|
||||||
// the auto raise related widgets are: autoRaise
|
// the auto raise related widgets are: autoRaise
|
||||||
m_ui->kcfg_AutoRaise->setEnabled(focusPolicy != CLICK_TO_FOCUS && focusPolicy != CLICK_TO_FOCUS_MOUSE_PRECEDENT);
|
m_ui->kcfg_AutoRaise->setEnabled(focusPolicy != CLICK_TO_FOCUS && focusPolicy != CLICK_TO_FOCUS_MOUSE_PRECEDENT);
|
||||||
|
@ -224,16 +222,6 @@ void KFocusConfig::defaults()
|
||||||
m_ui->windowFocusPolicy->setCurrentIndex(defaultFocusPolicyIndex);
|
m_ui->windowFocusPolicy->setCurrentIndex(defaultFocusPolicyIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KFocusConfig::isDefaults() const
|
|
||||||
{
|
|
||||||
return managedWidgetDefaultState() && m_unmanagedDefaultState;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KFocusConfig::isSaveNeeded() const
|
|
||||||
{
|
|
||||||
return managedWidgetChangeState() || m_unmanagedChangeState;
|
|
||||||
}
|
|
||||||
|
|
||||||
KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget *parent)
|
KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -286,16 +274,6 @@ void KAdvancedConfig::save(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KAdvancedConfig::isDefaults() const
|
|
||||||
{
|
|
||||||
return managedWidgetDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KAdvancedConfig::isSaveNeeded() const
|
|
||||||
{
|
|
||||||
return managedWidgetChangeState();
|
|
||||||
}
|
|
||||||
|
|
||||||
KWinMovingConfigForm::KWinMovingConfigForm(QWidget *parent)
|
KWinMovingConfigForm::KWinMovingConfigForm(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -330,14 +308,4 @@ void KMovingConfig::save(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KMovingConfig::isDefaults() const
|
|
||||||
{
|
|
||||||
return managedWidgetDefaultState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KMovingConfig::isSaveNeeded() const
|
|
||||||
{
|
|
||||||
return managedWidgetChangeState();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_windows.cpp"
|
#include "moc_windows.cpp"
|
||||||
|
|
|
@ -64,9 +64,6 @@ public:
|
||||||
void save() override;
|
void save() override;
|
||||||
void defaults() override;
|
void defaults() override;
|
||||||
|
|
||||||
bool isDefaults() const;
|
|
||||||
bool isSaveNeeded() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(KWinOptionsSettings *settings);
|
void initialize(KWinOptionsSettings *settings);
|
||||||
|
|
||||||
|
@ -77,8 +74,6 @@ private Q_SLOTS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool standAlone;
|
bool standAlone;
|
||||||
bool m_unmanagedChangeState = false;
|
|
||||||
bool m_unmanagedDefaultState = true;
|
|
||||||
|
|
||||||
KWinFocusConfigForm *m_ui;
|
KWinFocusConfigForm *m_ui;
|
||||||
KWinOptionsSettings *m_settings;
|
KWinOptionsSettings *m_settings;
|
||||||
|
@ -94,9 +89,6 @@ public:
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
|
|
||||||
bool isDefaults() const;
|
|
||||||
bool isSaveNeeded() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(KWinOptionsSettings *settings);
|
void initialize(KWinOptionsSettings *settings);
|
||||||
|
|
||||||
|
@ -114,9 +106,6 @@ public:
|
||||||
|
|
||||||
void save() override;
|
void save() override;
|
||||||
|
|
||||||
bool isDefaults() const;
|
|
||||||
bool isSaveNeeded() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initialize(KWinOptionsSettings *settings, KWinOptionsKDEGlobalsSettings *globalSettings);
|
void initialize(KWinOptionsSettings *settings, KWinOptionsKDEGlobalsSettings *globalSettings);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue