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.
This commit is contained in:
Martin Gräßlin 2013-12-02 15:27:58 +01:00
parent 1dd1c8e51d
commit 891af9cf54
3 changed files with 21 additions and 0 deletions

View file

@ -36,6 +36,9 @@ public:
explicit KWinCompositingKCM(QWidget* parent = 0, const QVariantList& args = QVariantList());
virtual ~KWinCompositingKCM();
public Q_SLOTS:
void save() override;
private:
QScopedPointer<KWin::Compositing::EffectView> m_view;
};
@ -64,6 +67,12 @@ KWinCompositingKCM::~KWinCompositingKCM()
{
}
void KWinCompositingKCM::save()
{
m_view->save();
KCModule::save();
}
K_PLUGIN_FACTORY(KWinCompositingConfigFactory,
registerPlugin<KWinCompositingKCM>();
)

View file

@ -375,5 +375,15 @@ void EffectView::init()
connect(rootObject(), SIGNAL(changed()), this, SIGNAL(changed()));
}
void EffectView::save()
{
if (auto *model = rootObject()->findChild<EffectFilterModel*>(QStringLiteral("filterModel"))) {
model->syncConfig();
}
if (auto *compositing = rootObject()->findChild<Compositing*>(QStringLiteral("compositing"))) {
compositing->save();
}
}
}//end namespace Compositing
}//end namespace KWin

View file

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