From 9b23b6d80cc08381472329d1975181250304f51b Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Mon, 10 Jan 2011 01:24:52 +0100 Subject: [PATCH] improved saving, make it possible to recive actions in snorenotificationinstance --- src/core/snorenotificationinstance.cpp | 15 ++++++++++----- src/core/snorenotificationinstance.h | 9 ++++++++- src/snorenotify.cpp | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/core/snorenotificationinstance.cpp b/src/core/snorenotificationinstance.cpp index f1e6220..7db8da1 100644 --- a/src/core/snorenotificationinstance.cpp +++ b/src/core/snorenotificationinstance.cpp @@ -18,11 +18,8 @@ #include -SnoreNotificationInstance::SnoreNotificationInstance() -{ -} - SnoreNotificationInstance::SnoreNotificationInstance ( const QString &appname, SnoreServer *parent,const QString &icon ) : + Notification_Frontend(appname,parent), _app ( new Application ( appname ,icon) ), _snore ( parent ) { @@ -55,7 +52,15 @@ void SnoreNotificationInstance::unregisterWithBackends() int SnoreNotificationInstance::notify ( const QString &alert, const QString &title, const QString &text, const QString &icon, int timeout ) { - return _snore->broadcastNotification ( QSharedPointer ( new Notification ( NULL,_app->name(),alert,title,text,icon,timeout ) ) ); + return _snore->broadcastNotification ( QSharedPointer ( new Notification ( this,_app->name(),alert,title,text,icon,timeout ) ) ); +} + +void SnoreNotificationInstance::actionInvoked ( QSharedPointer notification ){ + emit notificationActionInvoked(notification); +} + +void SnoreNotificationInstance::notificationClosed ( QSharedPointer notification ){ + } #include "snorenotificationinstance.moc" diff --git a/src/core/snorenotificationinstance.h b/src/core/snorenotificationinstance.h index 02b6b96..251fa6d 100644 --- a/src/core/snorenotificationinstance.h +++ b/src/core/snorenotificationinstance.h @@ -20,8 +20,9 @@ #include "snore_exports.h" #include "snoreserver.h" #include "application.h" +#include "interface.h" -class SNORE_EXPORT SnoreNotificationInstance:public QObject +class SNORE_EXPORT SnoreNotificationInstance:public Notification_Frontend { Q_OBJECT public: @@ -31,6 +32,12 @@ public: void registerWithBackends(); void unregisterWithBackends(); int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10 ); + void actionInvoked ( QSharedPointer notification ); + void notificationClosed ( QSharedPointer notification ); + +signals: + void notificationActionInvoked ( QSharedPointer notification ); + private: SnoreNotificationInstance(); Application *_app; diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index 8a5c67d..48c0e8b 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -107,7 +107,7 @@ void SnoreNotify::save(){ file.open(QFile::WriteOnly); QTextStream ts( &file ); - ts << doc.toString(); + doc.save(ts,4); file.close(); }