Warning, /plasma/plasma-mobile/shell/contents/configuration/ContainmentConfiguration.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0002 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick 2.12
0006 import QtQuick.Layouts 1.0
0007 import QtQuick.Window 2.2
0008 import QtQuick.Controls 2.15 as Controls
0009 
0010 import org.kde.plasma.components 3.0 as PlasmaComponents3
0011 import org.kde.plasma.core 2.0 as PlasmaCore
0012 import org.kde.plasma.configuration 2.0
0013 
0014 AppletConfiguration {
0015     id: root
0016     isContainment: true
0017     loadApp: false
0018 
0019     readonly property bool horizontal: root.width > root.height
0020 
0021     onAppLoaded: {
0022         app.width = root.width < root.height ? root.width : Math.min(root.width, Math.max(app.implicitWidth, PlasmaCore.Units.gridUnit * 45));
0023         app.height = Math.min(root.height, Math.max(app.implicitHeight, PlasmaCore.Units.gridUnit * 29));
0024     }
0025     
0026 //BEGIN model
0027     globalConfigModel: globalContainmentConfigModel
0028 
0029     ConfigModel {
0030         id: globalContainmentConfigModel
0031         ConfigCategory {
0032             name: i18nd("plasma_shell_org.kde.plasma.desktop", "Wallpaper")
0033             icon: "preferences-desktop-wallpaper"
0034             source: "ConfigurationContainmentAppearance.qml"
0035         }
0036     }
0037 //END model
0038 
0039     // the wallpaper selector is quite heavy, so only load it when needed
0040     Loader {
0041         id: wallpaperSelectorLoader
0042         asynchronous: true
0043         active: false
0044         
0045         onLoaded: {
0046             wallpaperSelectorLoader.item.open();
0047         }
0048         
0049         sourceComponent: WallpaperSelector {
0050             visible: false
0051             horizontal: root.horizontal
0052             edge: root.horizontal ? Qt.LeftEdge : Qt.BottomEdge
0053             onClosed: configDialog.close()
0054         }
0055     }
0056     
0057     MouseArea {
0058         z: -1
0059         anchors.fill: parent
0060         onClicked: configDialog.close()
0061         
0062         Controls.Control {
0063             anchors.bottom: parent.bottom
0064             anchors.horizontalCenter: parent.horizontalCenter
0065             anchors.bottomMargin: PlasmaCore.Units.largeSpacing
0066             
0067             leftPadding: PlasmaCore.Units.largeSpacing
0068             rightPadding: PlasmaCore.Units.largeSpacing
0069             topPadding: PlasmaCore.Units.largeSpacing
0070             bottomPadding: PlasmaCore.Units.largeSpacing
0071             
0072             NumberAnimation on opacity {
0073                 id: opacityAnim
0074                 running: true
0075                 from: 0
0076                 to: 1
0077                 duration: PlasmaCore.Units.longDuration
0078             }
0079             
0080             background: PlasmaCore.FrameSvgItem {
0081                 enabledBorders: PlasmaCore.FrameSvg.AllBorders
0082                 imagePath: "widgets/background"
0083             }
0084             
0085             contentItem: RowLayout {
0086                 PlasmaComponents3.Button {
0087                     Layout.alignment: Qt.AlignRight
0088                     Layout.preferredHeight: PlasmaCore.Units.gridUnit * 4
0089                     Layout.preferredWidth: PlasmaCore.Units.gridUnit * 8
0090                     
0091                     display: PlasmaComponents3.ToolButton.TextUnderIcon
0092                     icon.name: "viewimage"
0093                     icon.width: PlasmaCore.Units.iconSizes.medium
0094                     icon.height: PlasmaCore.Units.iconSizes.medium
0095                     text: i18n("Change Wallpaper")
0096                     onClicked: {
0097                         opacityAnim.from = 1;
0098                         opacityAnim.to = 0;
0099                         opacityAnim.restart();
0100                         wallpaperSelectorLoader.active = true;
0101                     }
0102                 }
0103                 
0104                 PlasmaComponents3.Button {
0105                     Layout.alignment: Qt.AlignLeft
0106                     Layout.preferredHeight: PlasmaCore.Units.gridUnit * 4
0107                     Layout.preferredWidth: PlasmaCore.Units.gridUnit * 8
0108                     
0109                     display: PlasmaComponents3.ToolButton.TextUnderIcon
0110                     icon.name: "configure"
0111                     icon.width: PlasmaCore.Units.iconSizes.medium
0112                     icon.height: PlasmaCore.Units.iconSizes.medium
0113                     text: i18n("Configure")
0114                     onClicked: {
0115                         root.loadApp = true;
0116                     }
0117                 }
0118             }
0119         }
0120     }
0121 }