Commit 84ade540 authored by Laurent Montel's avatar Laurent Montel
Browse files

Port KDeclarative/ConfigPropertyMap

parent 437a4881
Pipeline #142927 passed with stage
in 1 minute and 18 seconds
......@@ -44,7 +44,7 @@ ecm_add_test(sensorfacecontrollertest.cpp LINK_LIBRARIES
KF5::ConfigGui
KF5::I18n
KF5::Package
KF5::Declarative
KF5::ConfigQml
KF5::Solid
KSysGuard::SensorFaces
)
......
......@@ -51,7 +51,7 @@ target_link_libraries(SensorFaces
Qt::DBus
KF5::I18n
KF5::Package
KF5::Declarative
KF5::ConfigQml
KF5::Solid
)
......
......@@ -13,7 +13,7 @@
#include <QtQml>
#include <KConfigLoader>
#include <KDeclarative/ConfigPropertyMap>
#include <KConfigPropertyMap>
#include <KDesktopFile>
#include <KLocalizedString>
#include <KPackage/PackageLoader>
......@@ -686,7 +686,7 @@ QString SensorFaceController::faceId() const
return d->faceId;
}
KDeclarative::ConfigPropertyMap *SensorFaceController::faceConfiguration() const
KConfigPropertyMap *SensorFaceController::faceConfiguration() const
{
return d->faceConfiguration;
}
......@@ -991,9 +991,6 @@ bool SensorFaceController::shouldSync() const
void SensorFaceController::setShouldSync(bool sync)
{
d->shouldSync = sync;
if (d->faceConfiguration) {
d->faceConfiguration->setAutosave(sync);
}
if (!d->shouldSync && d->syncTimer->isActive()) {
d->syncTimer->stop();
}
......@@ -1016,9 +1013,8 @@ void SensorFaceController::reloadFaceConfiguration()
}
d->faceConfigLoader = new KConfigLoader(cg, &file, this);
d->faceConfiguration = new KDeclarative::ConfigPropertyMap(d->faceConfigLoader, this);
d->faceConfiguration->setAutosave(d->shouldSync);
connect(d->faceConfiguration, &KDeclarative::ConfigPropertyMap::valueChanged, this, [this](const QString &key) {
d->faceConfiguration = new KConfigPropertyMap(d->faceConfigLoader, this);
connect(d->faceConfiguration, &KConfigPropertyMap::valueChanged, this, [this](const QString &key) {
auto item = d->faceConfigLoader->findItemByName(key);
if (item) {
item->writeConfig(d->faceConfigLoader->config());
......
......@@ -15,11 +15,7 @@
#include "sensorfaces_export.h"
namespace KDeclarative
{
class ConfigPropertyMap;
}
class KConfigPropertyMap;
class QQmlEngine;
class KDesktopFile;
class KConfigLoader;
......@@ -114,7 +110,7 @@ class SENSORFACES_EXPORT SensorFaceController : public QObject
* `main.xml` of the face.
* @see faceConfigUi
*/
Q_PROPERTY(KDeclarative::ConfigPropertyMap *faceConfiguration READ faceConfiguration NOTIFY faceConfigurationChanged)
Q_PROPERTY(KConfigPropertyMap *faceConfiguration READ faceConfiguration NOTIFY faceConfigurationChanged)
/**
* The full representation of the current face. Typically includes additional elements like
......@@ -191,7 +187,7 @@ public:
QQuickItem *appearanceConfigUi();
QQuickItem *sensorsConfigUi();
KDeclarative::ConfigPropertyMap *faceConfiguration() const;
KConfigPropertyMap *faceConfiguration() const;
QString title() const;
void setTitle(const QString &title);
......
......@@ -8,7 +8,7 @@
#include <KConfigGroup>
#include <KConfigLoader>
#include <KDeclarative/ConfigPropertyMap>
#include <KConfigPropertyMap>
#include <KLocalizedContext>
#include <KPackage/PackageLoader>
#include <QJsonArray>
......@@ -78,7 +78,7 @@ public:
QQmlEngine *engine;
KConfigGroup faceProperties;
KDeclarative::ConfigPropertyMap *faceConfiguration = nullptr;
KConfigPropertyMap *faceConfiguration = nullptr;
KConfigLoader *faceConfigLoader = nullptr;
bool configNeedsSave = false;
......
......@@ -2,7 +2,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.
add_library(FacesPlugin SHARED FacesPlugin.cpp)
target_link_libraries(FacesPlugin Qt::Qml KSysGuard::Sensors KSysGuard::SensorFaces KF5::Package KF5::ConfigCore KF5::ConfigGui KF5::Declarative)
target_link_libraries(FacesPlugin Qt::Qml KSysGuard::Sensors KSysGuard::SensorFaces KF5::Package KF5::ConfigCore KF5::ConfigGui KF5::ConfigQml)
install(TARGETS FacesPlugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/ksysguard/faces)
install(FILES
......
......@@ -14,7 +14,7 @@
#include "SensorFace_p.h"
#include "SensorTreeModel.h"
#include <KDeclarative/ConfigPropertyMap>
#include <KConfigPropertyMap>
#include <QQmlEngine>
#include <QTransposeProxyModel>
......@@ -31,7 +31,7 @@ void FacesPlugin::registerTypes(const char *uri)
0,
"SensorFaceController",
QStringLiteral("It's not possible to create objects of type SensorFaceController"));
qmlRegisterAnonymousType<KDeclarative::ConfigPropertyMap>(uri, 1);
qmlRegisterAnonymousType<KConfigPropertyMap>(uri, 1);
qmlRegisterType<QTransposeProxyModel>("org.kde.ksysguard.faces.private", 1, 0, "QTransposeProxyModel");
qmlRegisterType<KSysGuard::FaceLoader>(uri, 1, 0, "FaceLoader");
......
Supports Markdown
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