mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-25 23:14:18 +03:00
74 lines
1.9 KiB
QML
74 lines
1.9 KiB
QML
import QtGraphicalEffects 1.0
|
|
import QtQuick 2.9
|
|
import QtQuick.Controls 2.2
|
|
import QtQuick.Controls.Material 2.2
|
|
import QtQuick.Layouts 1.3
|
|
|
|
Pane {
|
|
id: pane
|
|
|
|
property string title: ""
|
|
property string searchQuery: toolBar.searchField.text
|
|
|
|
function filteredCredentials() {
|
|
if (entries !== null && searchQuery.length > 0) {
|
|
var filteredEntries = entriesComponent.createObject(app);
|
|
for (var i = 0; i < entries.count; i++) {
|
|
var entry = entries.get(i);
|
|
if (!!entry && !!entry.credential && entry.credential.key.match(escapeRegExp(searchQuery, "i")))
|
|
filteredEntries.append(entry);
|
|
|
|
}
|
|
return filteredEntries;
|
|
}
|
|
return entries;
|
|
}
|
|
|
|
objectName: "credentialsView"
|
|
anchors.fill: parent
|
|
Accessible.ignored: true
|
|
padding: 0
|
|
spacing: 0
|
|
|
|
Component {
|
|
id: entriesComponent
|
|
|
|
EntriesModel {
|
|
}
|
|
|
|
}
|
|
|
|
NoCredentialsSection {
|
|
id: noCredentialsSection
|
|
|
|
visible: entries.count === 0 && (!!yubiKey.currentDevice) && yubiKey.currentDeviceValidated
|
|
enabled: visible
|
|
Accessible.ignored: true
|
|
}
|
|
|
|
NoResultsSection {
|
|
id: noResultsSection
|
|
|
|
visible: entries.count > 0 && (!!yubiKey.currentDevice && yubiKey.currentDeviceValidated) && filteredCredentials().count === 0
|
|
enabled: visible
|
|
Accessible.ignored: true
|
|
}
|
|
|
|
NoYubiKeySection {
|
|
id: noYubiKeySection
|
|
|
|
// Make this section the default view to show when there is errors.
|
|
visible: !yubiKey.availableDevices || (!credentialsSection.visible && !noResultsSection.visible && !noCredentialsSection.visible)
|
|
enabled: visible
|
|
Accessible.ignored: true
|
|
}
|
|
|
|
CredentialsSection {
|
|
id: credentialsSection
|
|
|
|
visible: entries.count > 0
|
|
enabled: visible
|
|
}
|
|
|
|
}
|