[telepathy-qt4/master] RoomList: 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:16:01 PDT 2009


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

diff --git a/TelepathyQt4/Client/pending-channel.cpp b/TelepathyQt4/Client/pending-channel.cpp
index 1dc8a0c..5f35588 100644
--- a/TelepathyQt4/Client/pending-channel.cpp
+++ b/TelepathyQt4/Client/pending-channel.cpp
@@ -265,9 +265,8 @@ ChannelPtr PendingChannel::channel() const
                 mPriv->objectPath.path(), mPriv->immutableProperties);
     }
     else if (channelType() == TELEPATHY_INTERFACE_CHANNEL_TYPE_ROOM_LIST) {
-        mPriv->channel = ChannelPtr(
-                new RoomList(mPriv->connection.data(), mPriv->objectPath.path(),
-                    mPriv->immutableProperties));
+        mPriv->channel = RoomList::create(mPriv->connection,
+                mPriv->objectPath.path(), mPriv->immutableProperties);
     }
     // FIXME: update spec so we can do this properly
     else if (channelType() == "org.freedesktop.Telepathy.Channel.Type.FileTransfer") {
diff --git a/TelepathyQt4/Client/room-list.cpp b/TelepathyQt4/Client/room-list.cpp
index afa5030..b875c58 100644
--- a/TelepathyQt4/Client/room-list.cpp
+++ b/TelepathyQt4/Client/room-list.cpp
@@ -56,6 +56,13 @@ RoomList::Private::~Private()
  * RoomList interface. Until then, it's just a Channel.
  */
 
+RoomListPtr RoomList::create(const ConnectionPtr &connection,
+        const QString &objectPath, const QVariantMap &immutableProperties)
+{
+    return RoomListPtr(new RoomList(connection, objectPath,
+                immutableProperties));
+}
+
 /**
  * Creates a RoomList associated with the given object on the same service
  * as the given connection.
@@ -66,12 +73,10 @@ RoomList::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.
  */
-RoomList::RoomList(Connection *connection,
+RoomList::RoomList(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/room-list.h b/TelepathyQt4/Client/room-list.h
index be1d8dd..82ca013 100644
--- a/TelepathyQt4/Client/room-list.h
+++ b/TelepathyQt4/Client/room-list.h
@@ -38,10 +38,15 @@ class RoomList : public Channel
     Q_DISABLE_COPY(RoomList)
 
 public:
-    RoomList(Connection *connection, const QString &objectPath,
-            const QVariantMap &immutableProperties, QObject *parent = 0);
+    static RoomListPtr create(const ConnectionPtr &connection,
+            const QString &objectPath, const QVariantMap &immutableProperties);
+
     ~RoomList();
 
+protected:
+    RoomList(const ConnectionPtr &connection, const QString &objectPath,
+            const QVariantMap &immutableProperties);
+
 private:
     struct Private;
     friend struct Private;
-- 
1.5.6.5




More information about the telepathy-commits mailing list