From 11f9ecdfd778213431610cbf6e46d1976fd7ee63 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 19 Sep 2016 11:13:25 +0200 Subject: [PATCH] fix(main): fixes on trayIcon --- tests/src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/src/main.cpp b/tests/src/main.cpp index 7a31edc12..738d3f166 100644 --- a/tests/src/main.cpp +++ b/tests/src/main.cpp @@ -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(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.