mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 15:46:44 +00:00
GODT-22: Frontend-backend
- GODT-1246 Implement settings view.
- GODT-1257 GODT-1246: Account and Help view
- GODT-1298: Minimal working build (panics)
- GODT-1298: loading QML (needs Popup window)
- GODT-1298: WARN: Adding PopupWindow not possible!
In therecipe qt the `quickwidgets` classes are within `quick` module, but
forgot to add library and include paths into cgo flags. Therefore
compilation fails and it would be hard to patch therecipe in order to
fix it.
I am not sure if rewrite PopupWindow into go would make any difference,
therefore I decided to use normal QML Window without borders.
- GODT-1298: Rework status window, add backend props, slots and signals.
- GODT-1298: Users
- GODT-1298: Login
- GODT-1298: WIP Help and bug report
- GODT-1178: MacOS dock icon control
- GODT-1298: Help, bug report, update and events
- GODT-1298: Apple Mail config and Settings (without cache on disk)
This commit is contained in:
167
internal/frontend/qml/BugReportView.qml
Normal file
167
internal/frontend/qml/BugReportView.qml
Normal file
@ -0,0 +1,167 @@
|
||||
// Copyright (c) 2021 Proton Technologies AG
|
||||
//
|
||||
// This file is part of ProtonMail Bridge.
|
||||
//
|
||||
// ProtonMail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ProtonMail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import QtQuick 2.13
|
||||
import QtQuick.Layouts 1.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
import Proton 4.0
|
||||
|
||||
SettingsView {
|
||||
id: root
|
||||
|
||||
property var selectedAddress
|
||||
|
||||
Label {
|
||||
text: qsTr("Report a problem")
|
||||
colorScheme: root.colorScheme
|
||||
type: Label.Heading
|
||||
}
|
||||
|
||||
|
||||
TextArea {
|
||||
id: description
|
||||
property int _minChars: 150
|
||||
property bool _inputOK: description.text.length>=description._minChars
|
||||
|
||||
label: qsTr("Description")
|
||||
colorScheme: root.colorScheme
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: 100
|
||||
hint: description.text.length + "/800"
|
||||
placeholderText: qsTr("Tell us what went wrong or isn't working (min. 150 characters).")
|
||||
onEditingFinished: {
|
||||
if (!description._inputOK) {
|
||||
description.error = true
|
||||
description.assistiveText = qsTr("Enter a problem description (min. 150 characters)")
|
||||
} else {
|
||||
description.error = false
|
||||
description.assistiveText = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TextField {
|
||||
id: address
|
||||
property bool _inputOK: root.isValidEmail(address.text)
|
||||
|
||||
label: qsTr("Your contact email")
|
||||
colorScheme: root.colorScheme
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("e.g. jane.doe@protonmail.com")
|
||||
|
||||
onEditingFinished: {
|
||||
if (!address._inputOK) {
|
||||
address.error = true
|
||||
address.assistiveText = qsTr("Enter valid email address")
|
||||
} else {
|
||||
address.assistiveText = ""
|
||||
address.error = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: emailClient
|
||||
property bool _inputOK: emailClient.text.length > 0
|
||||
|
||||
label: qsTr("Your email client (including version)")
|
||||
colorScheme: root.colorScheme
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr("e.g. Apple Mail 14.0")
|
||||
onEditingFinished: {
|
||||
if (!emailClient._inputOK) {
|
||||
emailClient.assistiveText = qsTr("Enter an email client name and version")
|
||||
emailClient.error = true
|
||||
} else {
|
||||
emailClient.assistiveText = ""
|
||||
emailClient.error = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RowLayout {
|
||||
CheckBox {
|
||||
id: includeLogs
|
||||
text: qsTr("Include my recent logs")
|
||||
colorScheme: root.colorScheme
|
||||
checked: true
|
||||
}
|
||||
Button {
|
||||
Layout.leftMargin: 12
|
||||
text: qsTr("View logs")
|
||||
secondary: true
|
||||
colorScheme: root.colorScheme
|
||||
onClicked: Qt.openUrlExternally("file://"+root.backend.logsPath)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
text: {
|
||||
var address = "bridge@protonmail.com"
|
||||
var mailTo = `<a href="mailto://${address}">${address}</a>`
|
||||
return qsTr("These reports are not end-to-end encrypted. In case of sensitive information, contact us at %1.").arg(mailTo)
|
||||
}
|
||||
colorScheme: root.colorScheme
|
||||
Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
type: Label.Caption
|
||||
color: root.colorScheme.text_weak
|
||||
}
|
||||
|
||||
Button {
|
||||
id: sendButton
|
||||
text: qsTr("Send")
|
||||
colorScheme: root.colorScheme
|
||||
onClicked: root.submit()
|
||||
enabled: description._inputOK && address._inputOK && emailClient._inputOK
|
||||
|
||||
Connections {target: root.backend; onReportBugFinished: sendButton.loading = false }
|
||||
}
|
||||
|
||||
function setDefaultValue() {
|
||||
description.text = ""
|
||||
address.text = root.selectedAddress
|
||||
emailClient.text = root.backend.currentEmailClient
|
||||
includeLogs.checked = true
|
||||
}
|
||||
|
||||
function isValidEmail(text){
|
||||
var reEmail = /\w+@\w+\.\w+/
|
||||
return reEmail.test(text)
|
||||
}
|
||||
|
||||
function submit() {
|
||||
sendButton.loading = true
|
||||
root.backend.reportBug(
|
||||
description.text,
|
||||
address.text,
|
||||
emailClient.text,
|
||||
includeLogs.checked
|
||||
)
|
||||
}
|
||||
|
||||
Component.onCompleted: root.setDefaultValue()
|
||||
|
||||
|
||||
onBack: {
|
||||
root.setDefaultValue()
|
||||
root.parent.showHelpView()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user