[Telepathy-commits] [telepathy-qt4/master] Connection: Return a PendingReady object on requestConnect.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Fri Mar 13 14:08:10 PDT 2009


---
 TelepathyQt4/Client/connection-internal.h |    7 ++-----
 TelepathyQt4/Client/connection.cpp        |    7 +++----
 TelepathyQt4/Client/connection.h          |    2 +-
 TelepathyQt4/Client/pending-ready.h       |    2 +-
 tests/pinocchio/handles.cpp               |    1 +
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/TelepathyQt4/Client/connection-internal.h b/TelepathyQt4/Client/connection-internal.h
index c39e752..89535fa 100644
--- a/TelepathyQt4/Client/connection-internal.h
+++ b/TelepathyQt4/Client/connection-internal.h
@@ -24,7 +24,7 @@
 
 #include <TelepathyQt4/Client/Connection>
 
-#include <TelepathyQt4/Client/PendingOperation>
+#include <TelepathyQt4/Client/PendingReady>
 
 #include <QSet>
 
@@ -33,7 +33,7 @@ namespace Telepathy
 namespace Client
 {
 
-class Connection::PendingConnect : public PendingOperation
+class Connection::PendingConnect : public PendingReady
 {
     Q_OBJECT
 
@@ -43,9 +43,6 @@ public:
 private Q_SLOTS:
     void onConnectReply(QDBusPendingCallWatcher *);
     void onBecomeReadyReply(Telepathy::Client::PendingOperation *);
-
-private:
-    Features requestedFeatures;
 };
 
 } // Telepathy::Client
diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index e279b0c..372ad3a 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -386,8 +386,7 @@ void Connection::Private::introspectRoster(Connection::Private *self)
 }
 
 Connection::PendingConnect::PendingConnect(Connection *parent, const Features &requestedFeatures)
-    : PendingOperation(parent),
-      requestedFeatures(requestedFeatures)
+    : PendingReady(requestedFeatures, parent)
 {
     QDBusPendingCall call = parent->baseInterface()->Connect();
     QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, parent);
@@ -403,7 +402,7 @@ void Connection::PendingConnect::onConnectReply(QDBusPendingCallWatcher *watcher
         setFinishedWithError(watcher->error());
     }
     else {
-        connect(qobject_cast<Connection*>(parent())->becomeReady(requestedFeatures),
+        connect(qobject_cast<Connection*>(parent())->becomeReady(requestedFeatures()),
                 SIGNAL(finished(Telepathy::Client::PendingOperation*)),
                 SLOT(onBecomeReadyReply(Telepathy::Client::PendingOperation*)));
     }
@@ -1257,7 +1256,7 @@ PendingHandles *Connection::referenceHandles(uint handleType, const UIntList &ha
  *         for basic functionality, plus the given features, has succeeded or
  *         failed
  */
-PendingOperation *Connection::requestConnect(const Features &requestedFeatures)
+PendingReady *Connection::requestConnect(const Features &requestedFeatures)
 {
     return new PendingConnect(this, requestedFeatures);
 }
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index bb53b01..acfc40f 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -162,7 +162,7 @@ public:
 
     PendingChannel *ensureChannel(const QVariantMap &request);
 
-    PendingOperation *requestConnect(const Features &requestedFeatures = Features());
+    PendingReady *requestConnect(const Features &requestedFeatures = Features());
 
     PendingOperation *requestDisconnect();
 
diff --git a/TelepathyQt4/Client/pending-ready.h b/TelepathyQt4/Client/pending-ready.h
index f4f0cdf..1e25a62 100644
--- a/TelepathyQt4/Client/pending-ready.h
+++ b/TelepathyQt4/Client/pending-ready.h
@@ -41,6 +41,7 @@ class PendingReady: public PendingOperation
     Q_OBJECT
 
 public:
+    PendingReady(const Features &requestedFeatures, QObject *object);
     ~PendingReady();
 
     QObject *object() const;
@@ -49,7 +50,6 @@ public:
 
 private:
     Q_DISABLE_COPY(PendingReady);
-    PendingReady(const Features &requestedFeatures, QObject *object);
 
     struct Private;
     friend struct Private;
diff --git a/tests/pinocchio/handles.cpp b/tests/pinocchio/handles.cpp
index ed06a6b..5ce9700 100644
--- a/tests/pinocchio/handles.cpp
+++ b/tests/pinocchio/handles.cpp
@@ -12,6 +12,7 @@
 #include <TelepathyQt4/Client/Connection>
 #include <TelepathyQt4/Client/ConnectionManager>
 #include <TelepathyQt4/Client/PendingHandles>
+#include <TelepathyQt4/Client/PendingReady>
 #include <TelepathyQt4/Client/ReferencedHandles>
 
 #include <tests/pinocchio/lib.h>
-- 
1.5.6.5




More information about the telepathy-commits mailing list