Warning, /plasma/plasma-workspace/wallpapers/image/imagepackage/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0003 SPDX-FileCopyrightText: 2014 Sebastian Kügler <sebas@kde.org>
0004 SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
0005
0006 SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008
0009 import QtQuick
0010 import org.kde.plasma.core as PlasmaCore
0011 import org.kde.plasma.wallpapers.image as Wallpaper
0012 import org.kde.plasma.plasmoid
0013
0014 WallpaperItem {
0015 id: root
0016
0017 // used by WallpaperInterface for drag and drop
0018 onOpenUrlRequested: (url) => {
0019 if (root.pluginName === "org.kde.image") {
0020 const result = imageWallpaper.addUsersWallpaper(url);
0021 if (result.length > 0) {
0022 // Can be a file or a folder (KPackage)
0023 root.configuration.Image = result;
0024 }
0025 } else {
0026 imageWallpaper.addSlidePath(url);
0027 // Save drag and drop result
0028 root.configuration.SlidePaths = imageWallpaper.slidePaths;
0029 }
0030 }
0031
0032 contextualActions: [
0033 PlasmaCore.Action {
0034 text: i18nd("plasma_wallpaper_org.kde.image", "Open Wallpaper Image")
0035 icon.name: "document-open"
0036 visible: root.pluginName === "org.kde.slideshow"
0037 onTriggered: imageView.mediaProxy.openModelImage();
0038 },
0039 PlasmaCore.Action {
0040 text: i18nd("plasma_wallpaper_org.kde.image", "Next Wallpaper Image")
0041 icon.name: "user-desktop"
0042 visible: root.pluginName === "org.kde.slideshow"
0043 onTriggered: imageWallpaper.nextSlide();
0044 }
0045 ]
0046
0047 Component.onCompleted: {
0048 // In case plasmashell crashes when the config dialog is opened
0049 root.configuration.PreviewImage = "null";
0050 root.loading = true; // delays ksplash until the wallpaper has been loaded
0051 }
0052
0053 ImageStackView {
0054 id: imageView
0055 anchors.fill: parent
0056
0057 fillMode: root.configuration.FillMode
0058 configColor: root.configuration.Color
0059 blur: root.configuration.Blur
0060 source: {
0061 if (root.pluginName === "org.kde.slideshow") {
0062 return imageWallpaper.image;
0063 }
0064 if (root.configuration.PreviewImage !== "null") {
0065 return root.configuration.PreviewImage;
0066 }
0067 return root.configuration.Image;
0068 }
0069 sourceSize: Qt.size(root.width * Screen.devicePixelRatio, root.height * Screen.devicePixelRatio)
0070 wallpaperInterface: root
0071
0072 Wallpaper.ImageBackend {
0073 id: imageWallpaper
0074
0075 // Not using root.configuration.Image to avoid binding loop warnings
0076 configMap: root.configuration
0077 usedInConfig: false
0078 //the oneliner of difference between image and slideshow wallpapers
0079 renderingMode: (root.pluginName === "org.kde.image") ? Wallpaper.ImageBackend.SingleImage : Wallpaper.ImageBackend.SlideShow
0080 targetSize: imageView.sourceSize
0081 slidePaths: root.configuration.SlidePaths
0082 slideTimer: root.configuration.SlideInterval
0083 slideshowMode: root.configuration.SlideshowMode
0084 slideshowFoldersFirst: root.configuration.SlideshowFoldersFirst
0085 uncheckedSlides: root.configuration.UncheckedSlides
0086
0087 // Invoked from C++
0088 function writeImageConfig(newImage: string) {
0089 configMap.Image = newImage;
0090 }
0091 }
0092 }
0093 }