Commit 3600bebc authored by Kevin Ottens's avatar Kevin Ottens
Browse files

Repair the wallpaper config dialog

Summary:
This is full of mixed bindings/signal handlers for properties and of
broken references in here!

There's likely more to do, but those were the most obvious ones when
working on the screenlocker KCM.

Reviewers: #plasma, mart, davidedmundson, crossi, bport

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25567
parent 6d6d3c5b
......@@ -30,7 +30,7 @@ KCM.GridDelegate {
id: wallpaperDelegate
property alias color: backgroundRect.color
property bool selected: (wallpapersGrid.currentIndex === index)
readonly property bool selected: (view.currentIndex === index)
opacity: model.pendingDeletion ? 0.5 : 1
text: model.display
......
......@@ -63,6 +63,10 @@ ColumnLayout {
onSlideshowModeChanged: cfg_SlideshowMode = slideshowMode
}
onCfg_FillModeChanged: {
resizeComboBox.setMethod()
}
onCfg_SlidePathsChanged: {
imageWallpaper.slidePaths = cfg_SlidePaths
}
......@@ -114,7 +118,7 @@ ColumnLayout {
function setMethod() {
for (var i = 0; i < model.length; i++) {
if (model[i]["fillMode"] === wallpaper.configuration.FillMode) {
if (model[i]["fillMode"] === root.cfg_FillMode) {
resizeComboBox.currentIndex = i;
var tl = model[i]["label"].length;
//resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5);
......@@ -312,13 +316,29 @@ ColumnLayout {
id: wallpapersGrid
anchors.fill: parent
property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel
//that min is needed as the module will be populated in an async way
//and only on demand so we can't ensure it already exists
view.currentIndex: Math.min(imageModel.indexOf(cfg_Image), imageModel.rowCount()-1)
function resetCurrentIndex() {
//that min is needed as the module will be populated in an async way
//and only on demand so we can't ensure it already exists
view.currentIndex = Math.min(imageModel.indexOf(cfg_Image), imageModel.rowCount()-1)
}
Connections {
target: imageModel
onRowsInserted: resetCurrentIndex()
onRowsRemoved: resetCurrentIndex()
}
Connections {
target: root
onCfg_ImageChanged: resetCurrentIndex()
}
//kill the space for label under thumbnails
view.model: imageModel
Component.onCompleted: {
imageModel.usedInConfig = true;
resetCurrentIndex()
}
view.delegate: WallpaperDelegate {
color: cfg_Color
......
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