lock: use TextInput for keyboard input instead of Keys on plain Item
This commit is contained in:
parent
9f0043cd23
commit
3d68d467f7
2 changed files with 30 additions and 25 deletions
|
|
@ -15,26 +15,11 @@ QtObject {
|
|||
|
||||
signal authFailed
|
||||
|
||||
function handleKey(event) {
|
||||
function submit() {
|
||||
if (_passwd.active || state === "max")
|
||||
return;
|
||||
|
||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
||||
if (buffer.length > 0)
|
||||
_passwd.start();
|
||||
} else if (event.key === Qt.Key_Backspace) {
|
||||
if (event.modifiers & Qt.ControlModifier)
|
||||
buffer = "";
|
||||
else
|
||||
buffer = buffer.slice(0, -1);
|
||||
} else if (event.key === Qt.Key_Escape) {
|
||||
buffer = "";
|
||||
} else if (event.text && event.text.length === 1) {
|
||||
const c = event.text;
|
||||
// Accept printable ASCII
|
||||
if (c.charCodeAt(0) >= 32 && c.charCodeAt(0) < 127)
|
||||
buffer += c;
|
||||
}
|
||||
if (buffer.length > 0)
|
||||
_passwd.start();
|
||||
}
|
||||
|
||||
property PamContext _passwd: PamContext {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue