tryed to clean up, could be that I faield

This commit is contained in:
Patrick von Reth 2011-07-20 17:30:35 +02:00
parent 15e824707f
commit 289d495c7b
19 changed files with 242 additions and 185 deletions

View File

@ -1,21 +1,20 @@
set ( SnoreNotify_SRCS
notification.cpp
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(notification)
set ( SnoreNotify_SRCS ${SnoreNotify_SRCS}
snoreserver.cpp
application.cpp
interface.cpp
utils.cpp
trayiconnotifer.cpp
snorenotificationinstance.cpp
)
set ( SnoreNotify_HDR
notification.h
set ( SnoreNotify_HDR ${SnoreNotify_HDR}
snoreserver.h
application.h
interface.h
snore_exports.h
utils.h
snorenotificationinstance.h
)
automoc4_add_library( snorecore SHARED ${SnoreNotify_SRCS})

View File

@ -17,7 +17,7 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include "snore_exports.h"
#include "notification.h"
#include "notification/notification.h"
class SNORE_EXPORT SnorePlugin:public QObject

View File

@ -0,0 +1,15 @@
set ( SnoreNotify_SRCS ${SnoreNotify_SRCS}
notification/notification.cpp
notification/icon.cpp
PARENT_SCOPE)
set ( Notification_HDR
notification.h
icon.h
)
install(FILES ${Notification_HDR} DESTINATION include/snore/core/notification)

View File

@ -0,0 +1,15 @@
set ( SnoreNotify_SRCS ${SnoreNotify_SRCS}
notification/notification.cpp
notification/icon.cpp
PARENT_SCOPE)
set ( Notification_HDR
notification/notification.h
notification/icon.h
)
install(FILES ${Notification_HDR} DESTINATION include/snore/core/notification)

View File

@ -0,0 +1,71 @@
/****************************************************************************************
* Copyright (c) 2011 Patrick von Reth <patrick.vonreth@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
* Foundation; either version 2 of the License, or (at your option) any later *
* version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "icon.h"
#include "../snoreserver.h"
#include <QCryptographichash>
#include <QBuffer>
#include <QHash>
QHash<QString,QString> NotificationIcon::hasedImages;
NotificationIcon::NotificationIcon():
_data(NULL)
{
}
NotificationIcon::NotificationIcon(const QImage &img):
_img(img)
{
QBuffer buffer( _data );
buffer.open( QBuffer::WriteOnly );
img.save( &buffer, "PNG" );
computeHash();
}
NotificationIcon::NotificationIcon(const QByteArray &img)
{
computeHash();
}
void NotificationIcon::computeHash(){
if(_hash.isEmpty()){
QCryptographicHash h(QCryptographicHash::Md5);
h.addData(*_data);
_hash = h.result().toHex();
}
}
const QImage &NotificationIcon::image() const{
return _img;
}
const QString &NotificationIcon::localUrl()const{
if(hasedImages.contains(_hash))
return hasedImages[_hash];
QString fp = SnoreServer::snoreTMP();
fp = fp.append("/").append(_hash).append(".png");
_img.save(fp,"PNG");
hasedImages[_hash] = fp;
return hasedImages[_hash];
}
#include "icon.moc"

View File

@ -0,0 +1,50 @@
/****************************************************************************************
* Copyright (c) 2011 Patrick von Reth <patrick.vonreth@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
* Foundation; either version 2 of the License, or (at your option) any later *
* version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#ifndef NOTIFICATION_ICON_H
#define NOTIFICATION_ICON_H
#include "../snore_exports.h"
#include <QImage>
class SNORE_EXPORT NotificationIcon
{
public:
NotificationIcon();
NotificationIcon(const QImage &img);
NotificationIcon(const QByteArray &img);
const QImage &image() const;
const QString &localUrl() const;
private:
static QHash<QString,QString> hasedImages;
private:
QImage _img;
QByteArray *_data;
QString _hash;
void computeHash();
};
#endif // NOTIFICATION_ICON_H

View File

@ -16,6 +16,7 @@
#include "notification.h"
#include "snoreserver.h"
#include "notification\icon.h"
#include <QDebug>
#include <QTcpSocket>
@ -24,6 +25,8 @@
#include <QTextDocument>
class Notification::NotificationData
{
public:
@ -31,11 +34,11 @@ public:
_id ( id ),
_timeout ( 10 ),
_source ( NULL ),
_closeReason(Notification::NONE),
_priority(Notification::NORMAL)
_closeReason(NotificationEnums::CloseReasons::NONE),
_priority(NotificationEnums::Prioritys::NORMAL)
{};
NotificationData ( Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const QString &icon,int timeout,uint id,Notification::prioritys priority ):
NotificationData ( Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const NotificationIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ):
_id ( id ),
_timeout ( timeout ),
_source ( source ),
@ -45,7 +48,7 @@ public:
_text ( text ),
_icon ( icon ),
_priority(priority),
_closeReason(Notification::NONE)
_closeReason(NotificationEnums::CloseReasons::NONE)
{};
@ -55,16 +58,16 @@ public:
uint _id;
int _timeout;
Action *_actionInvoked;
Notification::Action *_actionInvoked;
Notification_Frontend *_source;
QString _application;
QString _alert;
QString _title;
QString _text;
QString _icon;
Notification::prioritys _priority;
Notification::closeReasons _closeReason;
QMap<int,Action*> _actions;
NotificationIcon _icon;
NotificationEnums::Prioritys::prioritys _priority;
NotificationEnums::CloseReasons::closeReasons _closeReason;
QMap<int,Notification::Action*> _actions;
QVariantHash _hints;
};
@ -83,7 +86,7 @@ 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::prioritys priority )
Notification::Notification ( Notification_Frontend *source, const QString &application, const QString &alert, const QString &title, const QString &text, const NotificationIcon &icon, int timeout, uint id, NotificationEnums::Prioritys::prioritys priority )
{
d = QSharedPointer<NotificationData>(new NotificationData(source,application,alert,title,text,icon,timeout,id,priority));
}
@ -118,7 +121,7 @@ void Notification::setId(const uint &id)
d->_id = id;
}
const QString &Notification::icon() const
const NotificationIcon &Notification::icon() const
{
return d->_icon;
}
@ -128,7 +131,7 @@ const int &Notification::timeout() const
return d->_timeout;
}
const Action *Notification::actionInvoked() const
const Notification::Action *Notification::actionInvoked() const
{
return d->_actionInvoked;
}
@ -168,28 +171,28 @@ const QString &Notification::alert() const
return d->_alert;
}
const Notification::prioritys &Notification::priority() const
const NotificationEnums::Prioritys::prioritys &Notification::priority() const
{
return d->_priority;
}
void Notification::addAction(Action *a)
void Notification::addAction(Notification::Action *a)
{
qDebug()<<"Added notification"<<a->id<<a->name;
d->_actions.insert(a->id,a);
}
const QMap<int,Action*> &Notification::actions() const
const QMap<int,Notification::Action*> &Notification::actions() const
{
return d->_actions;
}
const Notification::closeReasons &Notification::closeReason(){
const NotificationEnums::CloseReasons::closeReasons &Notification::closeReason(){
return d->_closeReason;
}
void Notification::setCloseReason(const Notification::closeReasons &r){
void Notification::setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r){
d->_closeReason = r;
}
@ -214,7 +217,7 @@ QDataStream & operator<< ( QDataStream &stream, const Notification &noti )
return stream;
}
QDataStream & operator<< ( QDataStream &stream, const Action &a)
QDataStream & operator<< ( QDataStream &stream, const Notification::Action &a)
{
stream<<a.id<<a.id;
return stream;

View File

@ -16,32 +16,23 @@
#ifndef NOTIFICATION_H
#define NOTIFICATION_H
#include "snore_exports.h"
#include "application.h"
#include "../snore_exports.h"
#include "../application.h"
#include "icon.h"
#include <QVariant>
#include <QSharedPointer>
class Action
{
public:
Action(int id,QString name):id(id),name(name){}
int id;
QString name;
};
namespace NotificationEnums{
class SNORE_EXPORT Notification
{
public:
static int DefaultTimeout;
static QString toPlainText ( const QString &string );
namespace Prioritys{
enum prioritys{
LOW=-1,
NORMAL,
HIGH
};
}
namespace CloseReasons{
enum closeReason
{
NONE,
@ -50,9 +41,27 @@ public:
CLOSED
};
Q_DECLARE_FLAGS(closeReasons, closeReason)
Q_DECLARE_OPERATORS_FOR_FLAGS(closeReasons)
}
}
class SNORE_EXPORT Notification
{
public:
static int DefaultTimeout;
static QString toPlainText ( const QString &string );
class Action
{
public:
Action(int id,QString name):id(id),name(name){}
int id;
QString name;
};
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::prioritys priority = Notification::NORMAL );
Notification ( class Notification_Frontend *source,const QString &application,const QString &alert,const QString &title,const QString &text,const NotificationIcon &icon,int timeout=10,uint id=0, NotificationEnums::Prioritys::prioritys priority = NotificationEnums::Prioritys::NORMAL );
Notification ( const Notification &other );
~Notification();
Notification &operator=(const Notification& other);
@ -71,13 +80,13 @@ public:
const QString &application() const;
const QString &title() const;
const QString &text() const;
const QString &icon() const;
const NotificationIcon &icon() const;
const QString &alert() const;
const prioritys &priority() const;
const NotificationEnums::Prioritys::prioritys &priority() const;
const QMap<int,Action*> &actions() const;
void addAction(Action *a);
const closeReasons &closeReason();
void setCloseReason(const closeReasons &r);
const NotificationEnums::CloseReasons::closeReasons &closeReason();
void setCloseReason(const NotificationEnums::CloseReasons::closeReasons &r);
const QVariant hint ( const QString &key ) const;
bool hintExists ( const QString &key );
void insertHint ( const QString &key,const QVariant &val );
@ -88,8 +97,8 @@ private:
QSharedPointer<NotificationData> d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Notification::closeReasons)
QDataStream & operator<< ( QDataStream & stream, const Notification & noti );
QDataStream & operator<< ( QDataStream & stream, const Action & action);
QDataStream & operator<< ( QDataStream & stream, const Notification::Action & action);
#endif // NOTIFICATION_H

View File

@ -1,70 +0,0 @@
/****************************************************************************************
* Copyright (c) 2010 Patrick von Reth <patrick.vonreth@gmail.com> *
* *
* This program is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License as published by the Free Software *
* Foundation; either version 2 of the License, or (at your option) any later *
* version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT ANY *
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
* PARTICULAR PURPOSE. See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License along with *
* this program. If not, see <http://www.gnu.org/licenses/>. *
****************************************************************************************/
#include "snorenotificationinstance.h"
#include <QDebug>
SnoreNotificationInstance::SnoreNotificationInstance ( const QString &appname, SnoreServer *parent,const QString &icon ) :
Notification_Frontend(appname,parent),
_app ( new Application ( appname ,icon) ),
_snore ( parent )
{
setParent ( parent );
}
SnoreNotificationInstance::~SnoreNotificationInstance()
{
unregisterWithBackends();
}
void SnoreNotificationInstance::addAlert (const QString &name, const QString &title, const QString &icon)
{
_app->addAlert ( new Alert ( name,title.isNull() ?name:title,icon ) );
}
void SnoreNotificationInstance::registerWithBackends()
{
_snore->addApplication ( _app );
_snore->applicationIsInitialized ( _app );
}
void SnoreNotificationInstance::unregisterWithBackends()
{
_snore->removeApplication ( _app->name() );
}
int SnoreNotificationInstance::notify ( const QString &alert, const QString &title, const QString &text, const QString &icon, int timeout,Notification::prioritys priority,const QList<Action*> actions )
{
Notification notification = Notification( this,_app->name(),alert,title,text,icon,timeout,0,priority );
foreach(Action *a,actions){
notification.addAction(a);
}
return _snore->broadcastNotification ( notification );
}
void SnoreNotificationInstance::actionInvoked ( Notification notification ){
emit notificationActionInvoked(notification);
}
void SnoreNotificationInstance::notificationClosed ( Notification notification ){
}
#include "snorenotificationinstance.moc"

View File

@ -31,7 +31,7 @@ public:
void addAlert ( const QString &name,const QString &title = 0, const QString &icon="" );
void registerWithBackends();
void unregisterWithBackends();
int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10, Notification::prioritys priority = Notification::NORMAL,const QList<Action*> actions = QList<Action*>());
int notify ( const QString &alert,const QString &title,const QString &text,const QString &icon = 0,int timeout = 10, NotificationEnums::Prioritys::prioritys priority = NotificationEnums::Prioritys::NORMAL,const QList<Notification::Action*> *actions = NULL);
void actionInvoked ( Notification notification );
void notificationClosed ( Notification notification );

View File

@ -15,9 +15,8 @@
****************************************************************************************/
#include "snoreserver.h"
#include "notification.h"
#include "notification/notification.h"
#include "trayiconnotifer.h"
#include "snorenotificationinstance.h"
#include <iostream>
@ -63,11 +62,6 @@ SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) :
{
qDebug() <<"Inititalized";
_defaultNotificationInterface = new SnoreNotificationInstance ( "Snore",this );
if ( trayIcon!=NULL )
{
publicatePlugin ( new TrayIconNotifer ( this,trayIcon ) );
@ -149,7 +143,7 @@ int SnoreServer::broadcastNotification ( Notification notification )
return -1;
}
void SnoreServer::closeNotification ( Notification notification,const Notification::closeReasons &reason )
void SnoreServer::closeNotification ( Notification notification,const NotificationEnums::CloseReasons::closeReasons &reason )
{
qDebug()<<"closing notification"<<notification.id()<<"reason"<<reason;
notification.setCloseReason(reason);
@ -210,9 +204,5 @@ Notification_Backend * SnoreServer::primaryNotificationBackend(){
return _notificationBackend;
}
SnoreNotificationInstance * SnoreServer::defaultNotificationInterface()
{
return _defaultNotificationInterface;
}
#include "snoreserver.moc"

View File

@ -38,7 +38,7 @@ public:
int broadcastNotification ( Notification notification );
void closeNotification ( Notification notification, const Notification::closeReasons &reason );
void closeNotification ( Notification notification, const NotificationEnums::CloseReasons::closeReasons &reason );
void notificationActionInvoked ( Notification notification );
void addApplication ( Application *application );
@ -50,13 +50,10 @@ public:
void setPrimaryNotificationBackend ( Notification_Backend *backend );
Notification_Backend* primaryNotificationBackend();
class SnoreNotificationInstance *defaultNotificationInterface();
QHash<QString,SnorePlugin*> plugins;
private:
ApplicationsList _applications;
class SnoreNotificationInstance *_defaultNotificationInterface;
QHash<QString,Notification_Backend*> _notyfier;

View File

@ -2,7 +2,7 @@
#define TRAYICONNOTIFER_H
#include "interface.h"
#include "notification.h"
#include "notification/notification.h"
class TrayIconNotifer:public Notification_Backend
{

View File

@ -51,25 +51,17 @@ void FreedesktopNotification_Frontend::notificationClosed(Notification notificat
emit NotificationClosed(notification.id(),notification.closeReason());
}
QString FreedesktopNotification_Frontend::getImagefromHint(const FreedesktopImageHint &img){
QString filename=QString(SnoreServer::snoreTMP()).append(img.hash()).append(".png");
if(QFile::exists(filename))
return filename;
img.toQImage().save(filename,"PNG");
return filename;
}
uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint replaces_id,
const QString &app_icon, const QString &summary, const QString &body,
const QStringList &actions, const QVariantMap &hints, int timeout)
{
qDebug()<<app_name<<summary<<body<<app_icon;
QString icon;
NotificationIcon icon;
if(hints.contains("image_data")){
FreedesktopImageHint image;
hints["image_data"].value<QDBusArgument>()>>image;
icon=getImagefromHint(image);
icon = NotificationIcon(image.toQImage());
}
if(!snore()->aplications().contains(app_name)){
Application *a = new Application(app_name,app_icon);
@ -81,7 +73,7 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
qDebug()<<"Actions"<<actions;
for(int i = 0;i < actions.length(); i+=2){
noti.addAction(new Action(actions.at(i).toInt(),actions.at(i+1)));
noti.addAction(new Notification::Action(actions.at(i).toInt(),actions.at(i+1)));
}
snore()->broadcastNotification(noti);
@ -93,7 +85,7 @@ uint FreedesktopNotification_Frontend::Notify(const QString &app_name, uint repl
void FreedesktopNotification_Frontend::CloseNotification(uint id){
Notification noti = activeNotifications.take(id);
snore()->closeNotification(noti,Notification::TIMED_OUT);
snore()->closeNotification(noti,NotificationEnums::CloseReasons::TIMED_OUT);
}
QStringList FreedesktopNotification_Frontend::GetCapabilities()

View File

@ -25,7 +25,6 @@ class FreedesktopNotification_Frontend:public Notification_Frontend{
public:
FreedesktopNotification_Frontend(class SnoreServer *snore=0);
~FreedesktopNotification_Frontend();
QString getImagefromHint(const class FreedesktopImageHint &img);
void actionInvoked(Notification notification);
void notificationClosed(Notification notification);

View File

@ -42,14 +42,14 @@ QDBusArgument &operator<<(QDBusArgument &a, const FreedesktopNotification &i) {
qDebug()<<i.notification.toString();
a<<i.notification.application();
a<<uint(0);
a<<i.notification.icon();
a<<i.notification.icon().image();
a<<i.notification.title();
a<<i.notification.text();
QStringList actions;
actions<<"1"<<" "<<"2"<<" ";
a<<actions;
a.beginMap();
QImage img(i.notification.icon());
QImage img(i.notification.icon().image());
if (!img.isNull()) {
img=img.scaledToWidth(50,Qt::FastTransformation);
a.beginMapEntry();
@ -69,7 +69,7 @@ const QDBusArgument & operator >>(const QDBusArgument &a, FreedesktopNotificati
}
QHash<QString,void*> FreedesktopImageHint::hasedImages;
FreedesktopImageHint::FreedesktopImageHint()
{
@ -77,7 +77,6 @@ FreedesktopImageHint::FreedesktopImageHint()
}
FreedesktopImageHint::FreedesktopImageHint(const QImage &img)
{
FreedesktopNotification::registerTypes();
@ -92,20 +91,6 @@ FreedesktopImageHint::FreedesktopImageHint(const QImage &img)
}
QString FreedesktopImageHint::computeHash(){
if(this->_hash.isEmpty()){
Q_ASSERT(!imageData.isEmpty());
QCryptographicHash h(QCryptographicHash::Md5);
h.addData(imageData);
this->_hash = h.result().toHex();
}
return this->_hash;
}
QString FreedesktopImageHint::hash()const{
Q_ASSERT(!_hash.isEmpty());
return _hash;
}
QImage FreedesktopImageHint::toQImage() const {
return QImage((uchar*)imageData.data(),width,height,QImage::Format_ARGB32 ).rgbSwapped();
@ -122,6 +107,5 @@ const QDBusArgument & operator >>(const QDBusArgument &a, FreedesktopImageHint
a.beginStructure();
a >> i.width>> i.height>> i.rowstride>> i.hasAlpha>> i.bitsPerSample>> i.channels>> i.imageData;
a.endStructure();
FreedesktopImageHint::hasedImages.insert(i.computeHash(),NULL);
return a;
}

View File

@ -17,7 +17,7 @@
#ifndef FreedesktopNotification_H
#define FreedesktopNotification_H
#include "core/notification.h"
#include "core/notification/notification.h"
#include <QtDBus>
#include <QMetaType>
@ -43,13 +43,10 @@ const QDBusArgument & operator >>(const QDBusArgument &a, FreedesktopNotificati
class FreedesktopImageHint
{
public:
static QHash<QString,void*> hasedImages;
public:
FreedesktopImageHint();
FreedesktopImageHint(const QImage &img);
QString hash()const;
QString computeHash();
QImage toQImage()const;

View File

@ -44,7 +44,10 @@ Growl_Backend::~Growl_Backend(){
void Growl_Backend::registerApplication(Application *application){
gntp *growl = new gntp(application->name().toUtf8().constData());
foreach(Alert *a,application->alerts()){
growl->regist(a->name().toUtf8().constData());
try{
growl->regist(a->name().toUtf8().constData());
}catch(const std::exception& e){
}
}
_applications.insert(application->name(),growl);
}
@ -62,10 +65,13 @@ int Growl_Backend::notify(Notification notification){
return -1;
//qDebug()<<"Notify Growl:"<<notification.application()<<Notification.toPlainText(notification.title());
growl->notify(notification.alert().toUtf8().constData(),
Notification::toPlainText(notification.title()).toUtf8().constData(),
Notification::toPlainText(notification.text()).toUtf8().constData(),
notification.icon().isEmpty()?NULL:notification.icon().toUtf8().constData());
try{
growl->notify(notification.alert().toUtf8().constData(),
Notification::toPlainText(notification.title()).toUtf8().constData(),
Notification::toPlainText(notification.text()).toUtf8().constData(),
notification.icon().localUrl().isEmpty()?NULL:notification.icon().localUrl().toUtf8().constData());
}catch(const std::exception& e){
}
return ++id;
}

View File

@ -99,10 +99,10 @@ int Snarl_Backend::notify(Notification notification){
Notification::toPlainText(notification.title()).toUtf8().constData(),
Notification::toPlainText(notification.text()).toUtf8().constData(),
notification.timeout(),
notification.icon().isEmpty()?0:notification.icon().toUtf8().constData(),
notification.icon().localUrl().isEmpty()?0:notification.icon().localUrl().toUtf8().constData(),
0,notification.priority());
foreach(const Action *a, notification.actions()){
foreach(const Notification::Action *a, notification.actions()){
qDebug()<<"snarl add action"<<a->id<<a->name;
snarlInterface->AddAction(id,a->name.toUtf8().constData(),QString("@").append(QString::number(a->id)).toUtf8().constData());
}
@ -115,7 +115,7 @@ 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().localUrl().toUtf8().constData(),
0,notification.priority());
}
return id;
@ -152,21 +152,21 @@ bool SnarlWidget::winEvent(MSG * msg, long * result){
qDebug()<<_snarl->activeNotifications.keys();
Notification notification(_snarl->activeNotifications[notificationID]);
qDebug()<<"recived a Snarl callback id:"<<notificationID<<"action:"<<action<<"data:"<<data;
Notification::closeReasons reason = Notification::NONE;
NotificationEnums::CloseReasons::closeReasons reason = NotificationEnums::CloseReasons::NONE;
switch(action){
case SnarlEnums::CallbackInvoked:
reason = Notification::CLOSED;
reason = NotificationEnums::CloseReasons::CLOSED;
break;
case SnarlEnums::NotifyAction:
reason = Notification::CLOSED;
reason = NotificationEnums::CloseReasons::CLOSED;
notification.setActionInvoked(data);
_snarl->snore()->notificationActionInvoked(notification);
break;
case SnarlEnums::CallbackClosed:
reason = Notification::DISMISSED;
reason = NotificationEnums::CloseReasons::DISMISSED;
break;
case SnarlEnums::CallbackTimedOut:
reason = Notification::TIMED_OUT;
reason = NotificationEnums::CloseReasons::TIMED_OUT;
break;
default:
qDebug()<<"Unknown snarl action found!!";