removed unused is notification stuff, should be reimplemented with hints, added priority support
This commit is contained in:
parent
fa92da30d7
commit
120245cb41
|
@ -32,10 +32,10 @@ public:
|
|||
_timeout ( 10 ),
|
||||
_source ( NULL ),
|
||||
_closeReason(Notification::NONE),
|
||||
_notification( true )
|
||||
_priority(0)
|
||||
{};
|
||||
|
||||
NotificationData ( class Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const QString &icon,int timeout=10,uint id=0 ):
|
||||
NotificationData ( Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const QString &icon,int timeout,uint id,int priority ):
|
||||
_id ( id ),
|
||||
_timeout ( timeout ),
|
||||
_source ( source ),
|
||||
|
@ -44,8 +44,8 @@ public:
|
|||
_title ( title ),
|
||||
_text ( text ),
|
||||
_icon ( icon ),
|
||||
_closeReason(Notification::NONE),
|
||||
_notification( true )
|
||||
_priority(priority),
|
||||
_closeReason(Notification::NONE)
|
||||
{};
|
||||
|
||||
|
||||
|
@ -62,13 +62,10 @@ public:
|
|||
QString _title;
|
||||
QString _text;
|
||||
QString _icon;
|
||||
int _priority;
|
||||
Notification::closeReasons _closeReason;
|
||||
QMap<int,Action*> _actions;
|
||||
QVariantHash _hints;
|
||||
|
||||
bool _notification;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -86,9 +83,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 QString &icon, int timeout, uint id )
|
||||
Notification::Notification ( Notification_Frontend *source, const QString &application, const QString &alert, const QString &title, const QString &text, const QString &icon, int timeout, uint id, int priority )
|
||||
{
|
||||
d = QSharedPointer<NotificationData>(new NotificationData(source,application,alert,title,text,icon,timeout,id));
|
||||
d = QSharedPointer<NotificationData>(new NotificationData(source,application,alert,title,text,icon,timeout,id,priority));
|
||||
}
|
||||
|
||||
Notification::Notification ( const Notification &other ):
|
||||
|
@ -110,16 +107,6 @@ QString Notification::toString() const
|
|||
return QString ( "Title: "+d->_title+"\nText: "+d->_text );
|
||||
}
|
||||
|
||||
|
||||
bool Notification::isNotification()
|
||||
{
|
||||
return d->_notification;
|
||||
}
|
||||
|
||||
void Notification::setIsNotification ( bool b )
|
||||
{
|
||||
d->_notification=b;
|
||||
}
|
||||
const uint &Notification::id() const
|
||||
{
|
||||
return d->_id;
|
||||
|
@ -181,6 +168,11 @@ const QString &Notification::alert() const
|
|||
return d->_alert;
|
||||
}
|
||||
|
||||
const int &Notification::priority() const
|
||||
{
|
||||
return d->_priority;
|
||||
}
|
||||
|
||||
void Notification::addAction(Action *a)
|
||||
{
|
||||
qDebug()<<"Added notification"<<a->id<<a->name;
|
||||
|
|
|
@ -47,14 +47,12 @@ public:
|
|||
Q_DECLARE_FLAGS(closeReasons, closeReason)
|
||||
public:
|
||||
Notification ( uint id=0 );
|
||||
Notification ( class Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const QString &icon,int timeout=10,uint id=0 );
|
||||
Notification ( class Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const QString &icon,int timeout=10,uint id=0, int priority = 0 );
|
||||
Notification ( const Notification &other );
|
||||
~Notification();
|
||||
Notification &operator=(const Notification& other);
|
||||
|
||||
QString toString() const;
|
||||
bool isNotification();
|
||||
void setIsNotification ( bool b );
|
||||
|
||||
const uint &id() const;
|
||||
void setId(const uint &id);
|
||||
|
@ -70,6 +68,7 @@ public:
|
|||
const QString &text() const;
|
||||
const QString &icon() const;
|
||||
const QString &alert() const;
|
||||
const int &priority() const;
|
||||
const QMap<int,Action*> &actions() const;
|
||||
void addAction(Action *a);
|
||||
const closeReasons &closeReason();
|
||||
|
|
|
@ -46,7 +46,7 @@ void FreedesktopNotification_Frontend::actionInvoked(Notification notification)
|
|||
|
||||
void FreedesktopNotification_Frontend::notificationClosed(Notification notification) {
|
||||
|
||||
qDebug()<<"Closing Dbus notification"<<notification.id()<<"reason:"<<notification.closeReason();
|
||||
qDebug()<<"Closing Dbus notification"<<notification.id()<<"reason:"<<(int)notification.closeReason();
|
||||
emit NotificationClosed(notification.id(),notification.closeReason());
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,8 @@ void Snarl_Backend::registerApplication(Application *application){
|
|||
|
||||
foreach(Alert *alert,application->alerts()){
|
||||
snarlInterface->AddClass(application->name().toUtf8().constData(),
|
||||
alert->name().toUtf8().constData());
|
||||
alert->name().toUtf8().constData(),
|
||||
0,0,alert->icon().toUtf8().constData());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,8 @@ int Snarl_Backend::notify(Notification notification){
|
|||
Notification::toPlainText(notification.title()).toUtf8().constData(),
|
||||
Notification::toPlainText(notification.text()).toUtf8().constData(),
|
||||
notification.timeout(),
|
||||
notification.icon().toUtf8().constData());
|
||||
notification.icon().isEmpty()?0:notification.icon().toUtf8().constData(),
|
||||
0,notification.priority()-2);
|
||||
|
||||
foreach(const Action *a, notification.actions()){
|
||||
qDebug()<<"snarl add action"<<a->id<<a->name;
|
||||
|
@ -111,7 +113,8 @@ int Snarl_Backend::notify(Notification notification){
|
|||
Notification::toPlainText(notification.title()).toUtf8().constData(),
|
||||
Notification::toPlainText(notification.text()).toUtf8().constData(),
|
||||
notification.timeout(),
|
||||
notification.icon().toUtf8().constData());
|
||||
notification.icon().toUtf8().constData(),
|
||||
0,notification.priority()-2);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue