Warning, /plasma/drkonqi/src/qml/SendingPage.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: 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
0009 import org.kde.drkonqi 1.0
0010
0011 Kirigami.Page {
0012 id: page
0013
0014 Connections {
0015 target: reportInterface
0016 function onDone(number) {
0017 pageStack.replace("qrc:/ui/SentPage.qml", {bugNumber: reportInterface.sentReport})
0018 }
0019 function onSendReportError(msg) {
0020 console.log("ERRROR" + msg)
0021 // TODO should going back be a thing?
0022 // pageStack.globalToolBar.showNavigationButtons = Kirigami.ApplicationHeaderStyle.Auto
0023 inlineMessage.errorContext = msg
0024 page.state = "error"
0025 }
0026 }
0027
0028 Connections {
0029 target: bugzilla
0030 function onLoginFinished() {
0031 console.log("login success")
0032 reportInterface.sendBugReport()
0033 }
0034 function onLoginError(msg) {
0035 console.log("login ERRROR " + msg)
0036 inlineMessage.errorContext = msg
0037 page.state = "error"
0038 }
0039 }
0040
0041 actions: [
0042 Kirigami.Action {
0043 visible: page.state === "error"
0044 icon.name: "document-save"
0045 text: i18nc("@action:button", "Save Report to File")
0046 tooltip: xi18nc("@info:tooltip", 'Use this button to save the crash information to a file for manual reporting.')
0047 onTriggered: DrKonqi.saveReport(reportInterface.generateReportFullText(ReportInterface.DrKonqiStamp.Include, ReportInterface.Backtrace.Complete))
0048 }
0049 ]
0050
0051 ColumnLayout {
0052 anchors.fill: parent
0053 visible: page.state === "error"
0054
0055 Kirigami.InlineMessage {
0056 id: inlineMessage
0057
0058 property string errorContext: ""
0059
0060 Layout.fillWidth: true
0061 visible: true
0062 type: Kirigami.MessageType.Error
0063 text: xi18nc("@info", "Failed to submit bug report: <message>%1</message>", errorContext)
0064 actions: [
0065 Kirigami.Action {
0066 icon.name: "document-send"
0067 text: i18nc("@action retry submitting bug report", "Retry Submission")
0068 onTriggered: {
0069 inlineMessage.errorContext = ""
0070 bugzilla.refreshToken()
0071 }
0072 }
0073 ]
0074 }
0075 }
0076
0077 Kirigami.PlaceholderMessage {
0078 visible: page.state === ""
0079 anchors.centerIn: parent
0080 width: parent.width - (Kirigami.Units.largeSpacing * 4)
0081 text: i18nc("@info", "Submitting bug report...")
0082
0083 QQC2.BusyIndicator {
0084 Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
0085 }
0086 }
0087
0088 Component.onCompleted: {
0089 // Disable navigation from here on out, the report can't be changed anymore!
0090 pageStack.globalToolBar.showNavigationButtons = Kirigami.ApplicationHeaderStyle.NoNavigationButtons
0091
0092 // Trigger relogin. If the user took a long time to prepare the login our
0093 // token might have gone invalid in the meantime. As a cheap way to prevent
0094 // this we'll simply refresh the token regardless. It's plenty cheap and
0095 // should reliably ensure that the token is current.
0096 // Disconnect everything first though, this function may get called a bunch
0097 // of times, so we don't want duplicated submissions.
0098 bugzilla.refreshToken();
0099 }
0100
0101 states: [
0102 State {
0103 name: "error"
0104 },
0105 State {
0106 name: "" // default state
0107 }
0108 ]
0109 }