[telepathy-qt4/master] RoomListChannel: Make constructor protected and added public create method that returns a SharedPtr.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Tue Mar 31 14:28:12 PDT 2009


---
 TelepathyQt4/Client/file-transfer.cpp   |   13 +++++++++----
 TelepathyQt4/Client/file-transfer.h     |    9 +++++++--
 TelepathyQt4/Client/pending-channel.cpp |    5 ++---
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/TelepathyQt4/Client/file-transfer.cpp b/TelepathyQt4/Client/file-transfer.cpp
index 9987ca8..1cb2703 100644
--- a/TelepathyQt4/Client/file-transfer.cpp
+++ b/TelepathyQt4/Client/file-transfer.cpp
@@ -57,6 +57,13 @@ FileTransfer::Private::~Private()
  * FileTransfer interface. Until then, it's just a Channel.
  */
 
+FileTransferPtr FileTransfer::create(const ConnectionPtr &connection,
+        const QString &objectPath, const QVariantMap &immutableProperties)
+{
+    return FileTransferPtr(new FileTransfer(connection, objectPath,
+                immutableProperties));
+}
+
 /**
  * Creates a FileTransfer associated with the given object on the same service
  * as the given connection.
@@ -67,12 +74,10 @@ FileTransfer::Private::~Private()
  * \param immutableProperties  The immutable properties of the channel, as
  *                             signalled by NewChannels or returned by
  *                             CreateChannel or EnsureChannel
- * \param parent      Passed to the parent class constructor.
  */
-FileTransfer::FileTransfer(Connection *connection,
+FileTransfer::FileTransfer(const ConnectionPtr &connection,
         const QString &objectPath,
-        const QVariantMap &immutableProperties,
-        QObject *parent)
+        const QVariantMap &immutableProperties)
     : Channel(connection, objectPath, immutableProperties),
       mPriv(new Private())
 {
diff --git a/TelepathyQt4/Client/file-transfer.h b/TelepathyQt4/Client/file-transfer.h
index f493173..0eaace3 100644
--- a/TelepathyQt4/Client/file-transfer.h
+++ b/TelepathyQt4/Client/file-transfer.h
@@ -38,10 +38,15 @@ class FileTransfer : public Channel
     Q_DISABLE_COPY(FileTransfer)
 
 public:
-    FileTransfer(Connection *connection, const QString &objectPath,
-            const QVariantMap &immutableProperties, QObject *parent = 0);
+    static FileTransferPtr create(const ConnectionPtr &connection,
+            const QString &objectPath, const QVariantMap &immutableProperties);
+
     ~FileTransfer();
 
+protected:
+    FileTransfer(const ConnectionPtr &connection, const QString &objectPath,
+            const QVariantMap &immutableProperties);
+
 private:
     struct Private;
     friend struct Private;
diff --git a/TelepathyQt4/Client/pending-channel.cpp b/TelepathyQt4/Client/pending-channel.cpp
index 5f35588..1bc1a66 100644
--- a/TelepathyQt4/Client/pending-channel.cpp
+++ b/TelepathyQt4/Client/pending-channel.cpp
@@ -270,9 +270,8 @@ ChannelPtr PendingChannel::channel() const
     }
     // FIXME: update spec so we can do this properly
     else if (channelType() == "org.freedesktop.Telepathy.Channel.Type.FileTransfer") {
-        mPriv->channel = ChannelPtr(
-                new FileTransfer(mPriv->connection.data(), mPriv->objectPath.path(),
-                    mPriv->immutableProperties));
+        mPriv->channel = FileTransfer::create(mPriv->connection,
+                mPriv->objectPath.path(), mPriv->immutableProperties);
     }
     else {
         // ContactList, old-style Tubes, or a future channel type
-- 
1.5.6.5




More information about the telepathy-commits mailing list