/*SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>SPDX-FileCopyrightText: 2014 Ivan Cukic <ivan.cukic@kde.org>SPDX-License-Identifier: LGPL-2.0-or-later*/import QtQuickimport org.kde.plasma.components as PlasmaComponentsimport org.kde.kirigami as Kirigamiimport org.kde.config as KConfig // KAuthorizedimport org.kde.kcmutils // KCMLauncherFocusScope {id: rootsignal closed()//this is used to perfectly align the filter field and delegatesproperty int cellWidth: Kirigami.Units.iconSizes.sizeForLabels * 30property int spacing: 2 * Kirigami.Units.smallSpacingproperty bool showSwitcherOnly: falsewidth: Kirigami.Units.gridUnit * 16Item {id: activityBrowserproperty int spacing: 2 * Kirigami.Units.smallSpacingsignal closeRequested()Keys.onPressed: event => {if (event.key === Qt.Key_Escape) {if (heading.searchString.length > 0) {heading.searchString = "";} else {activityBrowser.closeRequested();}} else if (event.key === Qt.Key_Up) {activityList.selectPrevious();} else if (event.key === Qt.Key_Down) {activityList.selectNext();} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {activityList.openSelected();} else if (event.key === Qt.Key_Tab) {// console.log("TAB KEY");} else {// console.log("OTHER KEY");// event.accepted = false;// heading.forceActiveFocus();}}// Rectangle {// anchors.fill : parent// opacity : .4// color : "white"// }Heading {id: headinganchors {top: parent.topleft: parent.leftright: parent.rightleftMargin: Kirigami.Units.smallSpacingrightMargin: Kirigami.Units.smallSpacing}visible: !root.showSwitcherOnlyonCloseRequested: activityBrowser.closeRequested()}PlasmaComponents.ScrollView {anchors {top: heading.visible ? heading.bottom : parent.topbottom: bottomPanel.visible ? bottomPanel.top : parent.bottomleft: parent.leftright: parent.righttopMargin: activityBrowser.spacing}ActivityList {id: activityListshowSwitcherOnly: root.showSwitcherOnlyfilterString: heading.searchString.toLowerCase()itemsWidth: root.width - Kirigami.Units.smallSpacing}}Item {id: bottomPanelheight: newActivityButton.height + Kirigami.Units.gridUnitvisible: !root.showSwitcherOnlyanchors {bottom: parent.bottomleft: parent.leftright: parent.right}PlasmaComponents.ToolButton {id: newActivityButtontext: i18ndc("plasma_shell_org.kde.plasma.desktop", "@action:button opens Activity kcm", "Create activityβ¦")icon.name: "list-add"width: parent.widthonClicked: KCMLauncher.openSystemSettings("kcm_activities", "newActivity")visible: KConfig.KAuthorized.authorize("plasma-desktop/add_activities")}}onCloseRequested: root.closed()anchors.fill: parent}}