/*SPDX-FileCopyrightText: 2023 Tanbir Jishan <tantalising007@gmail.com>SPDX-License-Identifier: GPL-2.0-or-later*/pragma ComponentBehavior: Boundimport QtQuickimport QtQuick.Templates as Timport org.kde.plasma.extras as PlasmaExtrasKickoffGridView {id: rootproperty int gridIndex: -1 // To know the index of the grid when used inside a listivewproperty bool isCurrentSectionGrid: falseproperty bool isSearchFieldActive: false // needed since check doesn't work here when gridview used in all appsproperty ListView parentView // needed when used inside a listview e.g. all apps viewsignal showSectionView(string sectionName)// When nested insdie a listivew, other items will still treat it as a delegate(because this was the truth always till now), so just call the appropriate functionreadonly property QtObject action: QtObject {function triggered(): void {root.view.currentItem.action.triggered();root.view.currentItem.forceActiveFocus();}}view.height: view.cellHeight * Math.ceil(count / view.columns)view.implicitHeight: view.contentHeightdelegate: KickoffGridDelegate {id: itemDelegatewidth: view.cellWidthAccessible.role: Accessible.Cellbackground: Loader {active: itemDelegate.GridView.isCurrentItem && root.isCurrentSectionGridsourceComponent: PlasmaExtras.Highlight {anchors.fill: parentz: (root.Drag.active ?? false) ? 3 : 0hovered: truepressed: itemDelegate.downactive: root.view.activeFocus ||(kickoff.contentArea === root && kickoff.searchField.activeFocus)}}Connections {target: itemDelegate.mouseAreafunction onPositionChanged(mouse) {if (!root.parentView.movedWithKeyboard) {root.parentView.currentIndex = root.gridIndexroot.parentView.currentItem.forceActiveFocus()}}}}}