From 754efdedd4ee1b7dbafda06bd7858e2f51346ea0 Mon Sep 17 00:00:00 2001 From: Thomas Surrel Date: Mon, 15 Oct 2018 12:19:22 +0200 Subject: [PATCH] [Lock Screen] Do not try to unlock when unvisible Summary: In the lock screen, pressing the enter key while the UI is not yet visible ends up trying to unlock (and would usually fail because the password field is empty). Ensure that the UI is visible before unlocking. BUG: 395671 Test Plan: Lock the session, press enter. The UI should appear without any "Unlocking failed" message. Reviewers: #plasma, #vdg, ngraham, davidedmundson Reviewed By: #plasma, #vdg, ngraham, davidedmundson Subscribers: ngraham, davidedmundson, abetts, filipf, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D16219 --- lookandfeel/contents/lockscreen/LockScreenUi.qml | 1 + lookandfeel/contents/lockscreen/MainBlock.qml | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lookandfeel/contents/lockscreen/LockScreenUi.qml b/lookandfeel/contents/lockscreen/LockScreenUi.qml index 70d2e3abb..f3cc81c7e 100644 --- a/lookandfeel/contents/lockscreen/LockScreenUi.qml +++ b/lookandfeel/contents/lockscreen/LockScreenUi.qml @@ -211,6 +211,7 @@ PlasmaCore.ColorScope { initialItem: MainBlock { id: mainBlock + lockScreenUiVisible: lockScreenRoot.uiVisible showUserList: userList.y + mainStack.y > 0 diff --git a/lookandfeel/contents/lockscreen/MainBlock.qml b/lookandfeel/contents/lockscreen/MainBlock.qml index 9124c739d..97e7e9433 100644 --- a/lookandfeel/contents/lockscreen/MainBlock.qml +++ b/lookandfeel/contents/lockscreen/MainBlock.qml @@ -30,6 +30,7 @@ import "../components" SessionManagementScreen { property Item mainPasswordBox: passwordBox + property bool lockScreenUiVisible: false //the y position that should be ensured visible when the on screen keyboard is visible property int visibleBoundary: mapFromItem(loginButton, 0, 0).y @@ -61,7 +62,11 @@ SessionManagementScreen { enabled: !authenticator.graceLocked revealPasswordButtonShown: true - onAccepted: startLogin() + onAccepted: { + if (lockScreenUiVisible) { + startLogin(); + } + } //if empty and left or right is pressed change selection in user switch //this cannot be in keys.onLeftPressed as then it doesn't reach the password box