fixed a crash

This commit is contained in:
Patrick von Reth 2011-08-11 05:14:09 -07:00
parent 830d46a208
commit 7727d37a67
1 changed files with 11 additions and 16 deletions

View File

@ -69,9 +69,13 @@ uint FreedesktopNotification_Backend::notify ( Notification noti )
message.setArguments(args); message.setArguments(args);
QDBusMessage replyMsg = QDBusConnection::sessionBus().call(message); QDBusMessage replyMsg = QDBusConnection::sessionBus().call(message);
uint id = replyMsg.arguments().last().toInt(); uint id ;
if(replyMsg.type() == QDBusMessage::ReplyMessage){
id= replyMsg.arguments().at(0).toUInt();
qDebug()<<"DBUS_ID"<<id;
activeNotifications[id] = noti; activeNotifications[id] = noti;
startTimeout(id,noti.timeout()); startTimeout(id,noti.timeout());
}
return id; return id;
} }
void FreedesktopNotification_Backend::actionInvoked(const uint &id, const QString &actionID){ void FreedesktopNotification_Backend::actionInvoked(const uint &id, const QString &actionID){
@ -79,8 +83,6 @@ void FreedesktopNotification_Backend::actionInvoked(const uint &id, const QStrin
qDebug() <<"Action"<<id<<"|"<<actionID ; qDebug() <<"Action"<<id<<"|"<<actionID ;
noti.setActionInvoked ( actionID == "default"?1:actionID.toInt() ); noti.setActionInvoked ( actionID == "default"?1:actionID.toInt() );
snore()->notificationActionInvoked ( noti ); snore()->notificationActionInvoked ( noti );
snore()->closeNotification(noti,NotificationEnums::CloseReasons::CLOSED);
} }
void FreedesktopNotification_Backend::closeNotification ( Notification notification ) void FreedesktopNotification_Backend::closeNotification ( Notification notification )
@ -94,21 +96,14 @@ void FreedesktopNotification_Backend::closeNotification ( Notification notificat
} }
//QString fNotification::vendor ( "" );
void FreedesktopNotification_Backend::closed ( const uint &id,const uint &reason ) void FreedesktopNotification_Backend::closed ( const uint &id,const uint &reason )
{ {
Notification noti = activeNotifications[id];
qDebug() <<"Closed"<<id<<"|"<<reason; qDebug() <<"Closed"<<id<<"|"<<reason;
NotificationEnums::CloseReasons::closeReasons r = NotificationEnums::CloseReasons::NONE; if(id == 0)
if ( reason==1 ) return;
r = NotificationEnums::CloseReasons::TIMED_OUT; Notification noti = activeNotifications.take(id);
else if ( reason==2 ) snore()->closeNotification ( noti ,QFlag(reason));
r = NotificationEnums::CloseReasons::DISMISSED;
snore()->closeNotification ( noti ,r);
} }
//QString fNotification::getVendor() //QString fNotification::getVendor()