Warning, /plasma/plasma-sdk/plasmoidviewer/qmlpackages/shell/contents/configuration/ConfigurationAppletPage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.0 0008 0009 import org.kde.kirigami 2.10 as Kirigami 0010 import org.kde.plasma.plasmoid 2.0 0011 0012 Kirigami.ScrollablePage { 0013 id: root 0014 0015 title: configItem.name 0016 0017 required property var configItem 0018 0019 signal settingValueChanged() 0020 0021 function saveConfig() { 0022 for (let key in Plasmoid.configuration) { 0023 if (loader.item["cfg_" + key] != undefined) { 0024 Plasmoid.configuration[key] = loader.item["cfg_" + key] 0025 } 0026 } 0027 0028 // For ConfigurationContainmentActions.qml 0029 if (loader.item.hasOwnProperty("saveConfig")) { 0030 loader.item.saveConfig() 0031 } 0032 } 0033 0034 implicitHeight: loader.height 0035 0036 Loader { 0037 id: loader 0038 width: parent.width 0039 // HACK the height of the loader is based on the implicitHeight of the content. 0040 // Unfortunately not all content items have a sensible implicitHeight. 0041 // If it is zero fall back to the height of its children 0042 // Also make it at least as high as the page itself. Some existing configs assume they fill the whole space 0043 // TODO KF6 clean this up by making all configs based on SimpleKCM/ScrollViewKCM/GridViewKCM 0044 height: Math.max(root.availableHeight, item.implicitHeight ? item.implicitHeight : item.childrenRect.height) 0045 0046 Component.onCompleted: { 0047 const plasmoidConfig = Plasmoid.configuration 0048 0049 const props = {} 0050 for (let key in plasmoidConfig) { 0051 props["cfg_" + key] = Plasmoid.configuration[key] 0052 } 0053 0054 setSource(configItem.source, props) 0055 0056 for (let key in plasmoidConfig) { 0057 const changedSignal = item["cfg_" + key + "Changed"] 0058 if (changedSignal) { 0059 changedSignal.connect(root.settingValueChanged) 0060 } 0061 } 0062 0063 const configurationChangedSignal = item.configurationChanged 0064 if (configurationChangedSignal) { 0065 configurationChangedSignal.connect(root.settingValueChanged) 0066 } 0067 } 0068 } 0069 }