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