From 137b240a474da07dec3b3a4925c8f6c98216fc17 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 22 Oct 2018 20:03:12 -0700 Subject: [PATCH] more changes to functions --- .../qml/LoginDialog/LinkAccountBody.qml | 28 +++++++++++++------ .../qml/dialogs/TabletLoginDialog.qml | 4 ++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/LoginDialog/LinkAccountBody.qml b/interface/resources/qml/LoginDialog/LinkAccountBody.qml index 038cc1da43..89ebde36cc 100644 --- a/interface/resources/qml/LoginDialog/LinkAccountBody.qml +++ b/interface/resources/qml/LoginDialog/LinkAccountBody.qml @@ -27,6 +27,7 @@ Item { property bool keyboardRaised: false property bool punctuationMode: false + property bool isLogIn: false property bool withSteam: false onKeyboardRaisedChanged: d.resize(); @@ -57,9 +58,18 @@ Item { } } - function toggleLoggingIn(loggingIn) { + function login() { + if (linkAccountBody.isLogIn) { + loginDialog.login(emailField.text, passwordField.text); + } else { + loginDialog.signup(emailField.text, usernameField.text, passwordField.text); + } + linkAccountBody.toggleLoggingIn(); + } + + function toggleLoggingIn() { // For the process of logging in. - if (withSteam) { + if (linkAccountBody.withSteam) { } else { @@ -69,6 +79,7 @@ Item { function toggleSignIn(signIn, isLogIn) { // going to/from sign in/up dialog. + linkAccountBody.isLogIn = isLogIn; if (signIn) { usernameField.visible = !isLogIn; cantAccessContainer.visible = isLogIn; @@ -188,6 +199,7 @@ Item { } onFocusChanged: { + root.isPassword = true; } Rectangle { @@ -226,20 +238,20 @@ Item { } } Keys.onReturnPressed: { - signInBody.login() + linkAccountBody.login() } } HifiControlsUit.CheckBox { id: autoLogoutCheckbox - checked: !Settings.getValue("wallet/autoLogout", true) - text: "Keep Me Logged In" + checked: !Settings.getValue("wallet/autoLogout", false); + text: qsTr("Keep Me Logged In") boxSize: 18; labelFontSize: 18; color: hifi.colors.white; anchors { - top: passwordField.bottom - topMargin: hifi.dimensions.contentSpacing.y - right: passwordField.right + top: passwordField.bottom; + topMargin: hifi.dimensions.contentSpacing.y; + right: passwordField.right; } onCheckedChanged: { Settings.setValue("wallet/autoLogout", !checked); diff --git a/interface/resources/qml/dialogs/TabletLoginDialog.qml b/interface/resources/qml/dialogs/TabletLoginDialog.qml index c85b2b2ba0..fef86a7241 100644 --- a/interface/resources/qml/dialogs/TabletLoginDialog.qml +++ b/interface/resources/qml/dialogs/TabletLoginDialog.qml @@ -122,7 +122,6 @@ TabletModalWindow { id: bodyLoader anchors.fill: parent anchors.horizontalCenter: parent.horizontalCenter - source: loginDialog.isSteamRunning() ? "../LoginDialog/SignInBody.qml" : "../LoginDialog/LinkAccountBody.qml" } } } @@ -173,4 +172,7 @@ TabletModalWindow { break } } + Component.onCompleted: { + bodyLoader.setSource("../LoginDialog/LinkAccountBody.qml", { "loginDialog": loginDialog, "root": root }); + } }