From 28b5fbd2676eda725ccbf59ea35d266327eb13ee Mon Sep 17 00:00:00 2001 From: miruka Date: Fri, 16 Aug 2019 16:44:28 -0400 Subject: [PATCH] Disable login button until ID & password entered --- TODO.md | 1 + src/qml/Base/HInterfaceBox.qml | 2 +- src/qml/Pages/SignIn.qml | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 06496bae..d2053c11 100644 --- a/TODO.md +++ b/TODO.md @@ -22,6 +22,7 @@ - Keyboard flicking against top/bottom edge - Don't strip user spacing in html + - Do something when access token is invalid - [hr not working](https://bugreports.qt.io/browse/QTBUG-74342) - Terrible performance using `QT_QPA_PLATFORM=wayland-egl`, must use `xcb` diff --git a/src/qml/Base/HInterfaceBox.qml b/src/qml/Base/HInterfaceBox.qml index bdac469b..2043cab1 100644 --- a/src/qml/Base/HInterfaceBox.qml +++ b/src/qml/Base/HInterfaceBox.qml @@ -14,7 +14,7 @@ HScalingBox { function clickEnterButtonTarget() { for (let i = 0; i < buttonModel.length; i++) { let btn = interfaceButtonsRepeater.itemAt(i) - if (btn.name === enterButtonTarget) { btn.clicked() } + if (btn.enabled && btn.name === enterButtonTarget) btn.clicked() } } diff --git a/src/qml/Pages/SignIn.qml b/src/qml/Pages/SignIn.qml index adfdcab8..96ab22be 100644 --- a/src/qml/Pages/SignIn.qml +++ b/src/qml/Pages/SignIn.qml @@ -4,6 +4,8 @@ import "../Base" Item { property string loginWith: "username" + readonly property bool canLogin: idField.text && passwordField.text + onFocusChanged: idField.forceActiveFocus() HInterfaceBox { @@ -15,7 +17,7 @@ Item { buttonModel: [ { name: "register", text: qsTr("Register"), enabled: false }, - { name: "login", text: qsTr("Login"), enabled: true }, + { name: "login", text: qsTr("Login"), enabled: canLogin }, { name: "forgot", text: qsTr("Forgot?"), enabled: false } ]