Index: sources/gui/qml/pages/UserConfirmation.qml =================================================================== diff -u -rd949be21f2a9badd0978dddaaf436f6805de28dc -rbba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a --- sources/gui/qml/pages/UserConfirmation.qml (.../UserConfirmation.qml) (revision d949be21f2a9badd0978dddaaf436f6805de28dc) +++ sources/gui/qml/pages/UserConfirmation.qml (.../UserConfirmation.qml) (revision bba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a) @@ -29,86 +29,95 @@ SettingsBase { id: _root objectName : "UserConfirmation" // SquishQt testability - property bool isPassword : false - property bool showPasswordReEntryField : false - readonly property string password : _password.textInput.text - readonly property string passwordReEntry : _passwordReEntry.textInput.text - property alias message : _message.text + property bool isPassword : false + property bool passwordChangeMode : false + readonly property string passwordCurrent : _passwordCurrent.textInput.text + readonly property string passwordUpdated : _passwordUpdated.textInput.text + readonly property string passwordConfirm : _passwordConfirm.textInput.text + property alias message : _message.text - function clearPasswordReEntry() { - _passwordReEntry.textInput.text = "" + function clearPasswordCurrnet() { _passwordCurrent.textInput.text = "" } + function clearPasswordUpdated() { _passwordUpdated.textInput.text = "" } + function clearPasswordReEntry() { _passwordConfirm.textInput.text = "" } + function clearPasswords () { + clearPasswordCurrnet() + clearPasswordUpdated() + clearPasswordReEntry() } - function clearPassword() { - _password.textInput.text = "" - } + firstFocusInput : isPassword ? _passwordCurrent : undefined - firstFocusInput : isPassword ? _password : undefined - TextEntry { id : _password - clip : true - visible : _root.isPassword - textInput .width : 450 - nextInput : _passwordReEntry + Column { + visible: isPassword + anchors { - top : parent.top - topMargin : { - if(_root.showPasswordReEntryField) { - return topMarginContent + 120 - _passwordReEntry.height - } else { - return topMarginContent + 120 // moved a little down to be more on center and close to keyboard top edge. - } + top : parent.top + horizontalCenter : parent.horizontalCenter + topMargin : passwordChangeMode ? 0 : 120 + } + + PasswordEntry { id: _passwordCurrent + label.text : ! passwordChangeMode ? "" : qsTr("Current") + label.width : ! passwordChangeMode ? 0 : label.width + nextInput : _passwordUpdated + anchors { + top : parent.top + topMargin : topMarginContent + horizontalCenter : parent.horizontalCenter } - horizontalCenter: parent.horizontalCenter } - textInput.inputMethodHints : Qt.ImhNone - textInput.echoMode : TextInput.Password - } - Image { id : _showPassword - visible : _password.visible - anchors.left : _password.right - anchors.leftMargin : Variables.minVGap - anchors.verticalCenter : _password.verticalCenter - width : Variables.iconsDiameter - height : Variables.iconsDiameter - source : "qrc:/images/iEye" - } + PasswordEntry { id: _passwordUpdated + visible : passwordChangeMode + label.text : qsTr("New") + nextInput : _passwordConfirm + anchors { + top : _passwordCurrent.bottom + horizontalCenter : parent.horizontalCenter + } + } - MouseArea { - anchors.fill: _showPassword - anchors.margins: -20 - onPressed : _password.textInput.echoMode = TextInput.Normal - onReleased : _password.textInput.echoMode = TextInput.Password + PasswordEntry { id: _passwordConfirm + visible : passwordChangeMode + label.text : qsTr("Confirm") + anchors { + top : _passwordUpdated.bottom + horizontalCenter : parent.horizontalCenter + } + } } + component PasswordEntry : Item { + property alias textInput: _passwordEntry.textInput + property alias nextInput: _passwordEntry.nextInput + property alias label : _passwordEntry.label - TextEntry { id : _passwordReEntry - clip : true - visible : _root.showPasswordReEntryField - textInput .width : 450 - anchors { - top : _password.bottom - topMargin : height/2 // moved a little down to be more on center and close to keyboard top edge. - horizontalCenter: _password.horizontalCenter + height : 70 + label.width : 150 + + TextEntry { id: _passwordEntry + clip : true + textInput .width : 450 + textInput.inputMethodHints : Qt.ImhNone + textInput.echoMode : TextInput.Password + anchors.horizontalCenter : parent.horizontalCenter } - textInput.inputMethodHints : Qt.ImhNone - textInput.echoMode : TextInput.Password - } - Image { id : _showPasswordReEntryImage - visible : _passwordReEntry.visible - anchors.left : _passwordReEntry.right - anchors.leftMargin : Variables.minVGap - anchors.verticalCenter : _passwordReEntry.verticalCenter - width : Variables.iconsDiameter - height : Variables.iconsDiameter - source : "qrc:/images/iEye" - } + Image { + visible : _passwordEntry.visible + anchors.left : _passwordEntry.right + anchors.leftMargin : Variables.minVGap + anchors.verticalCenter : _passwordEntry.verticalCenter + width : Variables.iconsDiameter + height : Variables.iconsDiameter + source : "qrc:/images/iEye" - MouseArea { - anchors.fill: _showPasswordReEntryImage - anchors.margins: -20 - onPressed : _passwordReEntry.textInput.echoMode = TextInput.Normal - onReleased : _passwordReEntry.textInput.echoMode = TextInput.Password + MouseArea { + anchors.fill: parent + anchors.margins: -20 + onPressed : _passwordEntry.textInput.echoMode = TextInput.Normal + onReleased : _passwordEntry.textInput.echoMode = TextInput.Password + } + } } Text { id : _message Index: sources/gui/qml/pages/settings/SettingsServicePassword.qml =================================================================== diff -u -r7ec98d237f871e5d1206809d309da6d57a086d28 -rbba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a --- sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision 7ec98d237f871e5d1206809d309da6d57a086d28) +++ sources/gui/qml/pages/settings/SettingsServicePassword.qml (.../SettingsServicePassword.qml) (revision bba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a) @@ -30,42 +30,48 @@ property bool isPassword_Accepted : false property bool isDefaultPasswordSet : vSettings.isPasswordSet - onIsDefaultPasswordSetChanged: console.log(isDefaultPasswordSet) + backVisible : ! _GuiView.manufactSetup + title : isDefaultPasswordSet ? qsTr("Service Password") : qsTr("Set Service Password") + isPassword : true + passwordChangeMode : ! isDefaultPasswordSet - backVisible : ! _GuiView.manufactSetup - title : isDefaultPasswordSet ? qsTr("Service Password") : qsTr("Set Service Password") - isPassword : true - showPasswordReEntryField: !isDefaultPasswordSet - onBackClicked : { - clearPassword() - if(!isDefaultPasswordSet){ - clearPasswordReEntry() - } + onBackClicked : { + clearPasswords() _settingsHome.notificationText = "" } + onConfirmClicked: { - isPassword_Accepted = false - let password = _root.password - if ( !isDefaultPasswordSet ) { - let passwordReEntry = _root.passwordReEntry - if ( password != passwordReEntry ) { _root.notificationText = qsTr("Mismatched Password Entry"); return } - if (!vSettings.isPasswordValid(password)) { _root.notificationText = qsTr("Malformed Password Entry" ); return } + // check for password(s), and check the accpeted flag + isPassword_Accepted = checkPassword() - vSettings.updatePassword(password) - _root.isPassword_Accepted = true - _root.notificationText = "" - clearPasswordReEntry() - } else { - if (!vSettings.isPasswordMatch(password)) { _root.notificationText = qsTr("Incorrect service password"); return } + // if not accepted return + if ( ! isPassword_Accepted ) return - _root.isPassword_Accepted = true - _root.notificationText = "" - if ( vSettings.noCANBus ) { // if NoCANBus is set don't wait for HD and go to service mode. - gotoServiceMode(true) - } - } + // of accepted save the password + if ( passwordChangeMode ) vSettings.updatePassword(passwordUpdated) + + // ask HD to go to service mode vAdjustmentServiceMode.doAdjustment() - clearPassword() + + // clear the screen + _root.notificationText = "" + clearPasswords() + + // go back to the settings home/menu screen page(_settingsHome) + + // if NoCANBus is set don't wait for HD and go to service mode. + if ( vSettings.noCANBus ) gotoServiceMode(true) } + + function checkPassword() { + if ( ! vSettings.isPasswordMatch(passwordCurrent ) ) { _root.notificationText = qsTr("Incorrect password" ); return false } + + if ( ! passwordChangeMode ) { _root.notificationText = "" ; return true } + + if ( passwordConfirm != passwordUpdated ) { _root.notificationText = qsTr("Mismatch Passwords" ); return false } + if ( ! vSettings.isPasswordValid(passwordUpdated ) ) { _root.notificationText = qsTr("Invalid Password" ); return false } + + _root.notificationText = "" ; return true + } } Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r9c7a790376d07de7ddaa67e39d47102d68693c87 -rbba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 9c7a790376d07de7ddaa67e39d47102d68693c87) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision bba70435ebe0bbbc9bf5b4282f7d0906a8b49b1a) @@ -54,7 +54,7 @@ firstFocusInput : _ipAddress notificationText: vNetwork.status onConfirmClicked: { - vDateTime.doConfirm( + vNetwork.doConfirm( _ipAddress .textInput.text , _gateway .textInput.text , _subnetmask .textInput.text ,