Warning, /plasma/plasma-workspace/applets/systemtray/package/contents/ui/ExpanderArrow.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
0003 SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
0004
0005 SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007
0008 import QtQuick 2.15
0009 import QtQuick.Layouts 1.1
0010 import org.kde.plasma.plasmoid 2.0
0011 import org.kde.plasma.core as PlasmaCore
0012 import org.kde.kirigami 2.20 as Kirigami
0013
0014 PlasmaCore.ToolTipArea {
0015 id: tooltip
0016
0017 readonly property int arrowAnimationDuration: Kirigami.Units.shortDuration
0018 property bool vertical: Plasmoid.formFactor === PlasmaCore.Types.Vertical
0019 property int iconSize: Kirigami.Units.iconSizes.smallMedium
0020 implicitWidth: iconSize
0021 implicitHeight: iconSize
0022 activeFocusOnTab: true
0023
0024 Accessible.name: i18n("Expand System Tray")
0025 Accessible.description: i18n("Show all the items in the system tray in a popup")
0026 Accessible.role: Accessible.Button
0027 Accessible.onPressAction: systemTrayState.expanded = !systemTrayState.expanded
0028
0029 Keys.onPressed: event => {
0030 switch (event.key) {
0031 case Qt.Key_Space:
0032 case Qt.Key_Enter:
0033 case Qt.Key_Return:
0034 case Qt.Key_Select:
0035 systemTrayState.expanded = !systemTrayState.expanded;
0036 }
0037 }
0038
0039 subText: systemTrayState.expanded ? i18n("Close popup") : i18n("Show hidden icons")
0040
0041 property bool wasExpanded
0042
0043 TapHandler {
0044 onPressedChanged: {
0045 if (pressed) {
0046 tooltip.wasExpanded = systemTrayState.expanded;
0047 }
0048 }
0049 onTapped: {
0050 systemTrayState.expanded = !tooltip.wasExpanded;
0051 expandedRepresentation.hiddenLayout.currentIndex = -1;
0052 }
0053 }
0054
0055 Kirigami.Icon {
0056 anchors.fill: parent
0057
0058 rotation: systemTrayState.expanded ? 180 : 0
0059 Behavior on rotation {
0060 RotationAnimation {
0061 duration: tooltip.arrowAnimationDuration
0062 }
0063 }
0064 opacity: systemTrayState.expanded ? 0 : 1
0065 Behavior on opacity {
0066 NumberAnimation {
0067 duration: tooltip.arrowAnimationDuration
0068 }
0069 }
0070
0071 source: {
0072 if (Plasmoid.location === PlasmaCore.Types.TopEdge) {
0073 return "arrow-down";
0074 } else if (Plasmoid.location === PlasmaCore.Types.LeftEdge) {
0075 return "arrow-right";
0076 } else if (Plasmoid.location === PlasmaCore.Types.RightEdge) {
0077 return "arrow-left";
0078 } else {
0079 return "arrow-up";
0080 }
0081 }
0082 }
0083
0084 Kirigami.Icon {
0085 anchors.fill: parent
0086
0087 rotation: systemTrayState.expanded ? 0 : -180
0088 Behavior on rotation {
0089 RotationAnimation {
0090 duration: tooltip.arrowAnimationDuration
0091 }
0092 }
0093 opacity: systemTrayState.expanded ? 1 : 0
0094 Behavior on opacity {
0095 NumberAnimation {
0096 duration: tooltip.arrowAnimationDuration
0097 }
0098 }
0099
0100 source: {
0101 if (Plasmoid.location === PlasmaCore.Types.TopEdge) {
0102 return "arrow-up";
0103 } else if (Plasmoid.location === PlasmaCore.Types.LeftEdge) {
0104 return "arrow-left";
0105 } else if (Plasmoid.location === PlasmaCore.Types.RightEdge) {
0106 return "arrow-right";
0107 } else {
0108 return "arrow-down";
0109 }
0110 }
0111 }
0112 }