[Telepathy-commits] [telepathy-qt4/master] PendingChannel: Added objectPath().

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Tue Mar 17 01:51:54 PDT 2009


Added objectPath method on PendingChannel so custom channels can be constructed.
---
 TelepathyQt4/Client/pending-channel.cpp |   20 ++++++++++++++++++++
 TelepathyQt4/Client/pending-channel.h   |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/Client/pending-channel.cpp b/TelepathyQt4/Client/pending-channel.cpp
index 219876d..7e70706 100644
--- a/TelepathyQt4/Client/pending-channel.cpp
+++ b/TelepathyQt4/Client/pending-channel.cpp
@@ -280,6 +280,26 @@ ChannelPtr PendingChannel::channel() const
     return mPriv->channel;
 }
 
+/**
+ * Returns the channel object path or an empty string on error.
+ *
+ * This method is useful for creating custom Channel objects, so instead of using
+ * PendingChannel::channel, one could construct a new custom channel with
+ * the object path.
+ *
+ * \return Channel object path.
+ */
+QString PendingChannel::objectPath() const
+{
+    if (!isFinished()) {
+        warning() << "PendingChannel::channel called before finished";
+    } else if (!isValid()) {
+        warning() << "PendingChannel::channel called when not valid";
+    }
+
+    return mPriv->objectPath.path();
+}
+
 void PendingChannel::onCallCreateChannelFinished(QDBusPendingCallWatcher *watcher)
 {
     QDBusPendingReply<QDBusObjectPath, QVariantMap> reply = *watcher;
diff --git a/TelepathyQt4/Client/pending-channel.h b/TelepathyQt4/Client/pending-channel.h
index 3db51a4..cceb57f 100644
--- a/TelepathyQt4/Client/pending-channel.h
+++ b/TelepathyQt4/Client/pending-channel.h
@@ -63,6 +63,8 @@ public:
 
     ChannelPtr channel() const;
 
+    QString objectPath() const;
+
 private Q_SLOTS:
     void onCallCreateChannelFinished(QDBusPendingCallWatcher *watcher);
     void onCallEnsureChannelFinished(QDBusPendingCallWatcher *watcher);
-- 
1.5.6.5




More information about the telepathy-commits mailing list