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()
|
||||
{
|
||||
bool isNeedSave = false;
|
||||
isNeedSave |= mFocus->isSaveNeeded();
|
||||
isNeedSave |= mTitleBarActions->isSaveNeeded();
|
||||
isNeedSave |= mWindowActions->isSaveNeeded();
|
||||
isNeedSave |= mMoving->isSaveNeeded();
|
||||
isNeedSave |= mAdvanced->isSaveNeeded();
|
||||
bool changed = false;
|
||||
changed |= mFocus->needsSave();
|
||||
changed |= mTitleBarActions->needsSave();
|
||||
changed |= mWindowActions->needsSave();
|
||||
changed |= mMoving->needsSave();
|
||||
changed |= mAdvanced->needsSave();
|
||||
|
||||
unmanagedWidgetChangeState(isNeedSave);
|
||||
unmanagedWidgetChangeState(changed);
|
||||
|
||||
bool isDefault = true;
|
||||
isDefault &= mFocus->isDefaults();
|
||||
isDefault &= mTitleBarActions->isDefaults();
|
||||
isDefault &= mWindowActions->isDefaults();
|
||||
isDefault &= mMoving->isDefaults();
|
||||
isDefault &= mAdvanced->isDefaults();
|
||||
isDefault &= mFocus->representsDefaults();
|
||||
isDefault &= mTitleBarActions->representsDefaults();
|
||||
isDefault &= mWindowActions->representsDefaults();
|
||||
isDefault &= mMoving->representsDefaults();
|
||||
isDefault &= mAdvanced->representsDefaults();
|
||||
|
||||
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)
|
||||
: KCModule(parent, KPluginMetaData())
|
||||
, 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"
|
||||
|
|
|
@ -44,9 +44,6 @@ public:
|
|||
|
||||
void save() override;
|
||||
|
||||
bool isDefaults() const;
|
||||
bool isSaveNeeded() const;
|
||||
|
||||
protected:
|
||||
void initialize(KWinOptionsSettings *settings);
|
||||
|
||||
|
|
|
@ -142,11 +142,9 @@ void KFocusConfig::focusPolicyChanged()
|
|||
break;
|
||||
}
|
||||
|
||||
m_unmanagedChangeState = m_settings->focusPolicy() != selectedFocusPolicy || loadedNextFocusPrefersMouseItem != selectedNextFocusPrefersMouseItem;
|
||||
unmanagedWidgetChangeState(m_unmanagedChangeState);
|
||||
unmanagedWidgetChangeState(m_settings->focusPolicy() != selectedFocusPolicy || loadedNextFocusPrefersMouseItem != selectedNextFocusPrefersMouseItem);
|
||||
|
||||
m_unmanagedDefaultState = focusPolicy == defaultFocusPolicyIndex;
|
||||
unmanagedWidgetDefaultState(m_unmanagedDefaultState);
|
||||
unmanagedWidgetDefaultState(focusPolicy == defaultFocusPolicyIndex);
|
||||
|
||||
// the auto raise related widgets are: autoRaise
|
||||
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);
|
||||
}
|
||||
|
||||
bool KFocusConfig::isDefaults() const
|
||||
{
|
||||
return managedWidgetDefaultState() && m_unmanagedDefaultState;
|
||||
}
|
||||
|
||||
bool KFocusConfig::isSaveNeeded() const
|
||||
{
|
||||
return managedWidgetChangeState() || m_unmanagedChangeState;
|
||||
}
|
||||
|
||||
KWinAdvancedConfigForm::KWinAdvancedConfigForm(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)
|
||||
: 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"
|
||||
|
|
|
@ -64,9 +64,6 @@ public:
|
|||
void save() override;
|
||||
void defaults() override;
|
||||
|
||||
bool isDefaults() const;
|
||||
bool isSaveNeeded() const;
|
||||
|
||||
protected:
|
||||
void initialize(KWinOptionsSettings *settings);
|
||||
|
||||
|
@ -77,8 +74,6 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
bool standAlone;
|
||||
bool m_unmanagedChangeState = false;
|
||||
bool m_unmanagedDefaultState = true;
|
||||
|
||||
KWinFocusConfigForm *m_ui;
|
||||
KWinOptionsSettings *m_settings;
|
||||
|
@ -94,9 +89,6 @@ public:
|
|||
|
||||
void save() override;
|
||||
|
||||
bool isDefaults() const;
|
||||
bool isSaveNeeded() const;
|
||||
|
||||
protected:
|
||||
void initialize(KWinOptionsSettings *settings);
|
||||
|
||||
|
@ -114,9 +106,6 @@ public:
|
|||
|
||||
void save() override;
|
||||
|
||||
bool isDefaults() const;
|
||||
bool isSaveNeeded() const;
|
||||
|
||||
protected:
|
||||
void initialize(KWinOptionsSettings *settings, KWinOptionsKDEGlobalsSettings *globalSettings);
|
||||
|
||||
|
|
Loading…
Reference in a new issue