actually load config ui files

This commit is contained in:
Marco Martin 2013-02-22 15:43:01 +01:00
parent cfe6a40d3d
commit ff089521af
3 changed files with 52 additions and 4 deletions

View File

@ -627,6 +627,12 @@ void AppletInterface::setConfigurationInterfaceShown(bool show)
m_configView.data()->setResizeMode(QQuickView::SizeRootObjectToView);
m_configView.data()->setSource(QUrl::fromLocalFile(applet()->containment()->corona()->package().filePath("ui", "Configuration.qml")));
if (m_configView.data()->rootObject()) {
m_configView.data()->engine()->rootContext()->setContextProperty("plasmoid", this);
m_configView.data()->rootObject()->metaObject()->invokeMethod(m_configView.data()->rootObject(), "addConfigPage", Q_ARG(QVariant, QUrl::fromLocalFile(m_appletScriptEngine->package().filePath("ui", "ConfigGeneral.qml"))));
}
m_configView.data()->show();
} else {
if (m_configView) {

View File

@ -0,0 +1,40 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.0
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
Item {
id: iconsPage
height: childrenRect.height
Column {
anchors.fill: parent
spacing: 4
Row {
PlasmaComponents.Label {
text: "Text Config value"
}
PlasmaComponents.TextField {
id: testConfigField
}
}
}
}

View File

@ -28,6 +28,11 @@ Rectangle {
width: 640
height: 480
function addConfigPage(url) {
print("Loading config page: " + url)
main.source = url
}
Column {
anchors.fill: parent
Row {
@ -78,13 +83,10 @@ Rectangle {
Flickable {
contentWidth: width
contentHeight: main.height
Item {
Loader {
id: main
width: parent.width
height: childrenRect.height
Text {
text: "Configuration goes here"
}
}
}
}