From dc6341bb3073ebe0beb945018cc7bb67ee2dd828 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 16 May 2022 12:35:39 +0300 Subject: [PATCH] Add an explicit unlock button for passwordless users In the refactor we correctly made it so passwordless users were not prompted for passwords. This is in the right direction but the UX was still slightly off as it meant wiggling the mouse unlocked the screen, not an explicit action. This patch adds an explicit button that must be pressed if no other prompts were given during the authentication process. BUG: 440055 --- .../contents/lockscreen/LockScreenUi.qml | 11 ++++++++- .../contents/lockscreen/NoPasswordUnlock.qml | 23 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lookandfeel/contents/lockscreen/NoPasswordUnlock.qml diff --git a/lookandfeel/contents/lockscreen/LockScreenUi.qml b/lookandfeel/contents/lockscreen/LockScreenUi.qml index 66c17e54a..9ccd992f1 100644 --- a/lookandfeel/contents/lockscreen/LockScreenUi.qml +++ b/lookandfeel/contents/lockscreen/LockScreenUi.qml @@ -24,6 +24,7 @@ PlasmaCore.ColorScope { // If we're using software rendering, draw outlines instead of shadows // See https://bugs.kde.org/show_bug.cgi?id=398317 readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software + property bool hadPrompt: false; colorGroup: PlasmaCore.Theme.ComplementaryColorGroup @@ -40,7 +41,13 @@ PlasmaCore.ColorScope { } function onSucceeded() { - Qt.quit(); + if (lockScreenUi.hadPrompt) { + Qt.quit(); + } else { + mainStack.push(Qt.resolvedUrl("NoPasswordUnlock.qml"), + {"userListModel": users}); + mainStack.forceActiveFocus(); + } } function onInfoMessage(msg) { @@ -58,12 +65,14 @@ PlasmaCore.ColorScope { } function onPrompt(msg) { + lockScreenUi.hadPrompt = true; root.notification = msg; mainBlock.echoMode = TextInput.Normal mainBlock.mainPasswordBox.text = ""; mainBlock.mainPasswordBox.forceActiveFocus(); } function onPromptForSecret(msg) { + lockScreenUi.hadPrompt = true; mainBlock.echoMode = TextInput.Password mainBlock.mainPasswordBox.text = ""; mainBlock.mainPasswordBox.forceActiveFocus(); diff --git a/lookandfeel/contents/lockscreen/NoPasswordUnlock.qml b/lookandfeel/contents/lockscreen/NoPasswordUnlock.qml new file mode 100644 index 000000000..ede3a0e20 --- /dev/null +++ b/lookandfeel/contents/lockscreen/NoPasswordUnlock.qml @@ -0,0 +1,23 @@ +/* + SPDX-FileCopyrightText: 2022 David Edmundson + + SPDX-License-Identifier: GPL-2.0-or-later +*/ +import QtQuick 2.2 + +import org.kde.plasma.components 3.0 as PlasmaComponents3 + +import "../components" + +SessionManagementScreen { + focus: true + PlasmaComponents3.Button { + id: loginButton + focus: true + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Unlock") + icon.name: LayoutMirroring.enabled ? "go-previous" : "go-next" + onClicked: Qt.quit(); + Keys.onEnterPressed: clicked() + Keys.onReturnPressed: clicked() + } +}