[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:29:37 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=12ccbae
The following commit has been merged in the master branch:
commit 12ccbaef98b5b0d2beba1bbac95199becf633751
Author: David Kahles <david.kahles96 at gmail.com>
Date: Sun Apr 3 16:48:28 2016 +0200
Improve NotificationsModel
Don't refresh the whole notification list, if a notification is added or
removed.
REVIEW: 127565
---
interfaces/dbusinterfaces.cpp | 1 +
interfaces/dbusinterfaces.h | 4 ++++
interfaces/notificationsmodel.cpp | 20 ++++++++++++++------
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/interfaces/dbusinterfaces.cpp b/interfaces/dbusinterfaces.cpp
index d0883f8..74d4852 100644
--- a/interfaces/dbusinterfaces.cpp
+++ b/interfaces/dbusinterfaces.cpp
@@ -87,6 +87,7 @@ DeviceNotificationsDbusInterface::~DeviceNotificationsDbusInterface()
NotificationDbusInterface::NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent)
: OrgKdeKdeconnectDeviceNotificationsNotificationInterface(DaemonDbusInterface::activatedService(), "/modules/kdeconnect/devices/"+deviceId+"/notifications/"+notificationId, QDBusConnection::sessionBus(), parent)
+ , id(notificationId)
{
}
diff --git a/interfaces/dbusinterfaces.h b/interfaces/dbusinterfaces.h
index b5705e6..bccf9fa 100644
--- a/interfaces/dbusinterfaces.h
+++ b/interfaces/dbusinterfaces.h
@@ -99,6 +99,10 @@ class KDECONNECTINTERFACES_EXPORT NotificationDbusInterface
public:
NotificationDbusInterface(const QString& deviceId, const QString& notificationId, QObject* parent = nullptr);
virtual ~NotificationDbusInterface();
+
+ QString notificationId() { return id; }
+private:
+ const QString id;
};
diff --git a/interfaces/notificationsmodel.cpp b/interfaces/notificationsmodel.cpp
index ddf5c1f..0844d03 100644
--- a/interfaces/notificationsmodel.cpp
+++ b/interfaces/notificationsmodel.cpp
@@ -95,16 +95,24 @@ void NotificationsModel::setDeviceId(const QString& deviceId)
void NotificationsModel::notificationAdded(const QString& id)
{
- //TODO: Actually add instead of refresh
- Q_UNUSED(id);
- refreshNotificationList();
+ int currentSize = m_notificationList.size();
+ beginInsertRows(QModelIndex(), currentSize, currentSize);
+ NotificationDbusInterface* dbusInterface = new NotificationDbusInterface(m_deviceId, id, this);
+ m_notificationList.append(dbusInterface);
+ endInsertRows();
}
void NotificationsModel::notificationRemoved(const QString& id)
{
- //TODO: Actually remove instead of refresh
- Q_UNUSED(id);
- refreshNotificationList();
+ for (int i = 0; i < m_notificationList.size(); ++i) {
+ if (m_notificationList[i]->notificationId() == id) {
+ beginRemoveRows(QModelIndex(), i, i);
+ m_notificationList.removeAt(i);
+ endRemoveRows();
+ return;
+ }
+ }
+ qCWarning(KDECONNECT_INTERFACES) << "Attempted to remove unknown notification: " << id;
}
void NotificationsModel::refreshNotificationList()
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list