Warning, /plasma/plasma-workspace/applets/activitybar/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013 Bhushan Shah <bhush94@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.0 0008 import QtQuick.Layouts 1.1 0009 0010 import org.kde.plasma.plasmoid 2.0 0011 import org.kde.plasma.core as PlasmaCore 0012 import org.kde.plasma.components 3.0 as PlasmaComponents // FIXME: PC3 Tabbar only has top and bottom tab positions, not left and right 0013 0014 import org.kde.activities 0.1 as Activities 0015 import org.kde.kcmutils // KCMLauncher 0016 import org.kde.config // KAuthorized 0017 0018 PlasmoidItem { 0019 Layout.minimumWidth: Plasmoid.formFactor === PlasmaCore.Types.Vertical ? tabBar.implicitHeight : tabBar.implicitWidth 0020 Layout.minimumHeight: Plasmoid.formFactor === PlasmaCore.Types.Vertical ? tabBar.implicitWidth : tabBar.implicitHeight 0021 0022 Plasmoid.constraintHints: Plasmoid.CanFillArea 0023 preferredRepresentation: fullRepresentation 0024 0025 PlasmaComponents.TabBar { 0026 id: tabBar 0027 0028 anchors.centerIn: parent 0029 rotation: Plasmoid.formFactor === PlasmaCore.Types.Vertical ? -90 : 0 0030 transformOrigin: Item.Center 0031 width: Plasmoid.formFactor === PlasmaCore.Types.Vertical ? parent.height : parent.width 0032 height: Plasmoid.formFactor === PlasmaCore.Types.Vertical ? parent.width : parent.height 0033 0034 0035 position: { 0036 switch (Plasmoid.location) { 0037 case PlasmaCore.Types.LeftEdge: 0038 case PlasmaCore.Types.TopEdge: 0039 return PlasmaComponents.TabBar.Header; 0040 default: 0041 return PlasmaComponents.TabBar.Footer; 0042 } 0043 } 0044 0045 Repeater { 0046 model: Activities.ActivityModel { 0047 id: activityModel 0048 shownStates: "Running" 0049 } 0050 delegate: PlasmaComponents.TabButton { 0051 id: tab 0052 0053 checked: model.current 0054 text: model.name 0055 activeFocusOnTab: true 0056 width: implicitWidth 0057 0058 Keys.onPressed: event => { 0059 switch (event.key) { 0060 case Qt.Key_Space: 0061 case Qt.Key_Enter: 0062 case Qt.Key_Return: 0063 case Qt.Key_Select: 0064 activityModel.setCurrentActivity(model.id, function() {}); 0065 event.accepted = true; 0066 break; 0067 } 0068 } 0069 Accessible.checked: model.current 0070 Accessible.name: model.name 0071 Accessible.description: i18n("Switch to activity %1", model.name) 0072 Accessible.role: Accessible.Button 0073 0074 onClicked: { 0075 activityModel.setCurrentActivity(model.id, function() {}); 0076 } 0077 0078 onCheckedChanged: { 0079 if(model.current) { 0080 if (tabBar.activeFocus) { 0081 forceActiveFocus(); 0082 } 0083 } 0084 } 0085 } 0086 } 0087 } 0088 0089 PlasmaCore.Action { 0090 id: configureAction 0091 text: i18nc("@action:inmenu", "&Configure Activities…") 0092 icon.name: "configure" 0093 visible: KAuthorized.authorizeControlModule("kcm_activities") 0094 onTriggered: KCMLauncher.openSystemSettings("kcm_activities") 0095 } 0096 0097 Component.onCompleted: { 0098 Plasmoid.setInternalAction("configure", configureAction); 0099 } 0100 }