Commit 7fd7f1eb authored by Devin Lin's avatar Devin Lin 🎨
Browse files

lockscreen: Improve physical keyboard input

parent 807e4113
Pipeline #194717 passed with stage
in 1 minute and 6 seconds
......@@ -21,6 +21,8 @@ Rectangle {
required property var lockScreenState
property alias passwordBar: passwordBar
// 0 - keypad is not shown, 1 - keypad is shown
property double swipeProgress
......@@ -50,25 +52,6 @@ Rectangle {
easing.type: Easing.InOutQuad
}
}
// listen for keyboard events
Keys.onPressed: {
if (event.modifiers === Qt.NoModifier) {
if (event.key === Qt.Key_Backspace) {
passwordBar.backspace();
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
passwordBar.enter();
} else if (event.text != "") {
passwordBar.keyPress(event.text);
}
}
if (event.modifiers & Qt.ControlModifier) {
if (event.key === Qt.Key_Backspace) {
passwordBar.clear();
}
}
}
RectangularGlow {
anchors.topMargin: 1
......
......@@ -29,10 +29,19 @@ PlasmaCore.ColorScope {
property bool notificationsShown: false
readonly property bool drawerOpen: flickable.openFactor >= 1
property var passwordBar: keypadLoader.item.passwordBar
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
anchors.fill: parent
// listen for keyboard events, and focus on input area
Component.onCompleted: forceActiveFocus();
Keys.onPressed: {
passwordBar.isPinMode = false;
flickable.goToOpenPosition();
passwordBar.textField.forceActiveFocus();
}
// wallpaper blur
Loader {
anchors.fill: parent
......@@ -160,14 +169,16 @@ PlasmaCore.ColorScope {
// password keypad
Loader {
id: keypadLoader
width: parent.width
asynchronous: true
anchors.bottom: parent.bottom
sourceComponent: ColumnLayout {
transform: Translate { y: flickable.keypadHeight - flickable.position }
property alias passwordBar: keypad.passwordBar
transform: Translate { y: flickable.keypadHeight - flickable.position }
spacing: 0
// info notification text
......
......@@ -20,6 +20,8 @@ Rectangle {
required property var lockScreenState
property alias textField: textField
// toggle between pin and password mode
property bool isPinMode: true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment