Commit 29c79a56 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

desktoppackage: fix unable to apply wallpaper settings after switching layout

`wallpaperGraphicsObject`, `wallpaper` or `wallpaperInterface`
is not set before calling `ContainmentInterface::loadWallpaper()`, so wait
until `wallpaperInterfaceChanged` signal is emitted. At that time
`applyWallpaper()` will call `syncWallpaperObjects()` to update
`wallpaperConfiguration`.

BUG: 407619
FIXED-IN: 5.24.6


(cherry picked from commit 379d162a)
parent 01ae1cf1
Pipeline #190877 failed with stage
in 3 minutes and 28 seconds
......@@ -14,6 +14,7 @@ import org.kde.newstuff 1.62 as NewStuff
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.5 as Kirigami
import org.kde.kcm 1.4
import org.kde.plasma.plasmoid 2.0
AbstractKCM {
id: root
......@@ -39,6 +40,21 @@ AbstractKCM {
configDialog.containmentPlugin = root.containmentPlugin
}
/*
* BUG 407619: `wallpaperGraphicsObject`, `wallpaper` or `wallpaperInterface`
* is not set before calling `ContainmentInterface::loadWallpaper()`, so wait
* until `wallpaperInterfaceChanged` signal is emitted. At that time
* `applyWallpaper()` will call `syncWallpaperObjects()` to update
* `wallpaperConfiguration`.
*/
Connections {
target: Plasmoid.self
function onWallpaperInterfaceChanged() {
configDialog.applyWallpaper();
main.loadSourceFile();
}
}
ColumnLayout {
anchors.fill: parent
spacing: 0 // unless it's 0 there will be an additional gap between two FormLayouts
......@@ -163,11 +179,15 @@ AbstractKCM {
// so we wouldn't load emptyConfig and break all over the place
// hence set it to some random value initially
property string sourceFile: "tbd"
onSourceFileChanged: {
if (sourceFile) {
onSourceFileChanged: loadSourceFile()
function loadSourceFile() {
const wallpaperConfig = configDialog.wallpaperConfiguration
// BUG 407619: wallpaperConfig can be null before calling `ContainmentInterface::loadWallpaper()`
if (wallpaperConfig && sourceFile) {
var props = {}
var wallpaperConfig = configDialog.wallpaperConfiguration
for (var key in wallpaperConfig) {
props["cfg_" + key] = wallpaperConfig[key]
}
......
Supports Markdown
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