mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 02:04:45 +00:00
lockscreen: Improve physical keyboard input
This commit is contained in:
parent
74285d9261
commit
9f1b76c4cf
3 changed files with 16 additions and 20 deletions
|
|
@ -21,6 +21,8 @@ Rectangle {
|
||||||
|
|
||||||
required property var lockScreenState
|
required property var lockScreenState
|
||||||
|
|
||||||
|
property alias passwordBar: passwordBar
|
||||||
|
|
||||||
// 0 - keypad is not shown, 1 - keypad is shown
|
// 0 - keypad is not shown, 1 - keypad is shown
|
||||||
property double swipeProgress
|
property double swipeProgress
|
||||||
|
|
||||||
|
|
@ -51,25 +53,6 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
RectangularGlow {
|
||||||
anchors.topMargin: 1
|
anchors.topMargin: 1
|
||||||
anchors.fill: passwordBar
|
anchors.fill: passwordBar
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,19 @@ PlasmaCore.ColorScope {
|
||||||
property bool notificationsShown: false
|
property bool notificationsShown: false
|
||||||
|
|
||||||
readonly property bool drawerOpen: flickable.openFactor >= 1
|
readonly property bool drawerOpen: flickable.openFactor >= 1
|
||||||
|
property var passwordBar: keypadLoader.item.passwordBar
|
||||||
|
|
||||||
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
|
||||||
anchors.fill: parent
|
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
|
// wallpaper blur
|
||||||
Loader {
|
Loader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -167,6 +176,7 @@ PlasmaCore.ColorScope {
|
||||||
|
|
||||||
// password keypad
|
// password keypad
|
||||||
Loader {
|
Loader {
|
||||||
|
id: keypadLoader
|
||||||
width: parent.width
|
width: parent.width
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: !root.lockScreenState.passwordless // only load keypad if not passwordless
|
active: !root.lockScreenState.passwordless // only load keypad if not passwordless
|
||||||
|
|
@ -174,8 +184,9 @@ PlasmaCore.ColorScope {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
sourceComponent: ColumnLayout {
|
sourceComponent: ColumnLayout {
|
||||||
transform: Translate { y: flickable.keypadHeight - flickable.position }
|
property alias passwordBar: keypad.passwordBar
|
||||||
|
|
||||||
|
transform: Translate { y: flickable.keypadHeight - flickable.position }
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
// info notification text
|
// info notification text
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ Rectangle {
|
||||||
|
|
||||||
required property var lockScreenState
|
required property var lockScreenState
|
||||||
|
|
||||||
|
property alias textField: textField
|
||||||
|
|
||||||
// toggle between pin and password mode
|
// toggle between pin and password mode
|
||||||
property bool isPinMode: true
|
property bool isPinMode: true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue