Commit cf061bab authored by Bharadwaj Raju's avatar Bharadwaj Raju
Browse files

wallpapers/image: Fix when used outside plasmashell

When used outside plasmashell, like in the kscreenlocker KCM, the Plasmoid
attached property isn't atcually undefined but just an empty object. Now we
check for that case properly.


(cherry picked from commit a3c9509b)
parent da9c52c6
Pipeline #244547 passed with stage
in 8 minutes and 11 seconds
......@@ -19,6 +19,11 @@ Item {
property alias view: wallpapersGrid.view
// HACK: detect an invalid Plasmoid attached property
// this is needed when we run outside of a Plasmashell context like in the KScreenLocker KCM
// otherwise the invalid Plasmoid is an empty `object` and not actually `undefined`
property var plasmoid: Plasmoid.width === undefined ? undefined : Plasmoid
readonly property var imageModel: (configDialog.currentWallpaper === "org.kde.image") ? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel
Connections {
......@@ -61,8 +66,8 @@ Item {
//set the size of the cell, depending on Screen resolution to respect the aspect ratio
view.implicitCellWidth: {
let screenWidth = 0;
if (typeof Plasmoid !== "undefined") {
screenWidth = Plasmoid.width;
if (typeof plasmoid !== "undefined") {
screenWidth = plasmoid.width;
} else {
screenWidth = Screen.width;
}
......@@ -71,8 +76,8 @@ Item {
}
view.implicitCellHeight: {
let screenHeight = 0;
if (typeof Plasmoid !== "undefined") {
screenHeight = Plasmoid.height;
if (typeof plasmoid !== "undefined") {
screenHeight = plasmoid.height;
} else {
screenHeight = Screen.height;
}
......
......@@ -39,6 +39,11 @@ ColumnLayout {
property var cfg_UncheckedSlides: []
property var cfg_UncheckedSlidesDefault: []
// HACK: detect an invalid Plasmoid attached property
// this is needed when we run outside of a Plasmashell context like in the KScreenLocker KCM
// otherwise the invalid Plasmoid is an empty `object` and not actually `undefined`
property var plasmoid: Plasmoid.width === undefined ? undefined : Plasmoid
signal configurationChanged()
function saveConfig() {
......@@ -52,8 +57,8 @@ ColumnLayout {
id: imageWallpaper
renderingMode: (configDialog.currentWallpaper === "org.kde.image") ? PlasmaWallpaper.ImageBackend.SingleImage : PlasmaWallpaper.ImageBackend.SlideShow
targetSize: {
if (typeof Plasmoid !== "undefined") {
return Qt.size(Plasmoid.width * Screen.devicePixelRatio, Plasmoid.height * Screen.devicePixelRatio)
if (typeof plasmoid !== "undefined") {
return Qt.size(plasmoid.width * Screen.devicePixelRatio, plasmoid.height * Screen.devicePixelRatio)
}
// Lock screen configuration case
return Qt.size(Screen.width * Screen.devicePixelRatio, Screen.height * Screen.devicePixelRatio)
......
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