Warning, /plasma/plasma-workspace/applets/systemtray/package/contents/ui/HiddenItemsView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org> 0003 SPDX-FileCopyrightText: 2020 Konrad Materka <materka@gmail.com> 0004 SPDX-FileCopyrightText: 2020 Nate Graham <nate@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 import QtQuick 2.15 0010 import QtQuick.Layouts 1.1 0011 import org.kde.plasma.core as PlasmaCore 0012 import org.kde.plasma.components 3.0 as PlasmaComponents3 0013 import org.kde.plasma.plasmoid 2.0 0014 import org.kde.kitemmodels 1.0 as KItemModels 0015 0016 import "items" 0017 import org.kde.plasma.extras 2.0 as PlasmaExtras 0018 0019 PlasmaComponents3.ScrollView { 0020 id: hiddenTasksView 0021 0022 property alias layout: hiddenTasks 0023 0024 hoverEnabled: true 0025 onHoveredChanged: if (!hovered) { 0026 hiddenTasks.currentIndex = -1; 0027 } 0028 background: null 0029 0030 GridView { 0031 id: hiddenTasks 0032 0033 readonly property int minimumRows: 4 0034 readonly property int minimumColumns: 4 0035 0036 cellWidth: Math.floor(Math.min(hiddenTasksView.availableWidth, popup.Layout.minimumWidth) / minimumRows) 0037 cellHeight: Math.floor(popup.Layout.minimumHeight / minimumColumns) 0038 0039 currentIndex: -1 0040 highlight: PlasmaExtras.Highlight {} 0041 highlightMoveDuration: 0 0042 0043 pixelAligned: true 0044 0045 readonly property int itemCount: model.count 0046 0047 //! This is used in order to identify the minimum required label height in order for all 0048 //! labels to be aligned properly at all items. At the same time this approach does not 0049 //! enforce labels with 3 lines at all cases so translations that require only one or two 0050 //! lines will always look consistent with no too much padding 0051 readonly property int minLabelHeight: { 0052 var minHeight = 0; 0053 0054 for(let i in contentItem.children){ 0055 var gridItem = contentItem.children[i]; 0056 if (!gridItem || !gridItem.hasOwnProperty("item") || !gridItem.item.hasOwnProperty("labelHeight")) { 0057 continue; 0058 } 0059 0060 if (gridItem.item.labelHeight > minHeight) { 0061 minHeight = gridItem.item.labelHeight; 0062 } 0063 } 0064 0065 return minHeight; 0066 } 0067 0068 model: KItemModels.KSortFilterProxyModel { 0069 sourceModel: Plasmoid.systemTrayModel 0070 filterRoleName: "effectiveStatus" 0071 filterRowCallback: (sourceRow, sourceParent) => { 0072 let value = sourceModel.data(sourceModel.index(sourceRow, 0, sourceParent), filterRole); 0073 return value === PlasmaCore.Types.PassiveStatus 0074 } 0075 } 0076 delegate: ItemLoader { 0077 width: hiddenTasks.cellWidth 0078 height: hiddenTasks.cellHeight 0079 minLabelHeight: hiddenTasks.minLabelHeight 0080 } 0081 0082 keyNavigationEnabled: true 0083 activeFocusOnTab: true 0084 0085 KeyNavigation.up: hiddenTasksView.KeyNavigation.up 0086 0087 onActiveFocusChanged: { 0088 if (activeFocus && currentIndex === -1) { 0089 currentIndex = 0 0090 } else if (!activeFocus && currentIndex >= 0) { 0091 currentIndex = -1 0092 } 0093 } 0094 } 0095 }