Warning, /plasma/drkonqi/src/qml/ReportPage.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 import org.kde.kcmutils as KCM // why ContextualHelpButton is in kcm is anyone's guess
0011 
0012 Kirigami.Page {
0013     id: page
0014 
0015     title: i18nc("@title", "Enter the Details about the Crash")
0016 
0017     property bool isComplete: contentCapacityBar.value >= contentCapacityBar.to
0018 
0019     ColumnLayout {
0020         anchors.fill: parent
0021         Kirigami.Heading {
0022             level: 3
0023             text: i18nc("@info", "Please provide the following information in English.")
0024         }
0025 
0026         ColumnLayout {
0027             RowLayout {
0028                 Kirigami.Heading {
0029                     level: 2
0030                     text: i18nc("@info", "Title of the bug report:")
0031                 }
0032 
0033                 KCM.ContextualHelpButton {
0034                     toolTipText: xi18nc("@info:tooltip examples of good bug report titles",
0035 `<subtitle>Examples of good titles:</subtitle>
0036 <list>
0037 <item>Plasma crashed after adding the Notes widget and writing on it</item>
0038 <item>Konqueror crashed when accessing the Facebook application 'X'</item>
0039 <item>Kopete closed after resuming the computer and talking to a MSN buddy</item>
0040 <item>Kate closed while editing a log file and pressing the Delete key a couple of times</item>
0041 </list>`);
0042                 }
0043             }
0044             QQC2.TextField {
0045                 id: titleField
0046                 // FIXME: use placeholder text instead of heading??
0047                 Layout.fillWidth: true
0048                 onEditingFinished: reportInterface.title = text
0049                 Accessible.name: i18nc("@info", "Title of the bug report:")
0050             }
0051         }
0052 
0053         RowLayout {
0054             Kirigami.Heading {
0055                 level: 2
0056                 text: i18nc("@info", "Information about the crash:")
0057             }
0058 
0059             KCM.ContextualHelpButton {
0060                 toolTipText: xi18nc("@info",
0061 `<subtitle>Describe in as much detail as possible the crash circumstances:</subtitle>
0062 <list>
0063 <item>Detail which actions were you taking inside and outside the application an instant before the crash.</item>
0064 <item>Note if you noticed any unusual behavior in the application or in the whole environment.</item>
0065 <item>Note any non-default configuration in the application</item>
0066 </list>`)
0067             }
0068 
0069             QQC2.Label {
0070                 Layout.fillWidth: true
0071                 horizontalAlignment: Text.AlignRight
0072                 wrapMode: Text.Wrap
0073                 text: {
0074                     if (isComplete) {
0075                         return i18nc("the minimum required length of a text was reached", "Minimum length reached");
0076                     }
0077                     return i18nc("the minimum required length of a text wasn't reached yet", "Provide more information");
0078                 }
0079             }
0080             QQC2.ProgressBar {
0081                 id: contentCapacityBar
0082                 from: 0
0083                 to: {
0084                     const multiplier = (reportInterface.attachToBugNumber == 0) ? 10 : 5
0085                     return 20 + (reportInterface.selectedOptionsRating() * multiplier)
0086                 }
0087                 value: informationField.text.length
0088             }
0089         }
0090         QQC2.ScrollView {
0091             Layout.fillWidth: true
0092             Layout.fillHeight: true
0093 
0094             QQC2.TextArea {
0095                 id: informationField
0096                 wrapMode: TextEdit.Wrap
0097                 onEditingFinished: reportInterface.detailText = text
0098                 Accessible.name: i18nc("@info", "Information about the crash:")
0099             }
0100         }
0101 
0102         Kirigami.Heading {
0103             level: 2
0104             text: i18nc("@info", "Distribution method:")
0105         }
0106         RowLayout {
0107             QQC2.ComboBox {
0108                 id: platformCombo
0109                 model: PlatformModel {
0110                     property bool initialized: false
0111                     manager: bugzilla
0112                     onDetectedPlatformRowChanged: {
0113                         if (initialized) {
0114                             return
0115                         }
0116                         initialized = true
0117                         platformCombo.currentIndex = detectedPlatformRow
0118                     }
0119                 }
0120                 onCurrentValueChanged: {
0121                     if (model.initialized) { // lest we screw up initial platform detection
0122                         DrKonqi.systemInformation.bugzillaPlatform = currentValue
0123                     }
0124                  }
0125             }
0126             QQC2.CheckBox {
0127                 text: i18nc("@option:check", "KDE Platform is compiled from source")
0128                 onCheckedChanged: DrKonqi.systemInformation.compiledSources = checked
0129                 Component.onCompleted: checked = DrKonqi.systemInformation.compiledSources
0130             }
0131         }
0132         QQC2.Label {
0133             Layout.fillWidth: true
0134             wrapMode: Text.Wrap
0135             text: xi18nc("@info", "<note>The crash and system information will be automatically added to the bug report.</note>")
0136         }
0137     }
0138 
0139     footer: FooterActionBar {
0140         enabled: isComplete
0141         actions: [
0142             Kirigami.Action {
0143                 icon.name: "preview"
0144                 text: i18nc("@action:button", "Preview Report")
0145                 onTriggered: pageStack.push("qrc:/ui/PreviewPage.qml")
0146             }
0147         ]
0148     }
0149 
0150     Component.onCompleted: {
0151         if (titleField.visible) {
0152             titleField.forceActiveFocus()
0153         } else {
0154             informationField.forceActiveFocus()
0155         }
0156     }
0157 }