1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Only use StatusNotifier on KDE

According to the qtox wiki table, Qt's backend works better on non-kde DEs
This commit is contained in:
tux3 2015-02-23 23:25:08 +01:00
parent ffea7cd193
commit d89c722b9c
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -38,7 +38,7 @@ SystemTrayIcon::SystemTrayIcon()
} }
#endif #endif
#ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND #ifdef ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
else if (true) else if (desktop == "kde")
{ {
qDebug() << "SystemTrayIcon: Using Status Notifier backend"; qDebug() << "SystemTrayIcon: Using Status Notifier backend";
backendType = SystrayBackendType::StatusNotifier; backendType = SystrayBackendType::StatusNotifier;
@ -61,15 +61,15 @@ SystemTrayIcon::SystemTrayIcon()
status_notifier_register(statusNotifier); status_notifier_register(statusNotifier);
} }
#endif #endif
else if (desktop.toLower() == "kde" else if (desktop == "kde"
&& getenv("KDE_SESSION_VERSION") == QString("5")) && getenv("KDE_SESSION_VERSION") == QString("5"))
{ {
backendType = SystrayBackendType::KDE5; backendType = SystrayBackendType::KDE5;
qWarning() << "SystemTrayIcon: Detected a KDE5 session, disabling the icon"; qWarning() << "SystemTrayIcon: Detected a KDE5 session, but we don't have Status Notifier support. Disabling the systray icon";
} }
else else
{ {
qDebug() << "SystemTrayIcon: Using Qt backend"; qDebug() << "SystemTrayIcon: Using the Qt backend";
qtIcon = new QSystemTrayIcon; qtIcon = new QSystemTrayIcon;
backendType = SystrayBackendType::Qt; backendType = SystrayBackendType::Qt;
connect(qtIcon, &QSystemTrayIcon::activated, this, &SystemTrayIcon::activated); connect(qtIcon, &QSystemTrayIcon::activated, this, &SystemTrayIcon::activated);