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; m_defaultTimeout = defaultTimeout;
} }
QDataStream &operator<< ( QDataStream &stream, const Notification &noti ) QDataStream &operator<< ( QDataStream &stream, const Notification &noti )
{ {
stream << "Title: " << noti.title() << " Text: " << noti.text() << " ID: " << noti.id() ; stream << "Title: " << noti.title() << " Text: " << noti.text() << " ID: " << noti.id() ;

View File

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

View File

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

View File

@ -41,7 +41,6 @@ public:
virtual ~SnoreFrontend(); virtual ~SnoreFrontend();
virtual bool init(SnoreCore *snore); virtual bool init(SnoreCore *snore);
public slots:
virtual void actionInvoked( Snore::Notification notification )=0; virtual void actionInvoked( Snore::Notification notification )=0;
virtual void notificationClosed( 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); Q_Q(const SnoreCore);
emit const_cast<SnoreCore*>(q)->actionInvoked(notification); emit const_cast<SnoreCore*>(q)->actionInvoked(notification);
SnoreFrontend *nf = notification.source(); if ( notification.source() )
if ( nf != NULL )
{ {
nf->actionInvoked ( notification ); notification.source()->actionInvoked ( notification );
} }
} }
@ -74,5 +73,9 @@ void SnoreCorePrivate::slotNotificationClosed(Notification n)
{ {
Q_Q(SnoreCore); Q_Q(SnoreCore);
emit q->notificationClosed(n); 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) { void FreedesktopFrontend::notificationClosed(Notification notification)
{
qDebug()<<"Closing Dbus notification"<<notification<<"reason:"<<(int)notification.closeReason();
emit NotificationClosed(notification.id(),notification.closeReason()); emit NotificationClosed(notification.id(),notification.closeReason());
} }

View File

@ -56,8 +56,6 @@ bool SnarlNetworkFrontend::init(SnoreCore *snore){
void SnarlNetworkFrontend::actionInvoked(Notification notification) void SnarlNetworkFrontend::actionInvoked(Notification notification)
{ {
//TODO:fix callback //TODO:fix callback
if(notification.source() == this)
{
SnarlNotification sn=notifications.value(notification.id()); SnarlNotification sn=notifications.value(notification.id());
if(notification.actionInvoked().id() == 1 ) if(notification.actionInvoked().id() == 1 )
{ {
@ -68,10 +66,7 @@ void SnarlNetworkFrontend::actionInvoked(Notification notification)
callback(sn,"SNP/1.1/302/Notification cancelled/"); callback(sn,"SNP/1.1/302/Notification cancelled/");
} }
} }
}
void SnarlNetworkFrontend::notificationClosed(Notification notification) void SnarlNetworkFrontend::notificationClosed(Notification notification)
{
if(notification.source() == this)
{ {
SnarlNotification sn=notifications.value(notification.id()); SnarlNotification sn=notifications.value(notification.id());
if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT) if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT)
@ -83,7 +78,6 @@ void SnarlNetworkFrontend::notificationClosed(Notification notification)
callback(sn,"SNP/1.1/307/Notification closed/"); callback(sn,"SNP/1.1/307/Notification closed/");
} }
} }
}
void SnarlNetworkFrontend::handleConnection(){ void SnarlNetworkFrontend::handleConnection(){
QTcpSocket *client = tcpServer->nextPendingConnection(); QTcpSocket *client = tcpServer->nextPendingConnection();