Remove notifications from plasmoid, if the notifications plugin gets disabled

Therefore notify the client that we're deleting all notifications.
Otherwise the client wouldn't notice this and the notifications would still
be available in the plasmoid.

REVIEW: 127582
This commit is contained in:
David Kahles 2016-04-06 00:25:12 +02:00
parent 12ccbaef98
commit aefa51fa86
4 changed files with 5 additions and 2 deletions

View file

@ -87,6 +87,8 @@ void NotificationsModel::setDeviceId(const QString& deviceId)
this, SLOT(notificationAdded(QString)));
connect(m_dbusInterface, SIGNAL(notificationRemoved(QString)),
this, SLOT(notificationRemoved(QString)));
connect(m_dbusInterface, SIGNAL(allNotificationsRemoved()),
this, SLOT(clearNotifications()));
refreshNotificationList();

View file

@ -69,6 +69,7 @@ private Q_SLOTS:
void notificationRemoved(const QString& id);
void refreshNotificationList();
void receivedNotifications(QDBusPendingCallWatcher* watcher);
void clearNotifications();
Q_SIGNALS:
void deviceIdChanged(const QString& value);
@ -76,8 +77,6 @@ Q_SIGNALS:
void rowsChanged();
private:
void clearNotifications();
DeviceNotificationsDbusInterface* m_dbusInterface;
QList<NotificationDbusInterface*> m_notificationList;
QString m_deviceId;

View file

@ -52,6 +52,7 @@ void NotificationsDbusInterface::clearNotifications()
{
qDeleteAll(mNotifications);
mNotifications.clear();
Q_EMIT allNotificationsRemoved();
}
QStringList NotificationsDbusInterface::activeNotifications()

View file

@ -53,6 +53,7 @@ public Q_SLOTS:
Q_SIGNALS:
Q_SCRIPTABLE void notificationPosted(const QString& publicId);
Q_SCRIPTABLE void notificationRemoved(const QString& publicId);
Q_SCRIPTABLE void allNotificationsRemoved();
private /*methods*/:
void removeNotification(const QString& internalId);