KCMoptions: delay initialization after QObject creation in standalone

BUG: 423111
FIXED-IN: 5.19.2
This commit is contained in:
Méven Car 2020-06-18 12:03:04 +02:00
parent 430ca2a33e
commit 396a9da557
5 changed files with 61 additions and 14 deletions

View file

@ -42,8 +42,10 @@ class KFocusConfigStandalone : public KFocusConfig
Q_OBJECT
public:
KFocusConfigStandalone(QWidget* parent, const QVariantList &)
: KFocusConfig(true, new KWinOptionsSettings(this), parent)
{}
: KFocusConfig(true, nullptr, parent)
{
initialize(new KWinOptionsSettings(this));
}
};
class KMovingConfigStandalone : public KMovingConfig
@ -51,8 +53,10 @@ class KMovingConfigStandalone : public KMovingConfig
Q_OBJECT
public:
KMovingConfigStandalone(QWidget* parent, const QVariantList &)
: KMovingConfig(true, new KWinOptionsSettings(this), parent)
{}
: KMovingConfig(true, nullptr, parent)
{
initialize(new KWinOptionsSettings(this));
}
};
class KAdvancedConfigStandalone : public KAdvancedConfig
@ -60,8 +64,10 @@ class KAdvancedConfigStandalone : public KAdvancedConfig
Q_OBJECT
public:
KAdvancedConfigStandalone(QWidget* parent, const QVariantList &)
: KAdvancedConfig(true, new KWinOptionsSettings(this), parent)
{}
: KAdvancedConfig(true, nullptr, parent)
{
initialize(new KWinOptionsSettings(this));
}
};
KWinOptions::KWinOptions(QWidget *parent, const QVariantList &)

View file

@ -41,8 +41,15 @@ KWinActionsConfigForm::KWinActionsConfigForm(QWidget *parent)
KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
: KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinMouseConfigForm(this))
, m_settings(settings)
{
if (settings) {
initialize(settings);
}
}
void KTitleBarActionsConfig::initialize(KWinOptionsSettings *settings)
{
m_settings = settings;
addConfig(m_settings, this);
load();
}
@ -77,8 +84,15 @@ void KTitleBarActionsConfig::save()
KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
: KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinActionsConfigForm(this))
, m_settings(settings)
{
if (settings) {
initialize(settings);
}
}
void KWindowActionsConfig::initialize(KWinOptionsSettings *settings)
{
m_settings = settings;
addConfig(m_settings, this);
load();
}

View file

@ -59,6 +59,7 @@ public:
void save() override;
protected:
void initialize(KWinOptionsSettings *settings);
void showEvent(QShowEvent *ev) override;
void changeEvent(QEvent *ev) override;
@ -80,6 +81,7 @@ public:
void save() override;
protected:
void initialize(KWinOptionsSettings *settings);
void showEvent(QShowEvent *ev) override;
private:

View file

@ -61,8 +61,15 @@ KWinFocusConfigForm::KWinFocusConfigForm(QWidget* parent)
KFocusConfig::KFocusConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget * parent)
: KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinFocusConfigForm(this))
, m_settings(settings)
{
if (settings) {
initialize(settings);
}
}
void KFocusConfig::initialize(KWinOptionsSettings *settings)
{
m_settings = settings;
addConfig(m_settings, this);
connect(m_ui->windowFocusPolicy, qOverload<int>(&QComboBox::currentIndexChanged), this, &KFocusConfig::focusPolicyChanged);
@ -224,8 +231,15 @@ KWinAdvancedConfigForm::KWinAdvancedConfigForm(QWidget* parent)
KAdvancedConfig::KAdvancedConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
: KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinAdvancedConfigForm(this))
, m_settings(settings)
{
if (settings) {
initialize(settings);
}
}
void KAdvancedConfig::initialize(KWinOptionsSettings *settings)
{
m_settings = settings;
addConfig(m_settings, this);
m_ui->kcfg_Placement->setItemData(KWinOptionsSettings::PlacementChoices::Smart, "Smart");
@ -267,10 +281,18 @@ KWinMovingConfigForm::KWinMovingConfigForm(QWidget* parent)
}
KMovingConfig::KMovingConfig(bool _standAlone, KWinOptionsSettings *settings, QWidget *parent)
: KCModule(parent), m_config(settings), standAlone(_standAlone)
: KCModule(parent), standAlone(_standAlone)
, m_ui(new KWinMovingConfigForm(this))
{
addConfig(m_config, this);
if (settings) {
initialize(settings);
}
}
void KMovingConfig::initialize(KWinOptionsSettings *settings)
{
m_settings = settings;
addConfig(m_settings, this);
load();
}
@ -297,7 +319,7 @@ void KMovingConfig::save(void)
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
QStringLiteral("/Effects"),
QDBusConnection::sessionBus());
if (m_config->geometryTip()) {
if (m_settings->geometryTip()) {
interface.loadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry));
} else {
interface.unloadEffect(KWin::BuiltInEffects::nameForEffect(KWin::BuiltInEffect::WindowGeometry));

View file

@ -82,6 +82,7 @@ Q_SIGNALS:
void unmanagedWidgetStateChanged(bool changed);
protected:
void initialize(KWinOptionsSettings *settings);
void showEvent(QShowEvent *ev) override;
private Q_SLOTS:
@ -105,10 +106,11 @@ public:
void save() override;
protected:
void initialize(KWinOptionsSettings *settings);
void showEvent(QShowEvent *ev) override;
private:
KWinOptionsSettings *m_config;
KWinOptionsSettings *m_settings;
bool standAlone;
KWinMovingConfigForm *m_ui;
};
@ -122,6 +124,7 @@ public:
void save() override;
protected:
void initialize(KWinOptionsSettings *settings);
void showEvent(QShowEvent *ev) override;
private: