Warning, /plasma/plasma-desktop/applets/showActivityManager/package/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2012 Gregor Taetzner <gregor@freenet.de> 0003 SPDX-FileCopyrightText: 2020 Ivan Čukić <ivan.cukic at kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Layouts 0010 import org.kde.plasma.plasmoid 0011 import org.kde.plasma.core as PlasmaCore 0012 import org.kde.plasma.components as PlasmaComponents3 0013 import org.kde.draganddrop as DND 0014 0015 import org.kde.plasma.activityswitcher as ActivitySwitcher 0016 import org.kde.kirigami as Kirigami 0017 import org.kde.activities as Activities 0018 0019 PlasmoidItem { 0020 id: root 0021 0022 width: Kirigami.Units.iconSizes.large 0023 height: Kirigami.Units.iconSizes.large 0024 0025 Layout.maximumWidth: Infinity 0026 Layout.maximumHeight: Infinity 0027 0028 Layout.preferredWidth : icon.width + Kirigami.Units.smallSpacing + (root.showActivityName ? name.implicitWidth + Kirigami.Units.smallSpacing : 0) 0029 0030 Layout.minimumWidth: 0 0031 Layout.minimumHeight: 0 0032 0033 readonly property bool inVertical: Plasmoid.formFactor === PlasmaCore.Types.Vertical 0034 readonly property bool showActivityName: Plasmoid.configuration.showActivityName 0035 readonly property bool showActivityIcon: Plasmoid.configuration.showActivityIcon 0036 0037 Plasmoid.onActivated: ActivitySwitcher.Backend.toggleActivityManager() 0038 preferredRepresentation: fullRepresentation 0039 0040 DND.DropArea { 0041 id: dropArea 0042 anchors.fill: parent 0043 0044 onDragEnter: ActivitySwitcher.Backend.setDropMode(true) 0045 onDragLeave: ActivitySwitcher.Backend.setDropMode(false) 0046 0047 Activities.ActivityInfo { 0048 id: currentActivity 0049 activityId: ":current" 0050 } 0051 0052 MouseArea { 0053 anchors.fill: parent 0054 0055 activeFocusOnTab: true 0056 0057 Keys.onPressed: { 0058 switch (event.key) { 0059 case Qt.Key_Space: 0060 case Qt.Key_Enter: 0061 case Qt.Key_Return: 0062 case Qt.Key_Select: 0063 Plasmoid.activated(); 0064 break; 0065 } 0066 } 0067 Accessible.name: name.text ? i18nc("@info:tooltip", "Current activity is %1", name.text) : "" 0068 Accessible.description: tooltip.subText 0069 Accessible.role: Accessible.Button 0070 0071 onClicked: Plasmoid.activated() 0072 } 0073 0074 PlasmaCore.ToolTipArea { 0075 id: tooltip 0076 anchors.fill: parent 0077 mainText: i18n("Show Activity Manager") 0078 subText: i18n("Click to show the activity manager") 0079 } 0080 0081 Kirigami.Icon { 0082 id: icon 0083 height: Math.min(parent.height, parent.width) 0084 width: height 0085 0086 source: !root.showActivityIcon ? "activities" : 0087 currentActivity.icon === "" ? "activities" : 0088 currentActivity.icon 0089 } 0090 0091 PlasmaComponents3.Label { 0092 id: name 0093 0094 anchors { 0095 left: icon.right 0096 leftMargin: Kirigami.Units.smallSpacing 0097 } 0098 height: parent.height 0099 width: implicitWidth 0100 visible: root.showActivityName && !root.inVertical 0101 0102 verticalAlignment: Text.AlignVCenter 0103 0104 text: currentActivity.name 0105 textFormat: Text.PlainText 0106 } 0107 } 0108 }