Commit 33222600 authored by Cyril Rossi's avatar Cyril Rossi
Browse files

KCM KSplash port to ManagedConfigModule

Reviewers: #plasma, ervin, mart, bport

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24925
parent fbed4b3e
...@@ -39,13 +39,10 @@ ...@@ -39,13 +39,10 @@
K_PLUGIN_FACTORY_WITH_JSON(KCMSplashScreenFactory, "kcm_splashscreen.json", registerPlugin<KCMSplashScreen>();) K_PLUGIN_FACTORY_WITH_JSON(KCMSplashScreenFactory, "kcm_splashscreen.json", registerPlugin<KCMSplashScreen>();)
KCMSplashScreen::KCMSplashScreen(QObject* parent, const QVariantList& args) KCMSplashScreen::KCMSplashScreen(QObject* parent, const QVariantList& args)
: KQuickAddons::ConfigModule(parent, args) : KQuickAddons::ManagedConfigModule(parent, args)
, m_settings(new SplashScreenSettings(this)) , m_settings(new SplashScreenSettings(this))
, m_model(new QStandardItemModel(this)) , m_model(new QStandardItemModel(this))
{ {
connect(m_settings, &SplashScreenSettings::engineChanged, this, [this]{ setNeedsSave(true); });
connect(m_settings, &SplashScreenSettings::themeChanged, this, [this]{ setNeedsSave(true); });
qmlRegisterType<SplashScreenSettings>(); qmlRegisterType<SplashScreenSettings>();
qmlRegisterType<QStandardItemModel>(); qmlRegisterType<QStandardItemModel>();
...@@ -133,22 +130,10 @@ void KCMSplashScreen::loadModel() ...@@ -133,22 +130,10 @@ void KCMSplashScreen::loadModel()
emit m_settings->themeChanged(); emit m_settings->themeChanged();
} }
void KCMSplashScreen::load()
{
m_settings->load();
setNeedsSave(false);
}
void KCMSplashScreen::save() void KCMSplashScreen::save()
{ {
m_settings->setEngine(m_settings->theme() == QStringLiteral("None") ? QStringLiteral("none") : QStringLiteral("KSplashQML")); m_settings->setEngine(m_settings->theme() == QStringLiteral("None") ? QStringLiteral("none") : QStringLiteral("KSplashQML"));
m_settings->save(); ManagedConfigModule::save();
}
void KCMSplashScreen::defaults()
{
m_settings->setDefaults();
setNeedsSave(m_settings->isSaveNeeded());
} }
int KCMSplashScreen::pluginIndex(const QString &pluginName) const int KCMSplashScreen::pluginIndex(const QString &pluginName) const
......
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
#define _KCM_SEARCH_H #define _KCM_SEARCH_H
#include <KPackage/Package> #include <KPackage/Package>
#include <KQuickAddons/ConfigModule> #include <KQuickAddons/ManagedConfigModule>
class QStandardItemModel; class QStandardItemModel;
class SplashScreenSettings; class SplashScreenSettings;
class KCMSplashScreen : public KQuickAddons::ConfigModule class KCMSplashScreen : public KQuickAddons::ManagedConfigModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(SplashScreenSettings *splashScreenSettings READ splashScreenSettings CONSTANT) Q_PROPERTY(SplashScreenSettings *splashScreenSettings READ splashScreenSettings CONSTANT)
...@@ -51,9 +51,7 @@ public: ...@@ -51,9 +51,7 @@ public:
public Q_SLOTS: public Q_SLOTS:
void getNewClicked(); void getNewClicked();
void load() override;
void save() override; void save() override;
void defaults() override;
void test(const QString &plugin); void test(const QString &plugin);
Q_SIGNALS: Q_SIGNALS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment