-#ifdef HAVE_DBUS
-
-/*
-Using the notification-daemon from Freedesktop's Galago project
-http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify
-*/
-void MainWin::sendDesktopNotification(const QString &title, const QString &message) {
- QStringList actions;
- QMap<QString, QVariant> hints;
- UiSettings uiSettings;
-
- hints["x"] = uiSettings.value("NotificationDesktopHintX", QVariant(0)).toInt(); // Standard hint: x location for the popup to show up
- hints["y"] = uiSettings.value("NotificationDesktopHintY", QVariant(0)).toInt(); // Standard hint: y location for the popup to show up
-
- actions << "click" << "Click Me!";
-
- QDBusReply<uint> reply = desktopNotifications->Notify(
- "Quassel", // Application name
- notificationId, // ID of previous notification to replace
- "", // Icon to display
- title, // Summary / Header of the message to display
- QString("%1: %2:\n%3").arg(QTime::currentTime().toString()).arg(title).arg(message), // Body of the message to display
- actions, // Actions from which the user may choose
- hints, // Hints to the server displaying the message
- uiSettings.value("NotificationDesktopTimeout", QVariant(5000)).toInt() // Timeout in milliseconds
- );
-
- if(!reply.isValid()) {
- /* ERROR */
- // could also happen if no notification service runs, so... whatever :)
- //qDebug() << "Error on sending notification..." << reply.error();
- return;
- }
-
- notificationId = reply.value();
-
- // qDebug() << "ID: " << notificationId << " Time: " << QTime::currentTime().toString();
-}
-
-
-void MainWin::desktopNotificationClosed(uint id, uint reason) {
- Q_UNUSED(id); Q_UNUSED(reason);
- // qDebug() << "OID: " << notificationId << " ID: " << id << " Reason: " << reason << " Time: " << QTime::currentTime().toString();
- notificationId = 0;
-}
-
-
-void MainWin::desktopNotificationInvoked(uint id, const QString & action) {
- Q_UNUSED(id); Q_UNUSED(action);
- // qDebug() << "OID: " << notificationId << " ID: " << id << " Action: " << action << " Time: " << QTime::currentTime().toString();
-}
-
-#endif /* HAVE_DBUS */
-
-void MainWin::displayTrayIconMessage(const QString &title, const QString &message) {
- systray->showMessage(title, message);
-}
-
-void MainWin::setTrayIconActivity(bool active) {
- if(active) {
- if(!timer->isActive())
- timer->start(500);
- } else {
- timer->stop();
- systray->setIcon(onlineTrayIcon);
- }
-}
-
-void MainWin::makeTrayIconBlink() {
- if(trayIconActive) {
- systray->setIcon(onlineTrayIcon);
- trayIconActive = false;
- } else {
- systray->setIcon(activeTrayIcon);
- trayIconActive = true;
- }
-}
-