improved saving, make it possible to recive actions in snorenotificationinstance
This commit is contained in:
parent
0c87aa81a8
commit
9b23b6d80c
|
@ -18,11 +18,8 @@
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
SnoreNotificationInstance::SnoreNotificationInstance()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SnoreNotificationInstance::SnoreNotificationInstance ( const QString &appname, SnoreServer *parent,const QString &icon ) :
|
SnoreNotificationInstance::SnoreNotificationInstance ( const QString &appname, SnoreServer *parent,const QString &icon ) :
|
||||||
|
Notification_Frontend(appname,parent),
|
||||||
_app ( new Application ( appname ,icon) ),
|
_app ( new Application ( appname ,icon) ),
|
||||||
_snore ( parent )
|
_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 )
|
int SnoreNotificationInstance::notify ( const QString &alert, const QString &title, const QString &text, const QString &icon, int timeout )
|
||||||
{
|
{
|
||||||
return _snore->broadcastNotification ( QSharedPointer<Notification> ( new Notification ( NULL,_app->name(),alert,title,text,icon,timeout ) ) );
|
return _snore->broadcastNotification ( QSharedPointer<Notification> ( new Notification ( this,_app->name(),alert,title,text,icon,timeout ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnoreNotificationInstance::actionInvoked ( QSharedPointer<Notification> notification ){
|
||||||
|
emit notificationActionInvoked(notification);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SnoreNotificationInstance::notificationClosed ( QSharedPointer<Notification> notification ){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "snorenotificationinstance.moc"
|
#include "snorenotificationinstance.moc"
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
#include "snore_exports.h"
|
#include "snore_exports.h"
|
||||||
#include "snoreserver.h"
|
#include "snoreserver.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
#include "interface.h"
|
||||||
|
|
||||||
class SNORE_EXPORT SnoreNotificationInstance:public QObject
|
class SNORE_EXPORT SnoreNotificationInstance:public Notification_Frontend
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -31,6 +32,12 @@ public:
|
||||||
void registerWithBackends();
|
void registerWithBackends();
|
||||||
void unregisterWithBackends();
|
void unregisterWithBackends();
|
||||||
int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10 );
|
int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10 );
|
||||||
|
void actionInvoked ( QSharedPointer<Notification> notification );
|
||||||
|
void notificationClosed ( QSharedPointer<Notification> notification );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void notificationActionInvoked ( QSharedPointer<Notification> notification );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SnoreNotificationInstance();
|
SnoreNotificationInstance();
|
||||||
Application *_app;
|
Application *_app;
|
||||||
|
|
|
@ -107,7 +107,7 @@ void SnoreNotify::save(){
|
||||||
file.open(QFile::WriteOnly);
|
file.open(QFile::WriteOnly);
|
||||||
|
|
||||||
QTextStream ts( &file );
|
QTextStream ts( &file );
|
||||||
ts << doc.toString();
|
doc.save(ts,4);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue