diff options
Diffstat (limited to 'src/daemon/NotificationsService.cpp')
-rw-r--r-- | src/daemon/NotificationsService.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/daemon/NotificationsService.cpp b/src/daemon/NotificationsService.cpp index 297068f..b5bd0ad 100644 --- a/src/daemon/NotificationsService.cpp +++ b/src/daemon/NotificationsService.cpp @@ -25,8 +25,8 @@ #define NOTIFICATIONS_DBUS_PATH "/org/freedesktop/Notifications" #define IMAGE_SIZE 48 -#define TDE_VERSION "R14.1.0" -#define VERSION "0.1" +#define SRV_VERSION "1.1" +#define SPEC_VERSION "1.1" NotificationsService::NotificationsService(TQT_DBusConnection &conn) : org::freedesktop::NotificationsInterface(), mConnection(&conn) @@ -39,8 +39,22 @@ NotificationsService::~NotificationsService() // TODO Auto-generated destructor stub } +void NotificationsService::closeNotifyWidget(TQ_UINT32 id, TQ_UINT32 reason) { + + if (notificationMap[id]) { + notificationMap[id]->close(); + delete notificationMap[id]; + notificationMap.remove(id); + } + + if ( !emitNotificationClosed(id, reason) ) { + tqWarning("Failed to emit DBus signal NotificationClosed"); + } +} + bool NotificationsService::handleSignalSend(const TQT_DBusMessage& reply) { + mConnection->send(reply); return true; } @@ -59,6 +73,7 @@ bool NotificationsService::GetCapabilities(TQStringList& return_caps, TQT_DBusEr void NotificationsService::CloseNotificationAsync(int asyncCallId, TQ_UINT32 id) { + closeNotifyWidget(id, 3); // The notification was closed by a call to CloseNotification. CloseNotificationAsyncReply(asyncCallId); } @@ -71,8 +86,8 @@ bool NotificationsService::GetServerInformation(TQString& return_name, TQString& return_name = TQString("Notification Daemon"); return_vendor = TQString("Trinity Desktop Project"); - return_version = TQString(TDE_VERSION); - return_spec_version = TQString(VERSION); + return_version = TQString(SRV_VERSION); + return_spec_version = TQString(SPEC_VERSION); return true; } @@ -84,7 +99,7 @@ void NotificationsService::NotifyAsync( const TQMap<TQString, TQT_DBusVariant>& hints, TQ_INT32 timeout) { - notificationMap[id] = new NotifyWidget(0, app_name.ascii(), id ); + notificationMap[id] = new NotifyWidget(0, app_name.ascii(), this, id ); notificationMap[id]->setFrameStyle( TQFrame::NoFrame ); notificationMap[id]->setIcon(icon); notificationMap[id]->setPaletteBackgroundColor(TQt::black); @@ -92,7 +107,7 @@ void NotificationsService::NotifyAsync( // FXIME: handle hypertext in the body notificationMap[id]->setText(app_name + ": " + summary + "\n" + body); notificationMap[id]->setActions(actions); -// notificationMap[id]->setHints(hints); + notificationMap[id]->setHints(hints); notificationMap[id]->setTimeout(timeout); notificationMap[id]->show(); notificationMap[id]->raise(); |