More predictable behaviour of wallpaper chooser

This commit is contained in:
Sebastian Kügler 2013-03-28 04:29:33 +01:00
parent 41aaa5a904
commit f17e903d7c
3 changed files with 30 additions and 9 deletions

View File

@ -31,7 +31,7 @@ MouseArea {
//BEGIN properties
width: childrenRect.width
height: childrenRect.height
property bool current: categoriesView.currentIndex == index
property bool current: model.source == main.sourceFile
//END properties
//BEGIN connections
@ -40,18 +40,27 @@ MouseArea {
if (delegate.current) {
return
} else {
categoriesView.currentIndex = index;
if (typeof(categoriesView.currentIndex) != "undefined") {
categoriesView.currentIndex = index;
}
main.sourceFile = model.source
root.restoreConfig()
}
}
onCurrentChanged: {
if (current) {
categoriesView.currentIndex = index
}
}
//END connections
//BEGIN UI components
Column {
spacing: 4
anchors {
left: parent.left
right: parent.right
topMargin: _m
}
PlasmaCore.IconItem {
anchors.horizontalCenter: parent.horizontalCenter

View File

@ -27,6 +27,8 @@ import org.kde.plasma.configuration 2.0
Rectangle {
id: root
property int _m: theme.defaultFont.pointSize
//BEGIN properties
color: "lightgray"
width: 640
@ -135,8 +137,8 @@ Rectangle {
Rectangle {
color: theme.highlightColor
width: parent.width
height: categoriesView.currentItem.height
y: categoriesView.currentItem.y
height: theme.iconSizes.IconSizeHuge
y: index * height
Behavior on y {
NumberAnimation {
duration: 250
@ -149,7 +151,10 @@ Rectangle {
width: parent.width
Repeater {
model: configDialog.configModel
delegate: ConfigCategoryDelegate {}
delegate: ConfigCategoryDelegate {
onClicked: categoriesView.currentIndex = index
}
}
Repeater {
model: globalConfigModel
@ -178,6 +183,7 @@ Rectangle {
PlasmaComponents.PageStack {
id: main
anchors.fill: parent
anchors.margins: 12
property string sourceFile
Timer {
id: pageSizeSync

View File

@ -23,6 +23,8 @@ import org.kde.plasma.configuration 2.0
Column {
id: root
spacing: _m
PlasmaExtras.Title {
text: "Plugins"
}
@ -59,6 +61,7 @@ Column {
model: configDialog.wallpaperConfigModel
delegate: ConfigCategoryDelegate {
id: delegate
current: categoriesView.currentIndex == index
anchors {
top: parent.top
bottom: parent.bottom
@ -97,7 +100,7 @@ Column {
interval: 100
property variant pendingCurrent
onTriggered: {
if (pendingCurrent && pen) {
if (pendingCurrent) {
categoriesView.currentIndex = pendingCurrent.index
main.sourceFile = pendingCurrent.source
root.restoreConfig()
@ -107,7 +110,10 @@ Column {
}
PlasmaComponents.PageStack {
id: main
anchors.horizontalCenter: parent.horizontalCenter
anchors {
left: categoriesView.left;
right: parent.right;
}
width: implicitWidth
height: implicitHeight
property string sourceFile
@ -115,8 +121,8 @@ Column {
if (sourceFile != "") {
main.opacity = 1;
replace(Qt.resolvedUrl(sourceFile))
root.width = mainColumn.implicitWidth
root.height = mainColumn.implicitHeight
//main.width = mainColumn.implicitWidth
main.height = mainColumn.implicitHeight
} else {
main.opacity = 0
}