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
|
||||
width: mainItem.width
|
||||
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 dateString: UtilsCpp.toDateString(dateTime)
|
||||
property string previousDateString: previousItem ? UtilsCpp.toDateString(previousItem.core ? previousItem.core.dateTimeUtc : UtilsCpp.getCurrentDateTimeUtc()) : ''
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ FormItemLayout {
|
|||
property var placeHolder
|
||||
property bool useTitleAsPlaceHolder: true
|
||||
property bool canBeEmpty: true
|
||||
property bool toValidate: false
|
||||
|
||||
property alias hidden: textField.hidden
|
||||
property alias validator: textField.validator
|
||||
|
|
@ -33,6 +34,7 @@ FormItemLayout {
|
|||
propertyOwner: mainItem.propertyOwner
|
||||
canBeEmpty: mainItem.canBeEmpty
|
||||
isValid: mainItem.isValid
|
||||
toValidate: mainItem.toValidate
|
||||
onValidationChecked: (isValid) => {
|
||||
if (isValid) return
|
||||
if (!canBeEmpty && empty) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ Control.TextField {
|
|||
property var isValid: function(text) {
|
||||
return true
|
||||
}
|
||||
property bool toValidate: false
|
||||
property int idleTimeOut: 200
|
||||
property bool empty: mainItem.propertyOwner!= undefined && mainItem.propertyOwner[mainItem.propertyName]?.length == 0
|
||||
property bool canBeEmpty: true
|
||||
|
|
@ -150,7 +151,10 @@ Control.TextField {
|
|||
updateText()
|
||||
}
|
||||
onTextChanged: {
|
||||
idleTimer.restart()
|
||||
if(mainItem.toValidate) {
|
||||
// Restarting
|
||||
idleTimer.restart()
|
||||
}
|
||||
// updateText()
|
||||
}
|
||||
function updateText() {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ MainRightPanel {
|
|||
initialText: contact.core.givenName
|
||||
onTextEdited: contact.core.givenName = text
|
||||
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.down: nameTextField
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ AbstractSettingsLayout {
|
|||
onEditingFinished: {
|
||||
if (text.length != 0) model.core.displayName = text
|
||||
}
|
||||
toValidate: true
|
||||
}
|
||||
Text {
|
||||
text: qsTr("Indicatif international*")
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ AbstractSettingsLayout {
|
|||
propertyOwner: account.core
|
||||
title: qsTr("URI du serveur de messagerie vocale")
|
||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||
toValidate: true
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
|
|
@ -104,12 +105,14 @@ AbstractSettingsLayout {
|
|||
entries: account.core.transports
|
||||
propertyName: "transport"
|
||||
propertyOwner: account.core
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
title: qsTr("URL du serveur mandataire")
|
||||
propertyName: "serverAddress"
|
||||
propertyOwner: account.core
|
||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||
toValidate: true
|
||||
}
|
||||
SwitchSetting {
|
||||
titleText: qsTr("Serveur mandataire sortant")
|
||||
|
|
@ -121,6 +124,7 @@ AbstractSettingsLayout {
|
|||
propertyOwner: account.core
|
||||
title: qsTr("Adresse du serveur STUN")
|
||||
isValid: function(text) { return UtilsCpp.isValidIPAddress(text) || UtilsCpp.isValidHostname(text); }
|
||||
toValidate: true
|
||||
}
|
||||
SwitchSetting {
|
||||
titleText: qsTr("Activer ICE")
|
||||
|
|
@ -143,12 +147,14 @@ AbstractSettingsLayout {
|
|||
title: qsTr("Expiration (en seconde)")
|
||||
canBeEmpty: false
|
||||
isValid: function(text) { return !isNaN(Number(text)); }
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
title: qsTr("URI de l’usine à conversations")
|
||||
propertyName: "conferenceFactoryAddress"
|
||||
propertyOwner: account.core
|
||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
title: qsTr("URI de l’usine à réunions")
|
||||
|
|
@ -156,12 +162,14 @@ AbstractSettingsLayout {
|
|||
propertyOwner: account.core
|
||||
isValid: function(text) { return UtilsCpp.isValidSIPAddress(text); }
|
||||
visible: !SettingsCpp.disableMeetingsFeature
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
title: qsTr("URL du serveur d’échange de clés de chiffrement")
|
||||
propertyName: "limeServerUrl"
|
||||
propertyOwner: account.core
|
||||
isValid: function(text) { return UtilsCpp.isValidURL(text); }
|
||||
toValidate: true
|
||||
}
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import SettingsCpp 1.0
|
|||
|
||||
AbstractSettingsLayout {
|
||||
contentComponent: content
|
||||
width: parent.width
|
||||
width: parent?.width
|
||||
Component {
|
||||
id: content
|
||||
ColumnLayout {
|
||||
|
|
|
|||
|
|
@ -98,17 +98,20 @@ AbstractSettingsLayout {
|
|||
propertyName: "server"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("URL du serveur (ne peut être vide)")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "bindDn"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Bind DN")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "password"
|
||||
hidden: true
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Mot de passe")
|
||||
toValidate: true
|
||||
}
|
||||
SwitchSetting {
|
||||
titleText: qsTr("Utiliser TLS")
|
||||
|
|
@ -119,50 +122,59 @@ AbstractSettingsLayout {
|
|||
propertyName: "baseObject"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Base de recherche (ne peut être vide)")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "filter"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Filtre")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "maxResults"
|
||||
propertyOwner: ldapGui.core
|
||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||
title: qsTr("Nombre maximum de résultats")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "delay"
|
||||
propertyOwner: ldapGui.core
|
||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||
title: qsTr("Délai entre 2 requêtes (en millisecondes)")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "timeout"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Durée maximun (en secondes)")
|
||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "minChars"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Nombre minimum de caractères pour la requête")
|
||||
validator: RegularExpressionValidator { regularExpression: /[0-9]+/ }
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "nameAttribute"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Attributs de nom")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "sipAttribute"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Attributs SIP")
|
||||
toValidate: true
|
||||
}
|
||||
DecoratedTextField {
|
||||
propertyName: "sipDomain"
|
||||
propertyOwner: ldapGui.core
|
||||
title: qsTr("Domaine SIP")
|
||||
toValidate: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue