mobile-widgets/qml: reintroduce showPin

but the proper way, as a direct check on
PrefCloudStorage.

This secures PrefCloudStorage is only tested once and not
n times. As a sideeffect it saves typing and control.

Signed-off-by: Jan Iversen <jan@casacondor.com>
This commit is contained in:
jan Iversen 2020-01-01 18:49:37 +01:00 committed by Dirk Hohndel
parent a72e6e46ab
commit 6d6a4278c4

View file

@ -13,6 +13,7 @@ Item {
property string username: login.text; property string username: login.text;
property string password: password.text; property string password: password.text;
property bool showPin: (PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY)
ColumnLayout { ColumnLayout {
id: outerLayout id: outerLayout
@ -46,7 +47,7 @@ Item {
Controls.Label { Controls.Label {
text: qsTr("Email") text: qsTr("Email")
visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY visible: !showPin
font.pointSize: subsurfaceTheme.smallPointSize font.pointSize: subsurfaceTheme.smallPointSize
color: subsurfaceTheme.secondaryTextColor color: subsurfaceTheme.secondaryTextColor
} }
@ -54,7 +55,7 @@ Item {
Controls.TextField { Controls.TextField {
id: login id: login
text: PrefCloudStorage.cloud_storage_email text: PrefCloudStorage.cloud_storage_email
visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY visible: !showPin
Layout.fillWidth: true Layout.fillWidth: true
inputMethodHints: Qt.ImhEmailCharactersOnly | inputMethodHints: Qt.ImhEmailCharactersOnly |
Qt.ImhNoAutoUppercase Qt.ImhNoAutoUppercase
@ -62,7 +63,7 @@ Item {
Controls.Label { Controls.Label {
text: qsTr("Password") text: qsTr("Password")
visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY visible: !showPin
font.pointSize: subsurfaceTheme.smallPointSize font.pointSize: subsurfaceTheme.smallPointSize
color: subsurfaceTheme.secondaryTextColor color: subsurfaceTheme.secondaryTextColor
} }
@ -70,7 +71,7 @@ Item {
Controls.TextField { Controls.TextField {
id: password id: password
text: PrefCloudStorage.cloud_storage_password text: PrefCloudStorage.cloud_storage_password
visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY visible: !showPin
echoMode: TextInput.PasswordEchoOnEdit echoMode: TextInput.PasswordEchoOnEdit
inputMethodHints: Qt.ImhSensitiveData | inputMethodHints: Qt.ImhSensitiveData |
Qt.ImhHiddenText | Qt.ImhHiddenText |
@ -80,20 +81,20 @@ Item {
Controls.Label { Controls.Label {
text: qsTr("PIN") text: qsTr("PIN")
visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY visible: showPin
} }
Controls.TextField { Controls.TextField {
id: pin id: pin
text: "" text: ""
Layout.fillWidth: true Layout.fillWidth: true
visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY visible: showPin
} }
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing Layout.margins: Kirigami.Units.smallSpacing
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY visible: showPin
SsrfButton { SsrfButton {
id: registerpin id: registerpin
text: qsTr("Register") text: qsTr("Register")
@ -119,7 +120,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.margins: Kirigami.Units.smallSpacing Layout.margins: Kirigami.Units.smallSpacing
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY visible: !showPin
SsrfButton { SsrfButton {
id: signin_register_normal id: signin_register_normal