Warning, /plasma/plasma-workspace/kcms/feedback/ui/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
0003     SPDX-FileCopyrightText: 2019 Aleix Pol Gonzalez <aleixpol@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.15
0009 import QtQuick.Layouts 1.1
0010 import QtQuick.Controls 2.3 as QQC2
0011 import org.kde.kirigami 2.6 as Kirigami
0012 import org.kde.userfeedback 1.0 as UserFeedback
0013 import org.kde.userfeedback.kcm 1.0
0014 import org.kde.kcmutils
0015 import org.kde.kcmutils 1.0 as KCMUtils
0016 
0017 SimpleKCM {
0018     id: root
0019 
0020     KCMUtils.ConfigModule.buttons: KCMUtils.ConfigModule.Default | KCMUtils.ConfigModule.Apply
0021 
0022     implicitWidth: Kirigami.Units.gridUnit * 38
0023     implicitHeight: Kirigami.Units.gridUnit * 35
0024 
0025 
0026     ColumnLayout {
0027         spacing: 0
0028 
0029         Kirigami.InlineMessage {
0030             id: infoLabel
0031             Layout.fillWidth: true
0032 
0033             type: Kirigami.MessageType.Information
0034             visible: !form.enabled
0035             text: i18n("User Feedback has been disabled centrally. Please contact your distributor.")
0036         }
0037 
0038         // The system settings window likes to take over
0039         // the cursor with a plain label. The TextEdit
0040         // 'takes priority' over the system settings
0041         // window trying to eat the mouse, allowing
0042         // us to use the HoverHandler boilerplate for
0043         // proper link handling
0044         TextEdit {
0045             Kirigami.FormData.label: i18n("Plasma:")
0046             Layout.fillWidth: true
0047             Layout.topMargin: Kirigami.Units.gridUnit
0048             Layout.leftMargin: Kirigami.Units.gridUnit
0049             Layout.rightMargin: Kirigami.Units.gridUnit
0050             Layout.alignment: Qt.AlignHCenter
0051             wrapMode: Text.WordWrap
0052             text: xi18nc("@info", "You can help KDE improve Plasma by contributing information on how you use it, so we can focus on things that matter to you.<nl/><nl/>Contributing this information is optional and entirely anonymous. We never collect your personal data, files you use, websites you visit, or information that could identify you.<nl/><nl/>You can read about <link url='https://kde.org/privacypolicy-apps.php'>our privacy policy here.</link>")
0053             textFormat: TextEdit.RichText
0054             readOnly: true
0055 
0056             color: Kirigami.Theme.textColor
0057             selectedTextColor: Kirigami.Theme.highlightedTextColor
0058             selectionColor: Kirigami.Theme.highlightColor
0059 
0060             onLinkActivated: (url) => Qt.openUrlExternally(url)
0061 
0062             HoverHandler {
0063                 acceptedButtons: Qt.NoButton
0064                 cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor
0065             }
0066         }
0067 
0068         Kirigami.Separator {
0069             Layout.fillWidth: true
0070             Layout.margins: Kirigami.Units.gridUnit
0071         }
0072 
0073         Kirigami.FormLayout {
0074             id: form
0075             enabled: kcm.feedbackEnabled
0076             QQC2.Slider {
0077                 id: statisticsModeSlider
0078                 Kirigami.FormData.label: i18n("Plasma:")
0079                 readonly property var currentMode: modeOptions[value]
0080                 Layout.fillWidth: true
0081                 Layout.maximumWidth: Kirigami.Units.gridUnit * 22
0082 
0083                 readonly property var modeOptions: [UserFeedback.Provider.NoTelemetry, UserFeedback.Provider.BasicSystemInformation, UserFeedback.Provider.BasicUsageStatistics,
0084                                                     UserFeedback.Provider.DetailedSystemInformation, UserFeedback.Provider.DetailedUsageStatistics]
0085                 from: 0
0086                 to: modeOptions.length - 1
0087                 stepSize: 1
0088                 snapMode: QQC2.Slider.SnapAlways
0089 
0090                 function findIndex(array, what, defaultValue) {
0091                     for (var v in array) {
0092                         if (array[v] == what)
0093                             return v;
0094                     }
0095                     return defaultValue;
0096                 }
0097 
0098                 value: findIndex(modeOptions, kcm.feedbackSettings.feedbackLevel, 0)
0099 
0100                 onMoved: {
0101                     kcm.feedbackSettings.feedbackLevel = modeOptions[value]
0102                 }
0103 
0104                 SettingStateBinding {
0105                     configObject: kcm.feedbackSettings
0106                     settingName: "feedbackLevel"
0107                     extraEnabledConditions: kcm.feedbackEnabled
0108                 }
0109             }
0110 
0111             UserFeedback.FeedbackConfigUiController {
0112                 id: feedbackController
0113                 applicationName: i18n("Plasma")
0114             }
0115 
0116             Kirigami.Heading {
0117                 Layout.fillWidth: true
0118                 Layout.alignment: Qt.AlignHCenter
0119                 Layout.preferredWidth: Kirigami.Units.gridUnit * 22
0120                 Layout.maximumWidth: Kirigami.Units.gridUnit * 29
0121                 wrapMode: Text.WordWrap
0122                 level: 3
0123                 text: feedbackController.telemetryName(statisticsModeSlider.currentMode)
0124                 textFormat: Text.PlainText
0125             }
0126             Item {
0127                 Kirigami.FormData.isSection: true
0128             }
0129             QQC2.Label {
0130                 Layout.fillWidth: true
0131                 Layout.alignment: Qt.AlignHCenter
0132                 Layout.maximumWidth: Kirigami.Units.gridUnit * 22
0133                 wrapMode: Text.WordWrap
0134 
0135                 text: i18n("The following information will be sent:")
0136                 textFormat: Text.PlainText
0137                 visible: statisticsModeSlider.value != 0 // This is "disabled"
0138             }
0139             ColumnLayout {
0140                 Layout.maximumWidth: parent.width * 0.5
0141                 Repeater {
0142                     model: kcm.feedbackSources
0143                     delegate: QQC2.Label {
0144                         visible: modelData.mode <= statisticsModeSlider.currentMode
0145                         text: "ยท " + modelData.description
0146                         textFormat: Text.PlainText
0147                         Layout.fillWidth: true
0148 
0149                         MouseArea {
0150                             anchors.fill: parent
0151                             hoverEnabled: true
0152                             QQC2.ToolTip {
0153                                 width: iconsLayout.implicitWidth + Kirigami.Units.largeSpacing * 2
0154                                 height: iconsLayout.implicitHeight + Kirigami.Units.smallSpacing * 2
0155                                 visible: parent.containsMouse
0156                                 RowLayout {
0157                                     id: iconsLayout
0158                                     Repeater {
0159                                         model: modelData.icons
0160                                         delegate: Kirigami.Icon {
0161                                             implicitHeight: Kirigami.Units.iconSizes.medium
0162                                             implicitWidth: Kirigami.Units.iconSizes.medium
0163                                             source: modelData
0164                                         }
0165                                     }
0166                                 }
0167                             }
0168                         }
0169                     }
0170                 }
0171             }
0172 
0173             Item {
0174                 implicitHeight: Kirigami.Units.largeSpacing
0175                 Layout.fillWidth: true
0176             }
0177             Repeater {
0178                 model: kcm.audits
0179                 delegate: Kirigami.LinkButton {
0180                     Layout.fillWidth: true
0181                     horizontalAlignment: Text.AlignLeft
0182                     Kirigami.FormData.label: model.index === 0 ? i18n("View sent data:") : ""
0183                     text: modelData.program
0184                     onClicked: Qt.openUrlExternally("file://" + modelData.audits)
0185                 }
0186             }
0187         }
0188     }
0189 }
0190