[telepathy-qt4/master] ChannelDispatchOperation: Handle Finished signal.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Jun 29 10:40:48 PDT 2009


Emit invalidated with TELEPATHY_QT4_ERROR_OBJECT_REMOVED when
ChannelDispatchOperation.Finished is received.
---
 TelepathyQt4/channel-dispatch-operation.cpp |   11 +++++++++++
 TelepathyQt4/channel-dispatch-operation.h   |    1 +
 TelepathyQt4/constants.h                    |    8 ++++++++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/channel-dispatch-operation.cpp b/TelepathyQt4/channel-dispatch-operation.cpp
index 9a7ed64..897c86f 100644
--- a/TelepathyQt4/channel-dispatch-operation.cpp
+++ b/TelepathyQt4/channel-dispatch-operation.cpp
@@ -95,6 +95,10 @@ ChannelDispatchOperation::Private::Private(ChannelDispatchOperation *parent)
 {
     debug() << "Creating new ChannelDispatchOperation:" << parent->objectPath();
 
+    parent->connect(baseInterface,
+            SIGNAL(Finished()),
+            SLOT(onFinished()));
+
     ReadinessHelper::Introspectables introspectables;
 
     // As ChannelDispatchOperation does not have predefined statuses let's simulate one (0)
@@ -284,6 +288,13 @@ Client::ChannelDispatchOperationInterface *ChannelDispatchOperation::baseInterfa
     return mPriv->baseInterface;
 }
 
+void ChannelDispatchOperation::onFinished()
+{
+    debug() << "ChannelDispatchOperation finished and was removed";
+    invalidate(TELEPATHY_QT4_ERROR_OBJECT_REMOVED,
+               "ChannelDispatchOperation finished and was removed");
+}
+
 void ChannelDispatchOperation::gotMainProperties(QDBusPendingCallWatcher *watcher)
 {
     QDBusPendingReply<QVariantMap> reply = *watcher;
diff --git a/TelepathyQt4/channel-dispatch-operation.h b/TelepathyQt4/channel-dispatch-operation.h
index 3091939..cf8058d 100644
--- a/TelepathyQt4/channel-dispatch-operation.h
+++ b/TelepathyQt4/channel-dispatch-operation.h
@@ -93,6 +93,7 @@ protected:
     Client::ChannelDispatchOperationInterface *baseInterface() const;
 
 private Q_SLOTS:
+    void onFinished();
     void gotMainProperties(QDBusPendingCallWatcher *watcher);
     void onConnectionReady(Tp::PendingOperation *op);
     void onAccountReady(Tp::PendingOperation *op);
diff --git a/TelepathyQt4/constants.h b/TelepathyQt4/constants.h
index 51735a7..e6ef12e 100644
--- a/TelepathyQt4/constants.h
+++ b/TelepathyQt4/constants.h
@@ -125,4 +125,12 @@
 #define TELEPATHY_DBUS_ERROR_UNKNOWN_METHOD \
     "org.freedesktop.DBus.Error.UnknownMethod"
 
+/**
+ * \ingroup errorstrconsts
+ *
+ * The error name "org.freedesktop.DBus.Error.ObjectRemoved".
+ */
+#define TELEPATHY_QT4_ERROR_OBJECT_REMOVED \
+    "org.freedesktop.Telepathy.Qt4.Error.ObjectRemoved"
+
 #endif
-- 
1.5.6.5




More information about the telepathy-commits mailing list