From b92c2d280cddff8a5f0fa53bafa8d57cb52f4603 Mon Sep 17 00:00:00 2001
From: jan Iversen <jan@casacondor.com>
Date: Sun, 29 Dec 2019 09:13:08 +0100
Subject: [PATCH] mobile-widgets/qml: remove prefs.showPin

prefs.showpin is the same as
PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
but is actually implemented as a separate variable.

Removing showPin in order to limit use of QMLPrefs, which is the overall goal.

Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
---
 mobile-widgets/qml/CloudCredentials.qml | 17 ++++++++---------
 mobile-widgets/qml/Settings.qml         |  1 -
 mobile-widgets/qml/StartPage.qml        |  4 ++--
 3 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/mobile-widgets/qml/CloudCredentials.qml b/mobile-widgets/qml/CloudCredentials.qml
index 6bed7b1f7..1b999f4a5 100644
--- a/mobile-widgets/qml/CloudCredentials.qml
+++ b/mobile-widgets/qml/CloudCredentials.qml
@@ -46,7 +46,7 @@ Item {
 
 		Controls.Label {
 			text: qsTr("Email")
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 			font.pointSize: subsurfaceTheme.smallPointSize
 			color: subsurfaceTheme.secondaryTextColor
 		}
@@ -54,7 +54,7 @@ Item {
 		Controls.TextField {
 			id: login
 			text: PrefCloudStorage.cloud_storage_email
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 			Layout.fillWidth: true
 			inputMethodHints: Qt.ImhEmailCharactersOnly |
 					  Qt.ImhNoAutoUppercase
@@ -62,7 +62,7 @@ Item {
 
 		Controls.Label {
 			text: qsTr("Password")
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 			font.pointSize: subsurfaceTheme.smallPointSize
 			color: subsurfaceTheme.secondaryTextColor
 		}
@@ -70,7 +70,7 @@ Item {
 		Controls.TextField {
 			id: password
 			text: PrefCloudStorage.cloud_storage_password
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 			echoMode: TextInput.PasswordEchoOnEdit
 			inputMethodHints: Qt.ImhSensitiveData |
 					  Qt.ImhHiddenText |
@@ -80,20 +80,20 @@ Item {
 
 		Controls.Label {
 			text: qsTr("PIN")
-			visible: prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
 		}
 		Controls.TextField {
 			id: pin
 			text: ""
 			Layout.fillWidth: true
-			visible: prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
 		}
 
 		RowLayout {
 			Layout.fillWidth: true
 			Layout.margins: Kirigami.Units.smallSpacing
 			spacing: Kirigami.Units.smallSpacing
-			visible: prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
 			SsrfButton {
 				id: registerpin
 				text: qsTr("Register")
@@ -111,7 +111,6 @@ Item {
 				onClicked: {
 					PrefCloudStorage.cloud_verification_status = CloudStatus.CS_UNKNOWN
 					manager.startPageText = qsTr("Check credentials...");
-					prefs.showPin = false;
 				}
 			}
 		}
@@ -120,7 +119,7 @@ Item {
 			Layout.fillWidth: true
 			Layout.margins: Kirigami.Units.smallSpacing
 			spacing: Kirigami.Units.smallSpacing
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 
 			SsrfButton {
 				id: signin_register_normal
diff --git a/mobile-widgets/qml/Settings.qml b/mobile-widgets/qml/Settings.qml
index 03ffa13a9..100ecb9e5 100644
--- a/mobile-widgets/qml/Settings.qml
+++ b/mobile-widgets/qml/Settings.qml
@@ -56,7 +56,6 @@ Kirigami.ScrollablePage {
 				onClicked: {
 					PrefCloudStorage.cloud_verification_status = CloudStatus.CS_UNKNOWN
 					manager.startPageText  = qsTr("Starting...");
-					prefs.showPin = false;
 				}
 			}
 			Controls.Label {
diff --git a/mobile-widgets/qml/StartPage.qml b/mobile-widgets/qml/StartPage.qml
index 1237208a9..d7eb151f9 100644
--- a/mobile-widgets/qml/StartPage.qml
+++ b/mobile-widgets/qml/StartPage.qml
@@ -27,7 +27,7 @@ Kirigami.ScrollablePage {
 		}
 		Controls.Label {
 			id: explanationTextBasic
-			visible: !prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status !== CloudStatus.CS_NEED_TO_VERIFY
 			Layout.fillWidth: true
 			Layout.margins: Kirigami.Units.gridUnit
 			Layout.topMargin: Kirigami.Units.gridUnit * 3
@@ -40,7 +40,7 @@ Kirigami.ScrollablePage {
 		}
 		Controls.Label {
 			id: explanationTextPin
-			visible: prefs.showPin
+			visible: PrefCloudStorage.cloud_verification_status === CloudStatus.CS_NEED_TO_VERIFY
 			Layout.fillWidth: true
 			Layout.margins: Kirigami.Units.gridUnit
 			Layout.topMargin: Kirigami.Units.gridUnit * 3