[Telepathy-commits] [telepathy-qt4/master] Invalidate statefulDbusProxy classes on getting nameOwnerChanged signal from DBus.
George Goldberg
george.goldberg at collabora.co.uk
Thu Jan 15 05:38:27 PST 2009
---
TelepathyQt4/Client/dbus-proxy.cpp | 12 ++++++++++++
TelepathyQt4/Client/dbus-proxy.h | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/TelepathyQt4/Client/dbus-proxy.cpp b/TelepathyQt4/Client/dbus-proxy.cpp
index db7e234..0e80e1d 100644
--- a/TelepathyQt4/Client/dbus-proxy.cpp
+++ b/TelepathyQt4/Client/dbus-proxy.cpp
@@ -26,6 +26,7 @@
#include "TelepathyQt4/debug-internal.h"
#include <QtCore/QTimer>
+#include <QtDBus/QDBusConnectionInterface>
namespace Telepathy
{
@@ -106,6 +107,9 @@ StatefulDBusProxy::StatefulDBusProxy(const QDBusConnection& dbusConnection,
const QString& busName, const QString& objectPath, QObject* parent)
: DBusProxy(dbusConnection, busName, objectPath, parent)
{
+ // FIXME: Am I on crack?
+ connect(dbusConnection.interface(), SIGNAL(serviceOwnerChanged(QString, QString, QString)),
+ this, SLOT(onServiceOwnerChanged(QString, QString, QString)));
}
bool StatefulDBusProxy::isValid() const
@@ -149,5 +153,13 @@ void StatefulDBusProxy::emitInvalidated()
emit invalidated(this, mPriv->invalidationReason, mPriv->invalidationMessage);
}
+void StatefulDBusProxy::onServiceOwnerChanged(const QString& name, const QString& oldOwner, const QString& newOwner)
+{
+ if (name == busName()) {
+ // FIXME: where do the error texts come from? the spec?
+ invalidate("NAME_OWNER_CHANGED", "NameOwnerChanged() received for this object.");
+ }
+}
+
}
}
diff --git a/TelepathyQt4/Client/dbus-proxy.h b/TelepathyQt4/Client/dbus-proxy.h
index eaa7aa2..80f16a2 100644
--- a/TelepathyQt4/Client/dbus-proxy.h
+++ b/TelepathyQt4/Client/dbus-proxy.h
@@ -192,6 +192,8 @@ Q_SIGNALS:
private Q_SLOTS:
void emitInvalidated();
+ void onServiceOwnerChanged(const QString& name, const QString& oldOwner,
+ const QString& newOwner);
private:
struct Private;
--
1.5.6.5
More information about the Telepathy-commits
mailing list