Make it possible to choose wallpapers without config
Wallpapers don't necessarily have config UIs, so we need to take a bit of care that we don't try to load them. Just hide the pagestack instead.
This commit is contained in:
parent
40ac6a5f0c
commit
41aaa5a904
@ -31,23 +31,20 @@ MouseArea {
|
||||
//BEGIN properties
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
property bool current: main.sourceFile == model.source
|
||||
property bool current: categoriesView.currentIndex == index
|
||||
//END properties
|
||||
|
||||
//BEGIN connections
|
||||
onClicked: {
|
||||
print("model source: " + model.source + " " + main.sourceFile);
|
||||
if (delegate.current) {
|
||||
return
|
||||
} else {
|
||||
categoriesView.currentIndex = index;
|
||||
main.sourceFile = model.source
|
||||
root.restoreConfig()
|
||||
}
|
||||
}
|
||||
onCurrentChanged: {
|
||||
if (current) {
|
||||
categoriesView.currentItem = delegate
|
||||
}
|
||||
}
|
||||
//END connections
|
||||
|
||||
//BEGIN UI components
|
||||
|
@ -85,8 +85,8 @@ Rectangle {
|
||||
main.sourceFile = globalConfigModel.get(0).source
|
||||
}
|
||||
root.restoreConfig()
|
||||
root.width = mainColumn.implicitWidth
|
||||
root.height = mainColumn.implicitHeight
|
||||
// root.width = mainColumn.implicitWidth
|
||||
// root.height = mainColumn.implicitHeight
|
||||
}
|
||||
//END connections
|
||||
|
||||
@ -183,13 +183,14 @@ Rectangle {
|
||||
id: pageSizeSync
|
||||
interval: 100
|
||||
onTriggered: {
|
||||
root.width = mainColumn.implicitWidth
|
||||
root.height = mainColumn.implicitHeight
|
||||
// root.width = mainColumn.implicitWidth
|
||||
// root.height = mainColumn.implicitHeight
|
||||
}
|
||||
}
|
||||
onImplicitWidthChanged: pageSizeSync.restart()
|
||||
onImplicitHeightChanged: pageSizeSync.restart()
|
||||
onSourceFileChanged: {
|
||||
print("Source file changed in flickable" + sourceFile);
|
||||
replace(Qt.resolvedUrl(sourceFile))
|
||||
/*
|
||||
* This is not needed on a desktop shell that has ok/apply/cancel buttons, i'll leave it here only for future reference until we have a prototype for the active shell.
|
||||
|
@ -18,11 +18,12 @@
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
Column {
|
||||
id: root
|
||||
PlasmaComponents.Label {
|
||||
PlasmaExtras.Title {
|
||||
text: "Plugins"
|
||||
}
|
||||
|
||||
@ -54,7 +55,7 @@ Column {
|
||||
}
|
||||
height: 100
|
||||
orientation: ListView.Horizontal
|
||||
|
||||
|
||||
model: configDialog.wallpaperConfigModel
|
||||
delegate: ConfigCategoryDelegate {
|
||||
id: delegate
|
||||
@ -67,14 +68,16 @@ Column {
|
||||
width: 64
|
||||
onClicked: {
|
||||
configDialog.currentWallpaper = model.pluginName
|
||||
if (delegate.current) {
|
||||
if (categoriesView.currentIndex == index) {
|
||||
return
|
||||
} else {
|
||||
categoriesView.currentIndex = index;
|
||||
main.sourceFile = model.source
|
||||
root.restoreConfig()
|
||||
}
|
||||
}
|
||||
onCurrentChanged: {
|
||||
categoriesView.currentIndex = index
|
||||
if (current) {
|
||||
categoriesView.currentIndex = index
|
||||
}
|
||||
@ -94,10 +97,10 @@ Column {
|
||||
interval: 100
|
||||
property variant pendingCurrent
|
||||
onTriggered: {
|
||||
if (pendingCurrent) {
|
||||
if (pendingCurrent && pen) {
|
||||
categoriesView.currentIndex = pendingCurrent.index
|
||||
main.sourceFile = pendingCurrent.source
|
||||
root.restoreConfig()
|
||||
categoriesView.currentIndex = pendingCurrent.index
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,9 +112,15 @@ Column {
|
||||
height: implicitHeight
|
||||
property string sourceFile
|
||||
onSourceFileChanged: {
|
||||
replace(Qt.resolvedUrl(sourceFile))
|
||||
root.width = mainColumn.implicitWidth
|
||||
root.height = mainColumn.implicitHeight
|
||||
if (sourceFile != "") {
|
||||
main.opacity = 1;
|
||||
replace(Qt.resolvedUrl(sourceFile))
|
||||
root.width = mainColumn.implicitWidth
|
||||
root.height = mainColumn.implicitHeight
|
||||
} else {
|
||||
main.opacity = 0
|
||||
}
|
||||
}
|
||||
Behavior on opacity { NumberAnimation {} }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user