/** SPDX-FileCopyrightText: 2021 Mikel Johnson <mikel5764@gmail.com>* SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>* SPDX-License-Identifier: LGPL-2.0-or-later*/pragma ComponentBehavior: Boundimport QtQuickimport QtQuick.Templates as Timport org.kde.plasma.extras as PlasmaExtrasBasePage {id: rootsideBarComponent: KickoffListView {id: sideBarfocus: true // needed for Loadersmodel: placesCategoryModelisSidebar: truedelegate: KickoffListDelegate {id: delegateurl: ""description: ""width: view.availableWidthisCategoryListItem: trueisMultilineText: falsebackground: PlasmaExtras.Highlight {// I have to do this for it to actually fill the item for some reasonanchors.fill: parentactive: falsehovered: delegate.mouseArea.containsMouse || delegate.ListView.isCurrentItemvisible: !delegate.isSeparator && hovered}}}contentAreaComponent: KickoffListView {id: contentAreamainContentView: truefocus: trueobjectName: "frequentlyUsedView"model: switch (root.sideBarItem.currentIndex) {case 0: return kickoff.computerModelcase 1: return kickoff.recentUsageModelcase 2: return kickoff.frequentUsageModel}onActiveFocusChanged: if (activeFocus && count < 1) {(root.sideBarItem as Item).forceActiveFocus()}}// we make our model ourselvesListModel {id: placesCategoryModelListElement { display: "Computer"; decoration: "computer" }ListElement { display: "History"; decoration: "view-history" }ListElement { display: "Frequently Used"; decoration: "clock" }Component.onCompleted: {// Can't use a function in a QML ListElement declarationplacesCategoryModel.setProperty(0, "display", i18nc("category in Places sidebar", "Computer"))placesCategoryModel.setProperty(1, "display", i18nc("category in Places sidebar", "History"))placesCategoryModel.setProperty(2, "display", i18nc("category in Places sidebar", "Frequently Used"))if (KickoffSingleton.powerManagement.data["PowerDevil"]&& KickoffSingleton.powerManagement.data["PowerDevil"]["Is Lid Present"]) {placesCategoryModel.setProperty(0, "decoration", "computer-laptop")}}}// NormalPage doesn't get destroyed when deactivated, so the binding uses// StackView.status and visible. This way the bindings are reset when// NormalPage is Activated again.Binding {target: kickoffproperty: "sideBar"value: root.sideBarItemwhen: root.T.StackView.status === T.StackView.Active && root.visiblerestoreMode: Binding.RestoreBinding}Binding {target: kickoffproperty: "contentArea"value: root.contentAreaItem // NOT root.contentAreaItem.currentItemwhen: root.T.StackView.status === T.StackView.Active && root.visiblerestoreMode: Binding.RestoreBinding}}