2019-09-09 15:12:58 +03:00
|
|
|
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-09-09 15:12:58 +03:00
|
|
|
|
2019-10-15 15:54:22 +03:00
|
|
|
function showWindow() {
|
|
|
|
app.hide()
|
|
|
|
app.show()
|
|
|
|
raise()
|
|
|
|
requestActivate()
|
|
|
|
}
|
2019-09-09 15:12:58 +03:00
|
|
|
|
|
|
|
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
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
2019-09-23 10:30:53 +03:00
|
|
|
text: qsTr("Show Yubico Authenticator")
|
2019-10-15 15:54:22 +03:00
|
|
|
onTriggered: showWindow()
|
2019-09-09 15:12:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuSeparator {
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Quit")
|
|
|
|
onTriggered: Qt.quit()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|