Fix idle timeout validation on text fields. Use it in settings (todo: rework the validation)
Fix contact first name error border.
This commit is contained in:
parent
5c52ef225e
commit
502433ea6d
8 changed files with 31 additions and 4 deletions
|
|
@ -65,7 +65,7 @@ ListView {
|
||||||
height: 63 * DefaultStyle.dp + topOffset
|
height: 63 * DefaultStyle.dp + topOffset
|
||||||
width: mainItem.width
|
width: mainItem.width
|
||||||
property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null
|
property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null
|
||||||
property var dateTime: $modelData && $modelData.core.haveModel ? $modelData.core.dateTime : UtilsCpp.getCurrentDateTime()
|
property var dateTime: !!$modelData && $modelData.core.haveModel ? $modelData.core.dateTime : UtilsCpp.getCurrentDateTime()
|
||||||
property string day : UtilsCpp.toDateDayNameString(dateTime)
|
property string day : UtilsCpp.toDateDayNameString(dateTime)
|
||||||
property string dateString: UtilsCpp.toDateString(dateTime)
|
property string dateString: UtilsCpp.toDateString(dateTime)
|
||||||
property string previousDateString: previousItem ? UtilsCpp.toDateString(previousItem.core ? previousItem.core.dateTimeUtc : UtilsCpp.getCurrentDateTimeUtc()) : ''
|
property string previousDateString: previousItem ? UtilsCpp.toDateString(previousItem.core ? previousItem.core.dateTimeUtc : UtilsCpp.getCurrentDateTimeUtc()) : ''
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ FormItemLayout {
|
||||||
property var placeHolder
|
property var placeHolder
|
||||||
property bool useTitleAsPlaceHolder: true
|
property bool useTitleAsPlaceHolder: true
|
||||||
property bool canBeEmpty: true
|
property bool canBeEmpty: true
|
||||||
|
property bool toValidate: false
|
||||||
|
|
||||||
property alias hidden: textField.hidden
|
property alias hidden: textField.hidden
|
||||||
property alias validator: textField.validator
|
property alias validator: textField.validator
|
||||||
|
|
@ -33,6 +34,7 @@ FormItemLayout {
|
||||||
propertyOwner: mainItem.propertyOwner
|
propertyOwner: mainItem.propertyOwner
|
||||||
canBeEmpty: mainItem.canBeEmpty
|
canBeEmpty: mainItem.canBeEmpty
|
||||||
isValid: mainItem.isValid
|
isValid: mainItem.isValid
|
||||||
|
toValidate: mainItem.toValidate
|
||||||
onValidationChecked: (isValid) => {
|
onValidationChecked: (isValid) => {
|
||||||
if (isValid) return
|
if (isValid) return
|
||||||
if (!canBeEmpty && empty) {
|
if (!canBeEmpty && empty) {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ Control.TextField {
|
||||||
property var isValid: function(text) {
|
property var isValid: function(text) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
property bool toValidate: false
|
||||||
property int idleTimeOut: 200
|
property int idleTimeOut: 200
|
||||||
property bool empty: mainItem.propertyOwner!= undefined && mainItem.propertyOwner[mainItem.propertyName]?.length == 0
|
property bool empty: mainItem.propertyOwner!= undefined && mainItem.propertyOwner[mainItem.propertyName]?.length == 0
|
||||||
property bool canBeEmpty: true
|
property bool canBeEmpty: true
|
||||||
|
|
@ -150,7 +151,10 @@ Control.TextField {
|
||||||
updateText()
|
updateText()
|
||||||
}
|
}
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
idleTimer.restart()
|
if(mainItem.toValidate) {
|
||||||
|
// Restarting
|
||||||
|
idleTimer.restart()
|
||||||
|
}
|
||||||
// updateText()
|
// updateText()
|
||||||
}
|
}
|
||||||
function updateText() {
|
function updateText() {
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ MainRightPanel {
|
||||||
initialText: contact.core.givenName
|
initialText: contact.core.givenName
|
||||||
onTextEdited: contact.core.givenName = text
|
onTextEdited: contact.core.givenName = text
|
||||||
backgroundColor: DefaultStyle.grey_0
|
backgroundColor: DefaultStyle.grey_0
|
||||||
backgroundBorderColor: givenName.errorTextItem.opacity != 0 ? DefaultStyle.danger_500main : DefaultStyle.grey_200
|
backgroundBorderColor: givenName.errorTextVisible ? DefaultStyle.danger_500main : DefaultStyle.grey_200
|
||||||
KeyNavigation.up: editButton.visible ? editButton : addPictureButton
|
KeyNavigation.up: editButton.visible ? editButton : addPictureButton
|
||||||
KeyNavigation.down: nameTextField
|
KeyNavigation.down: nameTextField
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ AbstractSettingsLayout {
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
if (text.length != 0) model.core.displayName = text
|
if (text.length != 0) model.core.displayName = text
|
||||||
}
|
}
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Indicatif international*")
|
text: qsTr("Indicatif international*")
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ AbstractSettingsLayout {
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
title: qsTr("URI du serveur de messagerie vocale")
|
title: qsTr("URI du serveur de messagerie vocale")
|
||||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
@ -104,12 +105,14 @@ AbstractSettingsLayout {
|
||||||
entries: account.core.transports
|
entries: account.core.transports
|
||||||
propertyName: "transport"
|
propertyName: "transport"
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
title: qsTr("URL du serveur mandataire")
|
title: qsTr("URL du serveur mandataire")
|
||||||
propertyName: "serverAddress"
|
propertyName: "serverAddress"
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
SwitchSetting {
|
SwitchSetting {
|
||||||
titleText: qsTr("Serveur mandataire sortant")
|
titleText: qsTr("Serveur mandataire sortant")
|
||||||
|
|
@ -121,6 +124,7 @@ AbstractSettingsLayout {
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
title: qsTr("Adresse du serveur STUN")
|
title: qsTr("Adresse du serveur STUN")
|
||||||
isValid: function(text) { return UtilsCpp.isValidIPAddress(text) || UtilsCpp.isValidHostname(text); }
|
isValid: function(text) { return UtilsCpp.isValidIPAddress(text) || UtilsCpp.isValidHostname(text); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
SwitchSetting {
|
SwitchSetting {
|
||||||
titleText: qsTr("Activer ICE")
|
titleText: qsTr("Activer ICE")
|
||||||
|
|
@ -143,12 +147,14 @@ AbstractSettingsLayout {
|
||||||
title: qsTr("Expiration (en seconde)")
|
title: qsTr("Expiration (en seconde)")
|
||||||
canBeEmpty: false
|
canBeEmpty: false
|
||||||
isValid: function(text) { return !isNaN(Number(text)); }
|
isValid: function(text) { return !isNaN(Number(text)); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
title: qsTr("URI de l’usine à conversations")
|
title: qsTr("URI de l’usine à conversations")
|
||||||
propertyName: "conferenceFactoryAddress"
|
propertyName: "conferenceFactoryAddress"
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
title: qsTr("URI de l’usine à réunions")
|
title: qsTr("URI de l’usine à réunions")
|
||||||
|
|
@ -156,12 +162,14 @@ AbstractSettingsLayout {
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||||
visible: !SettingsCpp.disableMeetingsFeature
|
visible: !SettingsCpp.disableMeetingsFeature
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
title: qsTr("URL du serveur d’échange de clés de chiffrement")
|
title: qsTr("URL du serveur d’échange de clés de chiffrement")
|
||||||
propertyName: "limeServerUrl"
|
propertyName: "limeServerUrl"
|
||||||
propertyOwner: account.core
|
propertyOwner: account.core
|
||||||
isValid: function(text) { return UtilsCpp.isValidURL(text); }
|
isValid: function(text) { return UtilsCpp.isValidURL(text); }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import SettingsCpp 1.0
|
||||||
|
|
||||||
AbstractSettingsLayout {
|
AbstractSettingsLayout {
|
||||||
contentComponent: content
|
contentComponent: content
|
||||||
width: parent.width
|
width: parent?.width
|
||||||
Component {
|
Component {
|
||||||
id: content
|
id: content
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
||||||
|
|
@ -98,17 +98,20 @@ AbstractSettingsLayout {
|
||||||
propertyName: "server"
|
propertyName: "server"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("URL du serveur (ne peut être vide)")
|
title: qsTr("URL du serveur (ne peut être vide)")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "bindDn"
|
propertyName: "bindDn"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Bind DN")
|
title: qsTr("Bind DN")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "password"
|
propertyName: "password"
|
||||||
hidden: true
|
hidden: true
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Mot de passe")
|
title: qsTr("Mot de passe")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
SwitchSetting {
|
SwitchSetting {
|
||||||
titleText: qsTr("Utiliser TLS")
|
titleText: qsTr("Utiliser TLS")
|
||||||
|
|
@ -119,50 +122,59 @@ AbstractSettingsLayout {
|
||||||
propertyName: "baseObject"
|
propertyName: "baseObject"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Base de recherche (ne peut être vide)")
|
title: qsTr("Base de recherche (ne peut être vide)")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "filter"
|
propertyName: "filter"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Filtre")
|
title: qsTr("Filtre")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "maxResults"
|
propertyName: "maxResults"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||||
title: qsTr("Nombre maximum de résultats")
|
title: qsTr("Nombre maximum de résultats")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "delay"
|
propertyName: "delay"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||||
title: qsTr("Délai entre 2 requêtes (en millisecondes)")
|
title: qsTr("Délai entre 2 requêtes (en millisecondes)")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "timeout"
|
propertyName: "timeout"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Durée maximun (en secondes)")
|
title: qsTr("Durée maximun (en secondes)")
|
||||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "minChars"
|
propertyName: "minChars"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Nombre minimum de caractères pour la requête")
|
title: qsTr("Nombre minimum de caractères pour la requête")
|
||||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "nameAttribute"
|
propertyName: "nameAttribute"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Attributs de nom")
|
title: qsTr("Attributs de nom")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "sipAttribute"
|
propertyName: "sipAttribute"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Attributs SIP")
|
title: qsTr("Attributs SIP")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
DecoratedTextField {
|
DecoratedTextField {
|
||||||
propertyName: "sipDomain"
|
propertyName: "sipDomain"
|
||||||
propertyOwner: ldapGui.core
|
propertyOwner: ldapGui.core
|
||||||
title: qsTr("Domaine SIP")
|
title: qsTr("Domaine SIP")
|
||||||
|
toValidate: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue