Update tray functionality

When the tray option is enabled
closing the last window doesn't
close the application.
This commit is contained in:
Dag Heyman 2017-03-31 11:14:22 +02:00
parent b4f39f628f
commit 8beda56cb2
No known key found for this signature in database
GPG Key ID: 06FC004369E7D338
2 changed files with 8 additions and 5 deletions

View File

@ -70,6 +70,7 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("appVersion", APP_VERSION);
engine.rootContext()->setContextProperty("ScreenShot", &screenshot);
engine.rootContext()->setContextProperty("SysTrayIcon", trayIcon);
engine.rootContext()->setContextProperty("app", &app);
engine.load(QUrl(url_prefix + main_qml));
// This is the current system tray icon.
@ -101,6 +102,5 @@ int main(int argc, char *argv[])
}
}
#endif
app.setQuitOnLastWindowClosed(false);
return app.exec();
}

View File

@ -90,10 +90,6 @@ ApplicationWindow {
}
}
function updateTrayVisability() {
SysTrayIcon.visible = settings.closeToTray
}
AboutPage {
id: aboutPage
}
@ -568,4 +564,11 @@ ApplicationWindow {
credentialMenu.popup()
}
}
function updateTrayVisability() {
SysTrayIcon.visible = settings.closeToTray
// When the tray option is enabled, closing the last window
// doesn't actually close the application.
app.quitOnLastWindowClosed = !settings.closeToTray
}
}