Warning, /plasma/plasma-mobile/shell/contents/views/Desktop.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Aaron Seigo <aseigo@kde.org> 0003 * SPDX-FileCopyrightText: 2012 Marco Martin <notmart@gmail.com> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.15 0009 0010 import org.kde.plasma.core 2.0 as PlasmaCore 0011 import org.kde.plasma.shell 2.0 as Shell 0012 import org.kde.kquickcontrolsaddons 2.0 0013 import org.kde.kirigami 2.20 as Kirigami 0014 0015 Rectangle { 0016 id: root 0017 0018 visible: false //adjust borders is run during setup. We want to avoid painting till completed 0019 property Item containment 0020 0021 color: (containment && containment.backgroundHints == PlasmaCore.Types.NoBackground) ? "transparent" : PlasmaCore.Theme.textColor 0022 0023 function toggleWidgetExplorer(containment) { 0024 console.log("Widget Explorer toggled"); 0025 if (widgetExplorerStack.source != "") { 0026 widgetExplorerStack.source = ""; 0027 } else { 0028 widgetExplorerStack.setSource(desktop.fileFromPackage("explorer", "WidgetExplorer.qml"), {"containment": containment, "containmentInterface": root.containment}) 0029 } 0030 } 0031 0032 Loader { 0033 id: widgetExplorerStack 0034 z: 99 0035 asynchronous: true 0036 y: containment ? containment.availableScreenRect.y : 0 0037 height: containment ? containment.availableScreenRect.height : parent.height 0038 width: parent.width 0039 0040 onLoaded: { 0041 if (widgetExplorerStack.item) { 0042 item.closed.connect(function() { 0043 widgetExplorerStack.source = "" 0044 }); 0045 0046 item.topPanelHeight = containment.availableScreenRect.y 0047 item.bottomPanelHeight = root.height - (containment.availableScreenRect.height + containment.availableScreenRect.y) 0048 0049 item.leftPanelWidth = containment.availableScreenRect.x 0050 item.rightPanelWidth = root.width - (containment.availableScreenRect.width + containment.availableScreenRect.x) 0051 } 0052 } 0053 } 0054 0055 onContainmentChanged: { 0056 containment.parent = root; 0057 containment.visible = true; 0058 containment.anchors.fill = root; 0059 } 0060 0061 Component.onCompleted: { 0062 visible = true 0063 } 0064 0065 // This is taken from plasma-desktop's shell package, try to keep it in sync 0066 Loader { 0067 id: wallpaperColors 0068 0069 active: desktop.usedInAccentColor && root.containment && root.containment.wallpaper 0070 asynchronous: true 0071 0072 sourceComponent: Kirigami.ImageColors { 0073 id: imageColors 0074 source: root.containment.wallpaper 0075 0076 readonly property color backgroundColor: PlasmaCore.Theme.backgroundColor 0077 readonly property color textColor: PlasmaCore.Theme.textColor 0078 0079 Kirigami.Theme.inherit: false 0080 Kirigami.Theme.backgroundColor: backgroundColor 0081 Kirigami.Theme.textColor: textColor 0082 0083 onBackgroundColorChanged: Qt.callLater(update) 0084 onTextColorChanged: Qt.callLater(update) 0085 0086 property Binding colorBinding: Binding { 0087 target: desktop 0088 property: "accentColor" 0089 value: { 0090 if (imageColors.palette.length === 0) { 0091 return "#00000000"; 0092 } 0093 return imageColors.dominant; 0094 } 0095 } 0096 0097 property Connections repaintConnection: Connections { 0098 target: root.containment.wallpaper 0099 function onRepaintNeeded() { 0100 imageColors.update(); 0101 } 0102 } 0103 } 0104 0105 onLoaded: item.update() 0106 } 0107 0108 }