Warning, /plasma/drkonqi/src/qml/MainPage.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: 2021-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     property bool canReport: false
0013 
0014     title: CrashedApplication.name
0015 
0016     mainAction: Kirigami.Action {
0017         enabled: Kirigami.Settings.isMobile ? true : canReport
0018         visible: Kirigami.Settings.isMobile ? canReport : true
0019         iconName: "tools-report-bug"
0020         text: i18nc("@action", "Report Bug")
0021         // TODO: could give context on why the button is disabled when canReport is false
0022         tooltip: i18nc("@info:tooltip", "Starts the bug report assistant.")
0023         onTriggered: pageStack.push("qrc:/ui/WelcomePage.qml")
0024     }
0025 
0026     contextualActions: [
0027         Kirigami.Action {
0028             iconName: "system-reboot"
0029             text: i18nc("@action", "Restart Application")
0030             visible: !CrashedApplication.hasBeenRestarted
0031             onTriggered: CrashedApplication.restart()
0032         },
0033         Kirigami.Action {
0034             iconName: "code-class"
0035             text: i18nc("@action", "Developer Information")
0036             onTriggered: pageStack.push("qrc:/ui/DeveloperPage.qml")
0037         }
0038     ]
0039 
0040     ColumnLayout {
0041         anchors.fill: parent
0042 
0043         QQC2.Label {
0044             Layout.fillWidth: true
0045             wrapMode: Text.WordWrap
0046             text: xi18nc("@info", "<para>We are sorry, <application>%1</application> closed unexpectedly.</para>", CrashedApplication.name)
0047         }
0048         QQC2.Label {
0049             Layout.fillWidth: true
0050             wrapMode: Text.WordWrap
0051             onLinkActivated: Qt.openUrlExternally(link)
0052             text: {
0053                 canReport = false
0054 
0055                 if (CrashedApplication.bugReportAddress.length <= 0) {
0056                     return xi18nc("@info",
0057                         '<para>You cannot report this error, because <application>%1</application> does not provide a bug reporting address.</para>',
0058                         CrashedApplication.name);
0059                 }
0060 
0061                 if (CrashedApplication.fakeExecutableBaseName === "drkonqi") {
0062                     return xi18nc("@info",
0063 `<para>As the Crash Handler itself has failed, the
0064 automatic reporting process is disabled to reduce the
0065 risks of failing again.<nl /><nl />
0066 Please, <link url='%1'>manually report</link> this error
0067 to the KDE bug tracking system. Do not forget to include
0068 the backtrace from the <interface>Developer Information</interface>
0069 tab.</para>`,
0070                                 Globals.ownBugzillaUrl);
0071                 }
0072 
0073                 if (DrKonqi.isSafer()) {
0074                     return xi18nc("@info",
0075 `<para>The reporting assistant is disabled because the crash handler dialog was started in safe mode.<nl />
0076 You can manually report this bug to <link>%1</link> (including the backtrace from the <interface>Developer Information</interface> tab.)</para>`,
0077                                 CrashedApplication.bugReportAddress);
0078                 }
0079 
0080                 if (CrashedApplication.hasDeletedFiles) {
0081                     return xi18nc("@info",
0082 `<para>The reporting assistant is disabled because
0083 the crashed application appears to have been updated or
0084 uninstalled since it had been started. This prevents accurate
0085 crash reporting and can also be the cause of this crash.</para>
0086 <para>After updating it is always a good idea to log out and back
0087 in to make sure the update is fully applied and will not cause
0088 any side effects.</para>`);
0089                 }
0090 
0091                 canReport = true
0092                 return xi18nc("@info",
0093                               "<para>You can help us improve KDE Software by reporting this error.<nl /><link url='%1'>Learn more about bug reporting.</link></para>",
0094                                Globals.aboutBugReportingUrl);
0095             }
0096         }
0097         Item {
0098             Layout.fillHeight: true
0099         }
0100         QQC2.Label {
0101             font.bold: true
0102             text: i18nc("@label", "Details:")
0103         }
0104         QQC2.Label {
0105             Layout.fillWidth: true
0106             wrapMode: Text.Wrap
0107             text: xi18nc("@info Note the time information is divided into date and time parts",
0108                          '<para>Executable: <application>%1</application> PID: %2 Signal: %3 (%4) Time: %5</para>',
0109                             CrashedApplication.fakeExecutableBaseName,
0110                             CrashedApplication.pid,
0111                             CrashedApplication.signalName,
0112                             CrashedApplication.signalNumber,
0113                             Qt.formatDateTime(CrashedApplication.datetime))
0114         }
0115     }
0116 }