Warning, /plasma/drkonqi/src/coredump/gui/qml/DetailsPage.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.syntaxhighlighting 1.0
0009
0010 import org.kde.drkonqi.coredump.gui 1.0 as DrKonqi
0011
0012 Kirigami.ScrollablePage {
0013 id: page
0014
0015 property alias patient: detailsLoader.patient
0016 property string text
0017 property string errorText
0018
0019 title: i18nc("@title", "Details")
0020 horizontalScrollBarPolicy: Qt.ScrollBarAsNeeded
0021
0022 Kirigami.Theme.colorSet: Kirigami.Theme.View
0023
0024 actions: [
0025 Kirigami.Action {
0026 enabled: state === ""
0027 icon.name: "edit-copy"
0028 text: i18nc("@action", "Copy to Clipboard")
0029 onTriggered: {
0030 contentLoader.item.selectAll()
0031 contentLoader.item.copy()
0032 }
0033 },
0034 Kirigami.Action {
0035 enabled: patient.canDebug
0036 icon.name: "debug-run"
0037 text: i18nc("@action", "Run Interactive Debugger")
0038 onTriggered: patient.debug()
0039 }
0040 ]
0041
0042 Component {
0043 id: loadingComponent
0044 QQC2.BusyIndicator {
0045 id: indicator
0046 visible: false
0047 running: true
0048
0049 // only show the indicator after a brief timeout otherwise we can have a situtation where loading takes a couple
0050 // milliseconds during which time the indicator flashes up for no good reason
0051 Timer {
0052 running: true
0053 repeat: false
0054 interval: 500
0055 onTriggered: indicator.visible = true
0056 }
0057 }
0058 }
0059
0060 Component {
0061 id: errorComponent
0062
0063 Kirigami.PlaceholderMessage {
0064 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0065 text: page.errorText
0066 icon.name: "data-warning"
0067 }
0068 }
0069
0070 Component {
0071 id: dataComponent
0072
0073 QQC2.TextArea {
0074 id: textfield
0075 Layout.fillWidth: true
0076 Layout.fillHeight: true
0077 readOnly: true
0078 wrapMode: TextEdit.NoWrap
0079 textFormat: TextEdit.PlainText
0080 background.visible: false
0081 font.family: "monospace"
0082 text: page.text
0083 selectByMouse: Kirigami.Settings.isMobile ? false : true
0084
0085 SyntaxHighlighter {
0086 textEdit: textfield
0087 definition: "GDB Backtrace"
0088 }
0089 }
0090 }
0091
0092 Loader {
0093 id: contentLoader
0094
0095 DrKonqi.DetailsLoader {
0096 id: detailsLoader
0097 onDetails: details => text = details
0098 onError: error => {
0099 console.log("error" + error)
0100 errorText = error
0101 }
0102 }
0103 }
0104
0105 states: [
0106 State {
0107 name: "error"
0108 when: errorText !== ""
0109 PropertyChanges { target: contentLoader; sourceComponent: errorComponent }
0110 },
0111 State {
0112 name: "loading"
0113 when: text === ""
0114 PropertyChanges { target: contentLoader; sourceComponent: loadingComponent }
0115 },
0116 State {
0117 name: "" // default state
0118 PropertyChanges { target: contentLoader; sourceComponent: dataComponent }
0119 }
0120 ]
0121 }