mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2025-01-06 02:37:21 +03:00
Add search/filter functionality
This commit is contained in:
parent
7d247ac5b5
commit
135d5c3b62
19
qml/Main.qml
19
qml/Main.qml
@ -141,8 +141,8 @@ ApplicationWindow {
|
||||
anchors.top: appWindow.top
|
||||
|
||||
Repeater {
|
||||
id: repeater1
|
||||
model: credentials
|
||||
id: repeater
|
||||
model: filteredCredentials(credentials, search.text)
|
||||
|
||||
Rectangle {
|
||||
id: credentialRectangle
|
||||
@ -198,6 +198,7 @@ ApplicationWindow {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog {
|
||||
id: touchYourYubikey
|
||||
icon: StandardIcon.Information
|
||||
@ -273,6 +274,20 @@ ApplicationWindow {
|
||||
standardButtons: StandardButton.Ok
|
||||
}
|
||||
|
||||
function filteredCredentials(creds, search) {
|
||||
var result = []
|
||||
if (creds != null) {
|
||||
for (var i = 0; i < creds.length; i++) {
|
||||
var cred = creds[i]
|
||||
if (cred.name.toLowerCase().indexOf(search.toLowerCase(
|
||||
)) !== -1) {
|
||||
result.push(creds[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function hasIssuer(name) {
|
||||
return name.indexOf(':') !== -1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user