yubioath-flutter/qml/SystemTray.qml

55 lines
1.3 KiB
QML
Raw Normal View History

import QtQuick 2.9
import Qt.labs.platform 1.1
import QtQml 2.12
SystemTrayIcon {
visible: settings.closeToTray
icon.source: "../images/windowicon.png"
2019-10-15 15:54:22 +03:00
onActivated: {
if (reason === SystemTrayIcon.DoubleClick) {
showWindow()
} else {
sysTrayInstantiator.model = getFavoriteEntries()
}
}
2019-10-15 15:54:22 +03:00
function showWindow() {
app.hide()
app.show()
raise()
requestActivate()
}
menu: Menu {
id: sysTrayMenu
Instantiator {
id: sysTrayInstantiator
model: getFavoriteEntries()
onObjectAdded: sysTrayMenu.insertItem(index, object)
onObjectRemoved: sysTrayMenu.removeItem(object)
delegate: MenuItem {
text: credential.issuer ? credential.issuer + " (" + credential.name + ")" : credential.name
onTriggered: calculateFavorite(credential, text)
}
}
MenuSeparator {
2019-10-15 15:54:22 +03:00
visible: sysTrayInstantiator.model.count > 0
}
MenuItem {
2019-09-23 10:30:53 +03:00
text: qsTr("Show Yubico Authenticator")
2019-10-15 15:54:22 +03:00
onTriggered: showWindow()
}
MenuSeparator {
}
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
}