Commit 11f9ecdf authored by Ronan Abhamon's avatar Ronan Abhamon

fix(main): fixes on trayIcon

parent da571cf1
......@@ -12,7 +12,7 @@
// ===================================================================
int exec (App &app, QQmlApplicationEngine &engine) {
if (QSystemTrayIcon::isSystemTrayAvailable())
if (!QSystemTrayIcon::isSystemTrayAvailable())
qWarning() << "System tray not found on this system.";
QQuickWindow *root = qobject_cast<QQuickWindow *>(engine.rootObjects().at(0));
......@@ -29,9 +29,11 @@ int exec (App &app, QQmlApplicationEngine &engine) {
QAction *restoreAction = new QAction(QObject::tr("Restore"), root);
root->connect(restoreAction, &QAction::triggered, root, &QQuickWindow::showNormal);
// trayIcon: Left click action.
// trayIcon: Left click actions.
root->connect(tray_icon, &QSystemTrayIcon::activated, [&root](QSystemTrayIcon::ActivationReason reason) {
if (reason == QSystemTrayIcon::DoubleClick)
if (reason == QSystemTrayIcon::Trigger)
root->requestActivate();
else if (reason == QSystemTrayIcon::DoubleClick)
root->showNormal();
});
......@@ -42,6 +44,7 @@ int exec (App &app, QQmlApplicationEngine &engine) {
tray_icon->setContextMenu(menu);
tray_icon->setIcon(QIcon(":/imgs/linphone.png"));
tray_icon->setToolTip("Linphone");
tray_icon->show();
// RUN.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment