Warning, /plasma/plasma-bigscreen/shell/contents/configuration/ConfigurationContainmentAppearance.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0003
0004 SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtQuick 2.0
0008 import org.kde.plasma.configuration 2.0
0009 import QtQuick.Controls 2.3 as QtControls
0010 import QtQuick.Layouts 1.1
0011
0012 import org.kde.kirigami 2.5 as Kirigami
0013
0014 ColumnLayout {
0015 id: root
0016
0017 property int formAlignment: wallpaperComboBox.Kirigami.ScenePosition.x - root.Kirigami.ScenePosition.x + (units.largeSpacing/2)
0018 property string currentWallpaper: ""
0019 signal configurationChanged
0020
0021 //BEGIN functions
0022 function saveConfig() {
0023 if (main.currentItem.saveConfig) {
0024 main.currentItem.saveConfig()
0025 }
0026 for (var key in configDialog.wallpaperConfiguration) {
0027 if (main.currentItem["cfg_"+key] !== undefined) {
0028 configDialog.wallpaperConfiguration[key] = main.currentItem["cfg_"+key]
0029 }
0030 }
0031 configDialog.currentWallpaper = root.currentWallpaper;
0032 configDialog.applyWallpaper()
0033 }
0034 //END functions
0035
0036 Component.onCompleted: {
0037 for (var i = 0; i < configDialog.wallpaperConfigModel.count; ++i) {
0038 var data = configDialog.wallpaperConfigModel.get(i);
0039 if (configDialog.currentWallpaper == data.pluginName) {
0040 wallpaperComboBox.currentIndex = i
0041 wallpaperComboBox.activated(i);
0042 break;
0043 }
0044 }
0045 }
0046
0047 Kirigami.InlineMessage {
0048 visible: plasmoid.immutable || animating
0049 text: i18nd("plasma_shell_org.kde.plasma.desktop", "Layout cannot be changed while widgets are locked")
0050 showCloseButton: true
0051 Layout.fillWidth: true
0052 Layout.leftMargin: Kirigami.Units.smallSpacing
0053 Layout.rightMargin: Kirigami.Units.smallSpacing
0054 }
0055
0056 Kirigami.FormLayout {
0057 Layout.fillWidth: true
0058 RowLayout {
0059 Layout.fillWidth: true
0060 Kirigami.FormData.label: i18nd("plasma_shell_org.kde.plasma.desktop", "Wallpaper Type:")
0061 QtControls.ComboBox {
0062 id: wallpaperComboBox
0063 Layout.preferredWidth: Math.max(implicitWidth, pluginComboBox.implicitWidth)
0064 model: configDialog.wallpaperConfigModel
0065 width: theme.mSize(theme.defaultFont).width * 24
0066 textRole: "name"
0067 onActivated: {
0068 var model = configDialog.wallpaperConfigModel.get(currentIndex)
0069 root.currentWallpaper = model.pluginName
0070 configDialog.currentWallpaper = model.pluginName
0071 main.sourceFile = model.source
0072 root.configurationChanged()
0073 }
0074 }
0075 // TODO Add "Get new plugins.." button when KNS is mobile friendly
0076 }
0077 }
0078
0079 Item {
0080 id: emptyConfig
0081 }
0082
0083 QtControls.StackView {
0084 id: main
0085
0086 Layout.fillHeight: true;
0087 Layout.fillWidth: true;
0088
0089 // Bug 360862: if wallpaper has no config, sourceFile will be ""
0090 // so we wouldn't load emptyConfig and break all over the place
0091 // hence set it to some random value initially
0092 property string sourceFile: "tbd"
0093 onSourceFileChanged: {
0094 if (sourceFile) {
0095 var props = {}
0096
0097 var wallpaperConfig = configDialog.wallpaperConfiguration
0098 for (var key in wallpaperConfig) {
0099 props["cfg_" + key] = wallpaperConfig[key]
0100 }
0101
0102 var newItem = replace(Qt.resolvedUrl(sourceFile), props)
0103
0104 for (var key in wallpaperConfig) {
0105 var changedSignal = newItem["cfg_" + key + "Changed"]
0106 if (changedSignal) {
0107 changedSignal.connect(root.configurationChanged)
0108 }
0109 }
0110 } else {
0111 replace(emptyConfig)
0112 }
0113 }
0114 }
0115 }