Commit 012c872d authored by Marco Martin's avatar Marco Martin

make the new multilevel api work

parent 94cfb354
...@@ -141,6 +141,7 @@ void SettingsComponent::loadModule(const QString &name) ...@@ -141,6 +141,7 @@ void SettingsComponent::loadModule(const QString &name)
d->valid = true; d->valid = true;
emit mainUiChanged(); emit mainUiChanged();
emit kcmChanged();
emit validChanged(); emit validChanged();
} }
...@@ -153,6 +154,11 @@ QQuickItem *SettingsComponent::mainUi() const ...@@ -153,6 +154,11 @@ QQuickItem *SettingsComponent::mainUi() const
return nullptr; return nullptr;
} }
KQuickAddons::ConfigModule *SettingsComponent::kcm() const
{
return d->kcm;
}
bool SettingsComponent::isValid() const bool SettingsComponent::isValid() const
{ {
return d->valid; return d->valid;
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <QQuickItem> #include <QQuickItem>
class SettingsComponentPrivate; class SettingsComponentPrivate;
namespace KQuickAddons {
class ConfigModule;
}
class SettingsComponent : public QQuickItem class SettingsComponent : public QQuickItem
{ {
...@@ -33,6 +36,7 @@ class SettingsComponent : public QQuickItem ...@@ -33,6 +36,7 @@ class SettingsComponent : public QQuickItem
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged) Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
Q_PROPERTY(bool valid READ isValid NOTIFY validChanged) Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
Q_PROPERTY(QQuickItem *mainUi READ mainUi NOTIFY mainUiChanged) Q_PROPERTY(QQuickItem *mainUi READ mainUi NOTIFY mainUiChanged)
Q_PROPERTY(KQuickAddons::ConfigModule *kcm READ kcm NOTIFY kcmChanged)
public: public:
SettingsComponent(QQuickItem *parent = 0); SettingsComponent(QQuickItem *parent = 0);
...@@ -46,6 +50,7 @@ public: ...@@ -46,6 +50,7 @@ public:
bool isValid() const; bool isValid() const;
QQuickItem *mainUi() const; QQuickItem *mainUi() const;
KQuickAddons::ConfigModule *kcm() const;
Q_SIGNALS: Q_SIGNALS:
void descriptionChanged(); void descriptionChanged();
...@@ -54,6 +59,7 @@ Q_SIGNALS: ...@@ -54,6 +59,7 @@ Q_SIGNALS:
void iconChanged(); void iconChanged();
void validChanged(); void validChanged();
void mainUiChanged(); void mainUiChanged();
void kcmChanged();
public Q_SLOTS: public Q_SLOTS:
void setModule(const QString &module); void setModule(const QString &module);
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <QQmlContext> #include <QQmlContext>
//#include <QScriptEngine> //#include <QScriptEngine>
#include <kquickaddons/configmodule.h>
//#include "settingsmoduleloader.h" //#include "settingsmoduleloader.h"
#include "settingsmodulesmodel.h" #include "settingsmodulesmodel.h"
#include "settingscomponent.h" #include "settingscomponent.h"
...@@ -39,5 +41,6 @@ void SettingsPlugin::registerTypes(const char *uri) ...@@ -39,5 +41,6 @@ void SettingsPlugin::registerTypes(const char *uri)
qmlRegisterType<SettingsComponent>(uri, major, minor, "SettingsComponent"); qmlRegisterType<SettingsComponent>(uri, major, minor, "SettingsComponent");
qmlRegisterType<Package>(uri, major, minor, "Package"); qmlRegisterType<Package>(uri, major, minor, "Package");
qmlRegisterType<Plasma::ConfigGroup>(uri, major, minor, "ConfigGroup"); qmlRegisterType<Plasma::ConfigGroup>(uri, major, minor, "ConfigGroup");
qmlRegisterType<KQuickAddons::ConfigModule>();
} }
...@@ -32,13 +32,37 @@ Kirigami.Page { ...@@ -32,13 +32,37 @@ Kirigami.Page {
rightPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit rightPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
bottomPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit bottomPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
contentItem: ActiveSettings.SettingsComponent { ActiveSettings.SettingsComponent {
id: settingsComponent id: settingsComponent
anchors.fill: parent
property alias status: settingsLoader.status property alias status: settingsLoader.status
signal moduleLoaded signal moduleLoaded
Connections {
target: settingsComponent.kcm
onPagePushed: {
applicationWindow().pageStack.push(kcmWrapperComponent, {"page": page})
}
}
Component {
id: kcmWrapperComponent
Kirigami.Page {
id: wrapper
property Item page
title: page ? page.title : ""
leftPadding: 0
topPadding: 0
rightPadding: 0
bottomPadding: 0
onPageChanged: {
page.visible = true;
page.parent = wrapper.contentItem;
page.anchors.fill = wrapper.contentItem;
}
}
}
Loader { Loader {
id: settingsLoader id: settingsLoader
anchors.fill: parent anchors.fill: parent
......
...@@ -21,14 +21,13 @@ ...@@ -21,14 +21,13 @@
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.2 as Controls import QtQuick.Controls 2.2 as Controls
import org.kde.kirigami 2.2 as Kirigami import org.kde.kirigami 2.5 as Kirigami
Kirigami.ApplicationWindow { Kirigami.ApplicationWindow {
id: rootItem id: rootItem
property alias currentModule: moduleItem.module property alias currentModule: moduleItem.module
header: Kirigami.ApplicationHeader {}
pageStack.initialPage: modulesList pageStack.initialPage: modulesList
Connections { Connections {
......
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