Fix addNotification being called twice

It broke the notifications, which is probably a different bug

Reviewed by Albert Astals
This commit is contained in:
Albert Vaca 2018-03-24 21:28:35 +01:00
parent da8f3d19d0
commit 22d14de018
2 changed files with 9 additions and 3 deletions

View file

@ -56,6 +56,13 @@ QStringList NotificationsDbusInterface::activeNotifications()
return m_notifications.keys();
}
void NotificationsDbusInterface::notificationReady()
{
Notification* noti = static_cast<Notification*>(sender());
disconnect(noti, &Notification::ready, this, &NotificationsDbusInterface::notificationReady);
addNotification(noti);
}
void NotificationsDbusInterface::processPacket(const NetworkPacket& np)
{
if (np.get<bool>(QStringLiteral("isCancel"))) {
@ -73,9 +80,7 @@ void NotificationsDbusInterface::processPacket(const NetworkPacket& np)
if (noti->isReady()) {
addNotification(noti);
} else {
connect(noti, &Notification::ready, this, [this, noti]{
addNotification(noti);
});
connect(noti, &Notification::ready, this, &NotificationsDbusInterface::notificationReady);
}
} else {
QString pubId = m_internalIdToPublicId.value(id);

View file

@ -62,6 +62,7 @@ Q_SIGNALS:
private /*methods*/:
void removeNotification(const QString& internalId);
QString newId(); //Generates successive identifitiers to use as public ids
void notificationReady();
private /*attributes*/:
const Device* m_device;