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