Warning, /plasma/drkonqi/src/coredump/gui/qml/ListPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0002 // SPDX-FileCopyrightText: 2020-2022 Harald Sitter <sitter@kde.org>
0003 
0004 import QtQuick 2.15
0005 import QtQuick.Controls as QQC2
0006 import QtQuick.Layouts 1.15
0007 import org.kde.kirigami 2.19 as Kirigami
0008 import org.kde.kitemmodels 1.0 as KItemModels
0009 
0010 import org.kde.drkonqi.coredump.gui 1.0 as DrKonqi
0011 
0012 Kirigami.ScrollablePage {
0013     id: page
0014     title: i18nc("@title", "Crashes")
0015 
0016     actions: [
0017         Kirigami.Action {
0018             displayComponent: Kirigami.SearchField {
0019                 onAccepted: patientFilterModel.filterString = text
0020             }
0021         }
0022     ]
0023 
0024     ListView {
0025         id: view
0026         reuseItems: true // We have a lot of items potentially, recycle them
0027 
0028         KItemModels.KSortFilterProxyModel { // set as model during state change
0029             id: patientFilterModel
0030             sourceModel: DrKonqi.PatientModel
0031             filterRoleName: "ROLE_appName"
0032             sortRoleName: "modelIndex"
0033             sortOrder: Qt.DescendingOrder
0034         }
0035 
0036         delegate: QQC2.ItemDelegate {
0037             id: delegate
0038 
0039             text: modelObject.appName
0040             icon.name: modelObject.iconName
0041 
0042             width: ListView.view.width
0043             onClicked: pageStack.push("qrc:/DetailsPage.qml", {patient: modelObject})
0044 
0045             contentItem: Kirigami.IconTitleSubtitle {
0046                 title: delegate.text
0047                 subtitle: modelObject.dateTime
0048                 icon: icon.fromControlsIcon(delegate.icon)
0049             }
0050         }
0051 
0052         Kirigami.PlaceholderMessage {
0053             anchors.centerIn: parent
0054             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0055             visible: page.state === "loading"
0056             icon.name: "search"
0057             text: i18nc("@info place holder for empty listview", "Loading crash reports")
0058         }
0059 
0060         Kirigami.PlaceholderMessage {
0061             anchors.centerIn: parent
0062             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0063             visible: page.state === "noData"
0064             icon.name: "emblem-checked"
0065             text: i18nc("@info place holder for empty listview", "No processes have crashed yet")
0066         }
0067 
0068         Kirigami.PlaceholderMessage {
0069             anchors.centerIn: parent
0070             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0071             visible: page.state === "badSearch"
0072             icon.name: "search"
0073             text: i18nc("@info place holder for empty listview", "No crashes matching the search")
0074         }
0075     }
0076 
0077     states: [
0078         State {
0079             name: "loading"
0080             when: !DrKonqi.PatientModel.ready
0081         },
0082         State {
0083             name: "noData"
0084             when: DrKonqi.PatientModel.count === 0
0085         },
0086         State {
0087             name: "badSearch"
0088             when: patientFilterModel.count === 0
0089         },
0090         State {
0091             name: "" // default state
0092             PropertyChanges { target: view; model: patientFilterModel }
0093         }
0094     ]
0095 }