#include <QMessageBox>
#include <QProcess>
#include <QRect>
+#include <QSystemTrayIcon>
#include <libtransmission/transmission.h>
#include <libtransmission/tr-getopt.h>
bool
Application::notifyApp (const QString& title, const QString& body) const
{
+ QDBusConnection bus = QDBusConnection::sessionBus ();
+ if (!bus.isConnected ())
+ {
+ myWindow->trayIcon ().showMessage (title, body);
+ return true;
+ }
+
const QString dbusServiceName = QString::fromUtf8 ("org.freedesktop.Notifications");
const QString dbusInterfaceName = QString::fromUtf8 ("org.freedesktop.Notifications");
const QString dbusPath = QString::fromUtf8 ("/org/freedesktop/Notifications");
args.append (QVariantMap ()); // hints - unused atm
args.append (static_cast<int32_t> (-1)); // use the default timeout period
m.setArguments (args);
- QDBusMessage replyMsg = QDBusConnection::sessionBus ().call (m);
+ QDBusMessage replyMsg = bus.call (m);
//std::cerr << qPrintable (replyMsg.errorName ()) << std::endl;
//std::cerr << qPrintable (replyMsg.errorMessage ()) << std::endl;
return (replyMsg.type () == QDBusMessage::ReplyMessage) && !replyMsg.arguments ().isEmpty ();
MainWindow (Session&, Prefs&, TorrentModel&, bool minized);
virtual ~MainWindow ();
+ QSystemTrayIcon& trayIcon () { return myTrayIcon; }
+
public slots:
void startAll ();
void startSelected ();