Warning, /plasma/kscreenlocker/kcm/ui/WallpaperConfig.qml is written in an unsupported language. File is not indexed.

0001 /*
0002 SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
0003 SPDX-FileCopyrightText: 2019 Kevin Ottens <kevin.ottens@enioka.com>
0004 
0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 import QtQuick 2.15
0009 import QtQuick.Controls 2.15 as QQC2
0010 import QtQuick.Layouts 1.15
0011 
0012 import org.kde.kirigami 2.20 as Kirigami
0013 
0014 QQC2.StackView {
0015     id: main
0016 
0017     property string sourceFile
0018 
0019     signal configurationChanged
0020     signal configurationForceChanged
0021 
0022     Layout.fillHeight: true
0023     Layout.fillWidth: true
0024 
0025     implicitHeight: Kirigami.Units.gridUnit * 30
0026 
0027     onSourceFileChanged: {
0028         if (sourceFile) {
0029             const props = { configDialog }
0030             const wallpaperConfig = configDialog.wallpaperConfiguration
0031             for (const key in wallpaperConfig) {
0032                 props["cfg_" + key] = wallpaperConfig[key]
0033             }
0034 
0035             const newItem = replace(sourceFile, props, QQC2.StackView.ReplaceTransition)
0036 
0037             wallpaperConfig.valueChanged.connect((key, value) => {
0038                 if (newItem["cfg_" + key] !== undefined) {
0039                     newItem["cfg_" + key] = value
0040                 }
0041             })
0042 
0043             const createSignalHandler = key => {
0044                 return () => {
0045                     configDialog.wallpaperConfiguration[key] = newItem["cfg_" + key]
0046                     configurationChanged()
0047                 }
0048             }
0049 
0050             for (const key in wallpaperConfig) {
0051                 const changedSignal = newItem["cfg_" + key + "Changed"]
0052                 if (changedSignal) {
0053                     changedSignal.connect(createSignalHandler(key))
0054                 }
0055             }
0056 
0057             const configurationChangedSignal = newItem.configurationChanged
0058             if (configurationChangedSignal) {
0059                 configurationChangedSignal.connect(main.configurationForceChanged) // BUG 438585
0060             }
0061         } else {
0062             replace(empty)
0063         }
0064     }
0065 
0066     Component {
0067         id: empty
0068         Item {}
0069     }
0070 }