mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-06 02:37:21 +03:00
Always deselect credential with ESC
This commit is contained in:
parent
01cb66ddbd
commit
17b3b208d5
@ -37,4 +37,5 @@ Item {
|
||||
|
||||
Keys.onReturnPressed: generateOrCopy()
|
||||
Keys.onEnterPressed: generateOrCopy()
|
||||
Keys.onEscapePressed: deselectCredential()
|
||||
}
|
||||
|
18
qml/main.qml
18
qml/main.qml
@ -220,7 +220,10 @@ ApplicationWindow {
|
||||
// A mouse area to allow a click
|
||||
// outside search bar to remove focus from it.
|
||||
anchors.fill: parent
|
||||
onClicked: arrowKeys.focus = true
|
||||
onClicked: {
|
||||
arrowKeys.focus = true;
|
||||
deselectCredential()
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
@ -317,8 +320,7 @@ ApplicationWindow {
|
||||
Keys.onEscapePressed: {
|
||||
search.text = ""
|
||||
arrowKeys.focus = true
|
||||
selected = null
|
||||
selectedIndex = null
|
||||
deselectCredential()
|
||||
}
|
||||
Keys.onReturnPressed: generateOrCopy()
|
||||
Keys.onEnterPressed: generateOrCopy()
|
||||
@ -355,6 +357,11 @@ ApplicationWindow {
|
||||
onTriggered: touchYourYubikey.open()
|
||||
}
|
||||
|
||||
function deselectCredential() {
|
||||
selected = null;
|
||||
selectedIndex = null;
|
||||
}
|
||||
|
||||
|
||||
function getSpacedCredential(code) {
|
||||
// Add a space in the code for easier reading.
|
||||
@ -469,7 +476,7 @@ ApplicationWindow {
|
||||
} else if (search.text.length > 0) {
|
||||
// If search was started but no result,
|
||||
// reset selected to avoid hidden selected creds.
|
||||
selected = null
|
||||
deselectCredential()
|
||||
}
|
||||
return result
|
||||
}
|
||||
@ -614,8 +621,7 @@ ApplicationWindow {
|
||||
// Left click, select or deselect credential.
|
||||
if (mouse.button & Qt.LeftButton) {
|
||||
if (selected != null && selected.name === modelData.name) {
|
||||
selected = null
|
||||
selectedIndex = null
|
||||
deselectCredential()
|
||||
} else {
|
||||
selected = modelData
|
||||
selectedIndex = index
|
||||
|
Loading…
Reference in New Issue
Block a user