Warning, /plasma/kscreenlocker/kcm/ui/LnfConfig.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 QQC2.StackView {
0013     id: main
0014 
0015     signal configurationChanged
0016 
0017     property string sourceFile
0018 
0019     implicitHeight: currentItem && currentItem.implicitHeight || 0
0020     Layout.fillWidth: true
0021 
0022     onSourceFileChanged: {
0023         pop()
0024         if (sourceFile) {
0025             const props = {}
0026             const lnfConfiguration = configDialog.lnfConfiguration
0027             for (const key in lnfConfiguration) {
0028                 props["cfg_" + key] = lnfConfiguration[key]
0029             }
0030 
0031             const newItem = push(sourceFile, props, QQC2.StackView.ReplaceTransition)
0032 
0033             lnfConfiguration.valueChanged.connect((key, value) => {
0034                 if (newItem["cfg_" + key] !== undefined) {
0035                     newItem["cfg_" + key] = value
0036                 }
0037             })
0038 
0039             const createSignalHandler = key => {
0040                 return () => {
0041                     configDialog.lnfConfiguration[key] = newItem["cfg_" + key]
0042                     configurationChanged()
0043                 }
0044             }
0045 
0046             for (const key in lnfConfiguration) {
0047                 const changedSignal = newItem["cfg_" + key + "Changed"]
0048                 if (changedSignal) {
0049                     changedSignal.connect(createSignalHandler(key))
0050                 }
0051             }
0052         } else {
0053             push(empty)
0054         }
0055     }
0056 
0057     Component {
0058         id: empty
0059         Item {}
0060     }
0061 }