a real fix

This commit is contained in:
Patrick von Reth 2014-01-13 11:30:32 +01:00
parent cbe10a3619
commit aea46dc42a
7 changed files with 24 additions and 34 deletions

View File

@ -214,7 +214,6 @@ void Notification::setDefaultTimeout(int defaultTimeout)
m_defaultTimeout = defaultTimeout;
}
QDataStream &operator<< ( QDataStream &stream, const Notification &noti )
{
stream << "Title: " << noti.title() << " Text: " << noti.text() << " ID: " << noti.id() ;

View File

@ -98,6 +98,7 @@ public:
static void setDefaultTimeout(int defaultTimeout);
private:
Notification(const QString &,const QString &,const QString &,const QString &,const Icon &,int, NotificationEnums::Prioritys::prioritys );
QExplicitlySharedDataPointer<NotificationData> d;
static int m_defaultTimeout;

View File

@ -39,11 +39,6 @@ SnoreFrontend::~SnoreFrontend()
bool SnoreFrontend::init( SnoreCore *snore )
{
if(!SnorePlugin::init(snore))
{
return false;
}
connect(snore, SIGNAL(notificationClosed(Snore::Notification)), this, SLOT(notificationClosed(Snore::Notification)));
return true;
return SnorePlugin::init(snore);
}
}

View File

@ -41,7 +41,6 @@ public:
virtual ~SnoreFrontend();
virtual bool init(SnoreCore *snore);
public slots:
virtual void actionInvoked( Snore::Notification notification )=0;
virtual void notificationClosed( Snore::Notification notification )=0;
};

View File

@ -63,10 +63,9 @@ void SnoreCorePrivate::notificationActionInvoked(Notification notification) cons
{
Q_Q(const SnoreCore);
emit const_cast<SnoreCore*>(q)->actionInvoked(notification);
SnoreFrontend *nf = notification.source();
if ( nf != NULL )
if ( notification.source() )
{
nf->actionInvoked ( notification );
notification.source()->actionInvoked ( notification );
}
}
@ -74,5 +73,9 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
{
Q_Q(SnoreCore);
emit q->notificationClosed(n);
if(n.source())
{
n.source()->notificationClosed(n);
}
}

View File

@ -62,9 +62,8 @@ void FreedesktopFrontend::actionInvoked(Notification notification) {
}
}
void FreedesktopFrontend::notificationClosed(Notification notification) {
qDebug()<<"Closing Dbus notification"<<notification<<"reason:"<<(int)notification.closeReason();
void FreedesktopFrontend::notificationClosed(Notification notification)
{
emit NotificationClosed(notification.id(),notification.closeReason());
}

View File

@ -56,32 +56,26 @@ bool SnarlNetworkFrontend::init(SnoreCore *snore){
void SnarlNetworkFrontend::actionInvoked(Notification notification)
{
//TODO:fix callback
if(notification.source() == this)
SnarlNotification sn=notifications.value(notification.id());
if(notification.actionInvoked().id() == 1 )
{
SnarlNotification sn=notifications.value(notification.id());
if(notification.actionInvoked().id() == 1 )
{
callback(sn,"SNP/1.1/304/Notification acknowledged/");
}
else if(notification.actionInvoked().id() == 2)
{
callback(sn,"SNP/1.1/302/Notification cancelled/");
}
callback(sn,"SNP/1.1/304/Notification acknowledged/");
}
else if(notification.actionInvoked().id() == 2)
{
callback(sn,"SNP/1.1/302/Notification cancelled/");
}
}
void SnarlNetworkFrontend::notificationClosed(Notification notification)
{
if(notification.source() == this)
SnarlNotification sn=notifications.value(notification.id());
if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT)
{
SnarlNotification sn=notifications.value(notification.id());
if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT)
{
callback(sn,"SNP/1.1/303/Notification timed out/");
}
else
{
callback(sn,"SNP/1.1/307/Notification closed/");
}
callback(sn,"SNP/1.1/303/Notification timed out/");
}
else
{
callback(sn,"SNP/1.1/307/Notification closed/");
}
}