Index: sources/gui/qml/pages/settings/SettingsWiFi.qml =================================================================== diff -u -r56ad953ae404fcf6956bd4f76b7a54b12d0285d3 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 56ad953ae404fcf6956bd4f76b7a54b12d0285d3) +++ sources/gui/qml/pages/settings/SettingsWiFi.qml (.../SettingsWiFi.qml) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file SettingsWiFi.qml - * \author (last) Peter Lucia - * \date (last) 23-Sept-2020 - * \author (original) Peter Lucia - * \date (original) 23-Sept-2020 + * \author (last) Behrouz NematiPour + * \date (last) 03-Apr-2023 + * \author (original) Behrouz NematiPour + * \date (original) 06-May-2021 * */ @@ -28,7 +28,8 @@ * \brief SettingsWiFi * The settings screen to setup the WiFi connection */ -SettingsBase { id: _root +SettingsBase { id: _root + itemIndex : SettingsStack.WiFi property var ipValidator: RegExpValidator { regExp:/^(([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}([01]?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$/ @@ -43,17 +44,17 @@ readonly property int topMargin : topMarginContent - 40 // moved up to top of the keyboard readonly property bool isValid : - _ipAddress .textInput.acceptableInput && - _gateway .textInput.acceptableInput && - _subnetmask .textInput.acceptableInput && - _dns .textInput.acceptableInput + _ipAddress .textInput.acceptableInput + && _gateway .textInput.acceptableInput + && _subnetmask .textInput.acceptableInput + && _dns .textInput.acceptableInput confirmEnabled : isValid confirmVisible : false // since the static setting is done one by one seems confirm is not needed for now. firstFocusInput : _ipAddress notificationText: vNetwork.status onConfirmClicked: { - vDateTime.doConfirm( + vNetwork.doConfirm( _ipAddress .textInput.text , _gateway .textInput.text , _subnetmask .textInput.text , @@ -67,40 +68,40 @@ anchors.leftMargin : _root.leftMargin TextEntry { id : _ipAddress - // nextInput : _gateway // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. + nextInput : _gateway // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. textInput.text : vNetwork.ipAddress label.text : qsTr("IP Address") textInput.width : entryWidth label.width : labelWidth + hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - _keyboard.setVisible(false) vNetwork.doSetIPAddress(textInput.text) } } TextEntry { id : _gateway - // nextInput : _subnetmask // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. + nextInput : _subnetmask // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. textInput.text : vNetwork.gateway textInput.width : entryWidth label.width : labelWidth label.text : qsTr("Gateway") + hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - _keyboard.setVisible(false) vNetwork.doSetGateway(textInput.text) } } TextEntry { id : _subnetmask - // nextInput : _dns // it's not needed to be entered in order all the time and also the keyboard needs to be hidden for the set result to be shown. + nextInput : _dns // helps user to tap on enter to go to the next entry, keyboard visibility is handled by TextEntry. textInput.text : vNetwork.subnetMask textInput.width : entryWidth label.width : labelWidth label.text : qsTr("Subnet Mask") + hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - _keyboard.setVisible(false) vNetwork.doSetSubnetMask(textInput.text) } } @@ -110,9 +111,9 @@ textInput.width : entryWidth label.width : labelWidth label.text : qsTr("DNS") + hasCursor : false // set false for now to disable the static IP entry for phase 1 validator : ipValidator onEnterPressed : { - _keyboard.setVisible(false) vNetwork.doSetDNS(textInput.text) } } @@ -167,11 +168,15 @@ anchors.rightMargin : _root.rightMargin delegate : TouchRect { id : _delegate - property bool isCurrrentNetwork: vNetwork.macAddress === macAddress + readonly property color networkDelegateTextColor : isNetworkSupported ? Colors.textMain : Colors.textDisableButton + readonly property string postSecurityTypeLabel : isNetworkSupported ? "" : " - " + qsTr("Not Supported") + property bool isCurrrentNetwork : vNetwork.macAddress === macAddress + clip : true text.text : ssid text.elide : Text.ElideLeft + text.color : _delegate.networkDelegateTextColor width : _networkList.width - Variables.minVGap height : 75 radius : Variables.dialogRadius @@ -188,8 +193,8 @@ bottom : parent.bottom } font.pixelSize : Fonts.fontPixelDialogText - text : securityTypes - color : Colors.textMain + text : securityTypes + _delegate.postSecurityTypeLabel + color : _delegate.networkDelegateTextColor } Text { id : _isConnected @@ -200,33 +205,39 @@ } font.pixelSize : Fonts.fontPixelDialogText text : _delegate.isCurrrentNetwork ? qsTr("Connected") : "" - color : Colors.textMain + color : _delegate.networkDelegateTextColor } onClicked : { - _userConfirmation.isPassword = ! _delegate.isCurrrentNetwork - _userConfirmation.ssid = ssid - _userConfirmation.macAddress = macAddress - push( _userConfirmation ) - _userConfirmation.setFocus() + if( isNetworkSupported ) { + _userConfirmation.isPassword = ! _delegate.isCurrrentNetwork + _userConfirmation.ssid = ssid + _userConfirmation.macAddress = macAddress + push( _userConfirmation ) + _userConfirmation.setFocus() + } } } } UserConfirmation { id : _userConfirmation property string ssid : "" property string macAddress : "" - property string separator : "\n" + property string separator : "\n\n" + readonly property string spaceSeparator : " " // notificationText : vNetwork.status message : qsTr("Do you want to disconnect from `%1`?").arg(ssid) - title : isPassword ? qsTr("Join") + separator + ssid : qsTr("Disconnect") + separator + ssid + title : isPassword ? qsTr("Join") + separator + ssid + spaceSeparator + qsTr("Password") : qsTr("Disconnect") + separator + ssid onConfirmClicked : { if ( isPassword ) { - vNetwork.doJoinNetwork ( macAddress, password ) + if( passwordCurrent.length > 0 ) { + vNetwork.doJoinNetwork ( macAddress, passwordCurrent ) + pop() + } } else { vNetwork.doDisconnectNetwork( macAddress ) + pop() } - pop() } } }