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