improved notification interface

This commit is contained in:
Patrick von Reth 2011-07-23 16:26:05 +02:00
parent 8b84a18172
commit 12d3c68df3
3 changed files with 12 additions and 6 deletions

View File

@ -38,10 +38,10 @@ public:
_priority(NotificationEnums::Prioritys::NORMAL)
{}
NotificationData ( Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ):
NotificationData ( const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ):
_id ( id ),
_timeout ( timeout ),
_source ( source ),
_source ( NULL),
_application ( application ),
_alert ( alert ),
_title ( title ),
@ -86,9 +86,9 @@ Notification::Notification ( uint id )
d = QSharedPointer<NotificationData>(new NotificationData(id));
}
Notification::Notification ( Notification_Frontend *source, const QString &application, const QString &alert, const QString &title, const QString &text, const SnoreIcon &icon, int timeout, uint id, NotificationEnums::Prioritys::prioritys priority )
Notification::Notification ( const QString &application, const QString &alert, const QString &title, const QString &text, const SnoreIcon &icon, int timeout, uint id, NotificationEnums::Prioritys::prioritys priority )
{
d = QSharedPointer<NotificationData>(new NotificationData(source,application,alert,title,text,icon,timeout,id,priority));
d = QSharedPointer<NotificationData>(new NotificationData(application,alert,title,text,icon,timeout,id,priority));
}
Notification::Notification ( const Notification &other ):
@ -146,6 +146,10 @@ void Notification::setActionInvoked ( const int &id)
d->_actionInvoked = d->_actions[id];
}
void Notification::setSource(Notification_Frontend *source) const{
d->_source = source;
}
Notification_Frontend *Notification::source() const
{
return d->_source;

View File

@ -63,7 +63,7 @@ public:
public:
Notification ( uint id=0 );
Notification ( class Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout=10,uint id=0, NotificationEnums::Prioritys::prioritys priority = NotificationEnums::Prioritys::NORMAL );
Notification (const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout=10,uint id=0, NotificationEnums::Prioritys::prioritys priority = NotificationEnums::Prioritys::NORMAL );
Notification ( const Notification &other );
~Notification();
Notification &operator=(const Notification& other);
@ -78,6 +78,7 @@ public:
void setActionInvoked ( const int &actionID);
//const Notification::defaultActions &actionInvoked() const;
const Action* actionInvoked() const;
void setSource(class Notification_Frontend *source)const;
class Notification_Frontend *source() const;
const QString &application() const;
const QString &title() const;

View File

@ -88,7 +88,8 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
Notification noti(this,app_name,"DBus Alert",summary,body,icon,timeout==-1?Notification::DefaultTimeout:timeout/1000,replaces_id,priotity);
Notification noti(app_name,"DBus Alert",summary,body,icon,timeout==-1?Notification::DefaultTimeout:timeout/1000,replaces_id,priotity);
noti.setSource(this);
qDebug()<<"Actions"<<actions;
for(int i = 0;i < actions.length(); i+=2){