mirror of https://gitee.com/openkylin/wpa.git
Use KDE's KNotify when running under KDE
Bug-Debian: http://bugs.debian.org/582793 Gbp-Pq: Name 12_wpa_gui_knotify_support.patch
This commit is contained in:
parent
53e5534e40
commit
a4945d4877
|
@ -11,11 +11,14 @@
|
|||
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <unistd.h>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QImageReader>
|
||||
#include <QProcess>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
|
||||
#include "wpagui.h"
|
||||
#include "dirent.h"
|
||||
|
@ -1415,10 +1418,21 @@ void WpaGui::createTrayIcon(bool trayOnly)
|
|||
void WpaGui::showTrayMessage(QSystemTrayIcon::MessageIcon type, int sec,
|
||||
const QString & msg)
|
||||
{
|
||||
if (!QSystemTrayIcon::supportsMessages())
|
||||
if (isVisible() || !tray_icon || !tray_icon->isVisible() || quietMode)
|
||||
return;
|
||||
|
||||
if (isVisible() || !tray_icon || !tray_icon->isVisible() || quietMode)
|
||||
/* first try to use KDE's notifications system if running under
|
||||
* a KDE session */
|
||||
if (getenv("KDE_FULL_SESSION") != NULL) {
|
||||
QStringList args;
|
||||
args << "--passivepopup" << msg << QString::number(sec);
|
||||
args << "--title" << "wpa_gui";
|
||||
|
||||
if (QProcess::execute("/usr/bin/kdialog", args) == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QSystemTrayIcon::supportsMessages())
|
||||
return;
|
||||
|
||||
tray_icon->showMessage(qAppName(), msg, type, sec * 1000);
|
||||
|
|
Loading…
Reference in New Issue