forked from Silverfish/proton-bridge
GODT-1314: Limit description field length within 150/800 bounds
This commit is contained in:
@ -35,24 +35,34 @@ SettingsView {
|
||||
|
||||
TextArea {
|
||||
id: description
|
||||
property int _minChars: 150
|
||||
property bool _inputOK: description.text.length>=description._minChars
|
||||
property int _minLength: 150
|
||||
property int _maxLength: 800
|
||||
property bool _inputOK: description.text.length>=description._minLength && description.text.length<=description._maxLength
|
||||
|
||||
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).")
|
||||
hint: description.text.length + "/" + _maxLength
|
||||
placeholderText: qsTr("Tell us what went wrong or isn't working (min. %1 characters).").arg(_minLength)
|
||||
|
||||
onEditingFinished: {
|
||||
if (!description._inputOK) {
|
||||
description.error = true
|
||||
description.assistiveText = qsTr("Enter a problem description (min. 150 characters)")
|
||||
if (description.text.length <= description._minLength) {
|
||||
description.assistiveText = qsTr("Enter a problem description (min. %1 characters).").arg(_minLength)
|
||||
} else {
|
||||
description.assistiveText = qsTr("Enter a problem description (max. %1 characters).").arg(_maxLength)
|
||||
}
|
||||
} else {
|
||||
description.error = false
|
||||
description.assistiveText = ""
|
||||
}
|
||||
}
|
||||
onTextChanged: {
|
||||
description.error = false
|
||||
description.assistiveText = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -74,6 +84,10 @@ SettingsView {
|
||||
address.error = false
|
||||
}
|
||||
}
|
||||
onTextChanged: {
|
||||
address.error = false
|
||||
address.assistiveText = ""
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
@ -84,6 +98,7 @@ SettingsView {
|
||||
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")
|
||||
@ -93,6 +108,10 @@ SettingsView {
|
||||
emailClient.error = false
|
||||
}
|
||||
}
|
||||
onTextChanged: {
|
||||
emailClient.error = false
|
||||
emailClient.assistiveText = ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -137,8 +156,17 @@ SettingsView {
|
||||
|
||||
function setDefaultValue() {
|
||||
description.text = ""
|
||||
description.error = false
|
||||
description.assistiveText = ""
|
||||
|
||||
address.text = root.selectedAddress
|
||||
address.error = false
|
||||
address.assistiveText = ""
|
||||
|
||||
emailClient.text = root.backend.currentEmailClient
|
||||
emailClient.error = false
|
||||
emailClient.assistiveText = ""
|
||||
|
||||
includeLogs.checked = true
|
||||
}
|
||||
|
||||
@ -159,9 +187,7 @@ SettingsView {
|
||||
|
||||
Component.onCompleted: root.setDefaultValue()
|
||||
|
||||
|
||||
onBack: {
|
||||
onVisibleChanged: {
|
||||
root.setDefaultValue()
|
||||
root.parent.showHelpView()
|
||||
}
|
||||
}
|
||||
|
||||
@ -284,27 +284,47 @@ Item {
|
||||
colorScheme: root.colorScheme
|
||||
backend: root.backend
|
||||
notifications: root.notifications
|
||||
|
||||
onBack: {
|
||||
rightContent.showAccount()
|
||||
}
|
||||
}
|
||||
|
||||
PortSettings { // 3
|
||||
colorScheme: root.colorScheme
|
||||
backend: root.backend
|
||||
|
||||
onBack: {
|
||||
rightContent.showGeneralSettings()
|
||||
}
|
||||
}
|
||||
|
||||
SMTPSettings { // 4
|
||||
colorScheme: root.colorScheme
|
||||
backend: root.backend
|
||||
|
||||
onBack: {
|
||||
rightContent.showGeneralSettings()
|
||||
}
|
||||
}
|
||||
|
||||
LocalCacheSettings { // 5
|
||||
colorScheme: root.colorScheme
|
||||
backend: root.backend
|
||||
notifications: root.notifications
|
||||
|
||||
onBack: {
|
||||
rightContent.showGeneralSettings()
|
||||
}
|
||||
}
|
||||
|
||||
HelpView { // 6
|
||||
colorScheme: root.colorScheme
|
||||
backend: root.backend
|
||||
|
||||
onBack: {
|
||||
rightContent.showAccount()
|
||||
}
|
||||
}
|
||||
|
||||
BugReportView { // 7
|
||||
@ -317,6 +337,10 @@ Item {
|
||||
if (!user) return ""
|
||||
return user.addresses[0]
|
||||
}
|
||||
|
||||
onBack: {
|
||||
rightContent.showHelpView()
|
||||
}
|
||||
}
|
||||
|
||||
function showAccount () { rightContent.currentIndex = 0 }
|
||||
|
||||
@ -180,6 +180,4 @@ SettingsView {
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
onBack: root.parent.showAccount()
|
||||
}
|
||||
|
||||
@ -111,8 +111,4 @@ SettingsView {
|
||||
|
||||
onLinkActivated: Qt.openUrlExternally(link)
|
||||
}
|
||||
|
||||
onBack: {
|
||||
root.parent.showAccount()
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,6 @@ SettingsView {
|
||||
}
|
||||
|
||||
onBack: {
|
||||
root.parent.showGeneralSettings()
|
||||
root.setDefaultValues()
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,6 @@ SettingsView {
|
||||
}
|
||||
|
||||
onBack: {
|
||||
root.parent.showGeneralSettings()
|
||||
root.setDefaultValues()
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,6 @@ SettingsView {
|
||||
}
|
||||
|
||||
onBack: {
|
||||
root.parent.showGeneralSettings()
|
||||
root.setDefaultValues()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user