mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 22:58:15 +00:00
fix(main): fixes on trayIcon
This commit is contained in:
parent
da571cf109
commit
11f9ecdfd7
1 changed files with 6 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue