partly working configuration

still writes in the wrong config file
This commit is contained in:
Marco Martin 2013-02-25 20:58:01 +01:00
parent 9ab4acd23a
commit aa1940b246
3 changed files with 24 additions and 5 deletions

View File

@ -25,6 +25,8 @@ Item {
id: iconsPage
height: childrenRect.height
property alias cfg_Test: testConfigField.text
Column {
anchors.fill: parent
spacing: 4

View File

@ -64,12 +64,12 @@ Rectangle {
plasmoid.busy = !plasmoid.busy
}
}
TextInput {
/*TextInput {
width: 100
height: 22
text: plasmoid.configuration.Test
onTextChanged: plasmoid.configuration.Test = text
}
}*/
}
Component.onCompleted: {
print("Test Applet loaded")

View File

@ -28,11 +28,21 @@ Rectangle {
width: 640
height: 480
function addConfigPage(url) {
print("Loading config page: " + url)
main.source = url
function saveConfig() {
for (var key in plasmoid.configuration) {
if (main.item["cfg_"+key] !== undefined) {
plasmoid.configuration[key] = main.item["cfg_"+key]
}
}
}
function restoreConfig() {
for (var key in plasmoid.configuration) {
if (main.item["cfg_"+key] !== undefined) {
main.item["cfg_"+key] = plasmoid.configuration[key]
}
}
}
Column {
anchors.fill: parent
@ -87,6 +97,7 @@ Rectangle {
}
onClicked: {
main.sourceComponent = configDialog.configPages[modelData].component
root.restoreConfig()
}
}
}
@ -120,10 +131,16 @@ Rectangle {
PlasmaComponents.Button {
iconSource: "dialog-ok"
text: "Ok"
onClicked: {
root.saveConfig()
}
}
PlasmaComponents.Button {
iconSource: "dialog-ok-apply"
text: "Apply"
onClicked: {
root.saveConfig()
}
}
PlasmaComponents.Button {
iconSource: "dialog-cancel"