From deb11db2679888b6c9c6f27833f69648a1cd6372 Mon Sep 17 00:00:00 2001 From: reionwong Date: Thu, 29 Jul 2021 06:10:37 +0800 Subject: [PATCH] Improve message tips --- screenlocker/qml/LockScreen.qml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/screenlocker/qml/LockScreen.qml b/screenlocker/qml/LockScreen.qml index c04ddb3..5359f63 100644 --- a/screenlocker/qml/LockScreen.qml +++ b/screenlocker/qml/LockScreen.qml @@ -30,7 +30,7 @@ import FishUI 1.0 as FishUI Item { id: root - property alias notification: message.text + property string notification LayoutMirroring.enabled: Qt.locale().textDirection === Qt.RightToLeft LayoutMirroring.childrenInherit: true @@ -269,12 +269,12 @@ Item { Label { id: message - text: "" anchors.top: _mainItem.bottom anchors.topMargin: FishUI.Units.largeSpacing anchors.horizontalCenter: parent.horizontalCenter font.bold: true color: "white" + text: root.notification Behavior on opacity { NumberAnimation { @@ -301,6 +301,7 @@ Item { function tryUnlock() { if (!password.text) { + notificationResetTimer.start() root.notification = qsTr("Please enter your password") return } @@ -308,25 +309,34 @@ Item { authenticator.tryUnlock(password.text) } + Timer { + id: notificationResetTimer + interval: 3000 + onTriggered: root.notification = "" + } + Connections { target: authenticator function onFailed() { + notificationResetTimer.start() root.notification = qsTr("Unlocking failed") } - function onGraceLockedChanged() { - if (!authenticator.graceLocked) { - root.notification = "" - password.selectAll() - password.focus = true - } - } +// function onGraceLockedChanged() { +// if (!authenticator.graceLocked) { +// root.notification = "" +// password.selectAll() +// password.focus = true +// } +// } function onMessage(text) { + notificationResetTimer.start() root.notification = text } function onError(text) { + notificationResetTimer.start() root.notification = text } }