Warning, /plasma/plasma-desktop/applets/kickoff/package/contents/ui/ListOfGridsViewDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2023 Tanbir Jishan <tantalising007@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.15
0008 import QtQml 2.15
0009 
0010 import org.kde.plasma.extras as PlasmaExtras
0011 
0012 import org.kde.ksvg 1.0 as KSvg
0013 
0014 KickoffGridView {
0015     id: root
0016 
0017     property string allAppsSection: undefined
0018     property int gridIndex: -1                  // To know the index of the grid when used inside a listivew
0019     property bool isCurrentSectionGrid: false
0020     property bool isSearchFieldActive: false // needed since check doesn't work here when gridview used in all apps
0021     property ListView parentView: undefined // neeeded when used inside a listview e.g. all apps view
0022 
0023     signal showSectionView(string sectionName)
0024 
0025     // 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 function
0026     readonly property QtObject action: QtObject {
0027         function triggered() {
0028             view.currentItem.action.triggered();
0029             view.currentItem.forceActiveFocus();
0030         }
0031     }
0032 
0033     view.height : view.cellHeight * Math.ceil(count / view.columns)
0034     view.implicitHeight: view.contentHeight
0035     blockTargetWheel: false
0036     view.highlight: PlasmaExtras.Highlight {
0037         visible: root.isCurrentSectionGrid
0038         // The default Z value for delegates is 1. The default Z value for the section delegate is 2.
0039         // The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
0040         z: root.currentItem && root.currentItem.Drag.active ?
0041             3 : 0
0042         width: view.cellWidth
0043         height: view.cellHeight
0044         pressed: view.currentItem && view.currentItem.isPressed
0045         active: view.activeFocus
0046             || (kickoff.contentArea === root
0047                 && kickoff.searchField.activeFocus)
0048     }
0049 
0050     delegate: KickoffGridDelegate {
0051         id: itemDelegate
0052         width: view.cellWidth
0053         Accessible.role: Accessible.Cell
0054 
0055         Connections {
0056             target: itemDelegate.mouseArea
0057             function onPositionChanged(mouse) {
0058                 if (!root.parentView.movedWithKeyboard) {
0059                     root.parentView.currentIndex = root.gridIndex
0060                     root.parentView.currentItem.forceActiveFocus()
0061                 }
0062             }
0063         }
0064     }
0065 }