telepathy-qt: AbstractDBusServiceInterface: Added notifyPropertyChanged() method.
David Edmundson
davidedmundson at kemper.freedesktop.org
Thu Feb 12 05:48:03 PST 2015
Module: telepathy-qt
Branch: master
Commit: 8443f7c5650304377a63462e8a480f94dee2a308
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=8443f7c5650304377a63462e8a480f94dee2a308
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date: Tue Feb 10 18:47:28 2015 +0500
AbstractDBusServiceInterface: Added notifyPropertyChanged() method.
---
TelepathyQt/dbus-service.cpp | 27 +++++++++++++++++++++++++++
TelepathyQt/dbus-service.h | 3 +++
2 files changed, 30 insertions(+)
diff --git a/TelepathyQt/dbus-service.cpp b/TelepathyQt/dbus-service.cpp
index 607003e..c6dcab8 100644
--- a/TelepathyQt/dbus-service.cpp
+++ b/TelepathyQt/dbus-service.cpp
@@ -283,6 +283,33 @@ bool AbstractDBusServiceInterface::isRegistered() const
}
/**
+ * Emit PropertiesChanged signal on object org.freedesktop.DBus.Properties interface
+ * with the property \a propertyName.
+ *
+ * \param propertyName The name of the changed property.
+ * \param propertyValue The actual value of the changed property.
+ * \return \c false if the signal can not be emmited or \a true otherwise.
+ */
+bool AbstractDBusServiceInterface::notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue)
+{
+ if (!isRegistered()) {
+ return false;
+ }
+
+ QDBusMessage signal = QDBusMessage::createSignal(dbusObject()->objectPath(),
+ TP_QT_IFACE_PROPERTIES,
+ QLatin1String("PropertiesChanged"));
+ QVariantMap changedProperties;
+ changedProperties.insert(propertyName, propertyValue);
+
+ signal << interfaceName();
+ signal << changedProperties;
+ signal << QStringList();
+
+ return dbusObject()->dbusConnection().send(signal);
+}
+
+/**
* Registers this interface by plugging its adaptor
* on the given \a dbusObject.
*
diff --git a/TelepathyQt/dbus-service.h b/TelepathyQt/dbus-service.h
index 59f6d2b..d584b89 100644
--- a/TelepathyQt/dbus-service.h
+++ b/TelepathyQt/dbus-service.h
@@ -90,6 +90,9 @@ protected:
virtual bool registerInterface(DBusObject *dbusObject);
virtual void createAdaptor() = 0;
+public:
+ bool notifyPropertyChanged(const QString &propertyName, const QVariant &propertyValue);
+
private:
class Private;
friend class Private;
More information about the telepathy-commits
mailing list