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.Layouts 1.15
0006 import QtQuick.Controls 2.15 as QQC2
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     header: QQC2.ToolBar {
0017         visible: page.state !== "loading" && page.state !== "noData"
0018         Kirigami.Theme.colorSet: Kirigami.Theme.Window
0019         contentItem: Kirigami.SearchField {
0020             onAccepted: patientFilterModel.filterString = text
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             filterRole: "ROLE_appName"
0032             sortRole: "modelIndex"
0033             sortOrder: Qt.DescendingOrder
0034         }
0035 
0036         delegate: Kirigami.BasicListItem {
0037             label: modelObject.appName
0038             subtitle: modelObject.dateTime
0039             icon: modelObject.iconName
0040             onClicked: pageStack.push("qrc:/DetailsPage.qml", {patient: modelObject})
0041         }
0042 
0043         Kirigami.PlaceholderMessage {
0044             anchors.centerIn: parent
0045             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0046             visible: page.state === "loading"
0047             icon.name: "search"
0048             text: i18nc("@info place holder for empty listview", "Loading crash reports")
0049         }
0050 
0051         Kirigami.PlaceholderMessage {
0052             anchors.centerIn: parent
0053             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0054             visible: page.state === "noData"
0055             icon.name: "emblem-checked"
0056             text: i18nc("@info place holder for empty listview", "No processes have crashed yet")
0057         }
0058 
0059         Kirigami.PlaceholderMessage {
0060             anchors.centerIn: parent
0061             width: parent.width - (Kirigami.Units.largeSpacing * 4)
0062             visible: page.state === "badSearch"
0063             icon.name: "search"
0064             text: i18nc("@info place holder for empty listview", "No crashes matching the search")
0065         }
0066     }
0067 
0068     states: [
0069         State {
0070             name: "loading"
0071             when: !DrKonqi.PatientModel.ready
0072         },
0073         State {
0074             name: "noData"
0075             when: DrKonqi.PatientModel.count === 0
0076         },
0077         State {
0078             name: "badSearch"
0079             when: patientFilterModel.count === 0
0080         },
0081         State {
0082             name: "" // default state
0083             PropertyChanges { target: view; model: patientFilterModel }
0084         }
0085     ]
0086 }