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