From 891af9cf54573012c7cdc0fe5616e17e04094d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 2 Dec 2013 15:27:58 +0100 Subject: [PATCH] Handling saving the changes of the KCM Save method added to the EffectView which invokes the specific methods on the effect model and compositing object. --- kcmkwin/kwincompositing/main.cpp | 9 +++++++++ kcmkwin/kwincompositing/model.cpp | 10 ++++++++++ kcmkwin/kwincompositing/model.h | 2 ++ 3 files changed, 21 insertions(+) diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index 0df802446a..58ed0f313e 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -36,6 +36,9 @@ public: explicit KWinCompositingKCM(QWidget* parent = 0, const QVariantList& args = QVariantList()); virtual ~KWinCompositingKCM(); +public Q_SLOTS: + void save() override; + private: QScopedPointer m_view; }; @@ -64,6 +67,12 @@ KWinCompositingKCM::~KWinCompositingKCM() { } +void KWinCompositingKCM::save() +{ + m_view->save(); + KCModule::save(); +} + K_PLUGIN_FACTORY(KWinCompositingConfigFactory, registerPlugin(); ) diff --git a/kcmkwin/kwincompositing/model.cpp b/kcmkwin/kwincompositing/model.cpp index 2aa757f201..df0ac1be64 100644 --- a/kcmkwin/kwincompositing/model.cpp +++ b/kcmkwin/kwincompositing/model.cpp @@ -375,5 +375,15 @@ void EffectView::init() connect(rootObject(), SIGNAL(changed()), this, SIGNAL(changed())); } +void EffectView::save() +{ + if (auto *model = rootObject()->findChild(QStringLiteral("filterModel"))) { + model->syncConfig(); + } + if (auto *compositing = rootObject()->findChild(QStringLiteral("compositing"))) { + compositing->save(); + } +} + }//end namespace Compositing }//end namespace KWin diff --git a/kcmkwin/kwincompositing/model.h b/kcmkwin/kwincompositing/model.h index 7b664ad74f..8d207ac110 100644 --- a/kcmkwin/kwincompositing/model.h +++ b/kcmkwin/kwincompositing/model.h @@ -102,6 +102,8 @@ public: Q_INVOKABLE QColor backgroundViewColor() { return KColorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)).background(KColorScheme::NormalBackground).color(); }; + void save(); + Q_SIGNALS: void changed(); private: