Warning, /plasma/plasma-workspace/applets/systemtray/container/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.1
0008 import QtQuick.Layouts 1.1
0009 import org.kde.plasma.core as PlasmaCore
0010 import org.kde.plasma.plasmoid 2.0
0011 
0012 //SystemTray is a Containment. To have it presented as a widget in Plasma we need thin wrapping applet
0013 PlasmoidItem {
0014     id: root
0015 
0016     property ContainmentItem internalSystray
0017 
0018     Layout.minimumWidth: internalSystray ? internalSystray.Layout.minimumWidth : 0
0019     Layout.minimumHeight: internalSystray ? internalSystray.Layout.minimumHeight : 0
0020     Layout.preferredWidth: Layout.minimumWidth
0021     Layout.preferredHeight: Layout.minimumHeight
0022 
0023     preferredRepresentation: fullRepresentation
0024     Plasmoid.status: internalSystray ? internalSystray.plasmoid.status : PlasmaCore.Types.UnknownStatus
0025 
0026     //synchronize state between SystemTray and wrapping Applet
0027     onExpandedChanged: {
0028         if (internalSystray) {
0029             internalSystray.expanded = root.expanded
0030         }
0031     }
0032     Connections {
0033         target: internalSystray
0034         function onExpandedChanged() {
0035             root.expanded = internalSystray.expanded
0036         }
0037     }
0038 
0039     Component.onCompleted: {
0040         root.internalSystray = Plasmoid.internalSystray;
0041 
0042         if (root.internalSystray == null) {
0043             return;
0044         }
0045         root.internalSystray.parent = root;
0046         root.internalSystray.anchors.fill = root;
0047     }
0048 
0049     Connections {
0050         target: Plasmoid
0051         function onInternalSystrayChanged() {
0052             root.internalSystray = Plasmoid.internalSystray;
0053             root.internalSystray.parent = root;
0054             root.internalSystray.anchors.fill = root;
0055         }
0056     }
0057 }