Warning, /plasma/drkonqi/src/qml/main.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 org.kde.kirigami 2.19 as Kirigami
0007 
0008 import org.kde.drkonqi 1.0
0009 
0010 Kirigami.ApplicationWindow {
0011     id: appWindow
0012 
0013     property var reportInterface: ReportInterface
0014     property var bugzilla: reportInterface.bugzilla
0015     property bool canReport: false // can file a bug report
0016     property bool canAutoReport: false // can file a sentry report
0017     readonly property bool generatorFailure: BacktraceGenerator.hasAnyFailure
0018 
0019     property string canReportText: {
0020         canReport = false
0021         canAutoReport = false
0022 
0023         if (CrashedApplication.bugReportAddress.length <= 0) {
0024             return xi18nc("@info",
0025                 '<para>You cannot report this error, because <application>%1</application> does not provide a bug reporting address.</para>',
0026                 CrashedApplication.name);
0027         }
0028 
0029         if (CrashedApplication.fakeExecutableBaseName === "drkonqi") {
0030             canAutoReport = true
0031             return xi18nc("@info",
0032 `<para>As the Crash Handler itself has failed, the
0033 automatic reporting process is disabled to reduce the
0034 risks of failing again.<nl /><nl />
0035 Please, <link url='%1'>manually report</link> this error
0036 to the KDE bug tracking system. Do not forget to include
0037 the backtrace from the <interface>Developer Information</interface>
0038 page.</para>`,
0039                         Globals.ownBugzillaUrl);
0040         }
0041 
0042         if (DrKonqi.isSafer()) {
0043             return xi18nc("@info",
0044 `<para>The reporting assistant is disabled because the crash handler dialog was started in safe mode.<nl />
0045 You can manually report this bug to <link>%1</link> (including the backtrace from the <interface>Developer Information</interface> page.)</para>`,
0046                         CrashedApplication.bugReportAddress);
0047         }
0048 
0049         if (CrashedApplication.hasDeletedFiles) {
0050             return xi18nc("@info",
0051 `<para>The reporting assistant is disabled because
0052 the crashed application appears to have been updated or
0053 uninstalled since it had been started. This prevents accurate
0054 crash reporting and can also be the cause of this crash.</para>
0055 <para>After updating it is always a good idea to log out and back
0056 in to make sure the update is fully applied and will not cause
0057 any side effects.</para>`);
0058         }
0059 
0060         canReport = true
0061         canAutoReport = true
0062         return xi18nc("@info",
0063                         "<para>You can help us improve KDE Software by reporting this error.<nl /><link url='%1'>Learn more about bug reporting.</link></para>",
0064                         Globals.aboutBugReportingUrl);
0065     }
0066 
0067     pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.ToolBar
0068     pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.ShowBackButton | Kirigami.ApplicationHeaderStyle.ShowForwardButton
0069 
0070     title: CrashedApplication.name
0071     minimumWidth: Kirigami.Settings.isMobile ? 0 : Kirigami.Units.gridUnit * 30
0072     minimumHeight: Kirigami.Settings.isMobile ? 0 : Kirigami.Units.gridUnit * 22
0073     height: minimumHeight
0074 
0075     header: generatorFailure ? warningComponent.createObject(appWindow) : null
0076 
0077     contextDrawer: Kirigami.ContextDrawer {
0078         id: contextDrawer
0079     }
0080 
0081     Component {
0082         id: warningComponent
0083         Kirigami.InlineMessage {
0084             text: i18nc("@label", "Gathering crash information failed for unknown reasons. You can retry, or close the window.")
0085             type: Kirigami.MessageType.Warning
0086             visible: true
0087             actions: [
0088                 Kirigami.Action {
0089                     text: i18nc("@action retry gathering crash data", "Retry")
0090                     onTriggered: BacktraceGenerator.start()
0091                 }
0092             ]
0093         }
0094     }
0095 
0096     pageStack.initialPage: MainPage {}
0097     pageStack.defaultColumnWidth: appWindow.width // show single page
0098 
0099     function goToSentry() {
0100         pageStack.replace("qrc:/ui/SentryPage.qml")
0101     }
0102 }