telepathy-qt: BaseConnectionContactsInterface: BaseConnection added as private member.

Alexandr Akulich kaffeine at kemper.freedesktop.org
Sat Aug 29 05:49:54 PDT 2015


Module: telepathy-qt
Branch: master
Commit: 76ad0f3a2782f8acf1a6dc2484a294fa5469a5f7
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=76ad0f3a2782f8acf1a6dc2484a294fa5469a5f7

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Wed Jun  3 18:14:31 2015 +0600

BaseConnectionContactsInterface: BaseConnection added as private member.

Contacts interface is closely related to BaseConnection.
Added member is needed for BaseConnectionContactsInterface::getContactByID().

(The same story happend with another mandatory Connection interface:
BaseConnectionRequestsInterface::ensureChannel() requires BaseConnection ptr.)

---

 TelepathyQt/base-connection.cpp |   10 ++++++----
 TelepathyQt/base-connection.h   |   10 +++++-----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index fc50fd3..a8dc7f0 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -935,13 +935,15 @@ void BaseConnectionRequestsInterface::createChannel(const QVariantMap &request,
 // Conn.I.Contacts
 // The BaseConnectionContactsInterface code is fully or partially generated by the TelepathyQt-Generator.
 struct TP_QT_NO_EXPORT BaseConnectionContactsInterface::Private {
-    Private(BaseConnectionContactsInterface *parent)
-        : adaptee(new BaseConnectionContactsInterface::Adaptee(parent))
+    Private(BaseConnectionContactsInterface *parent, BaseConnection *connection)
+        : connection(connection),
+          adaptee(new BaseConnectionContactsInterface::Adaptee(parent))
     {
     }
 
     QStringList contactAttributeInterfaces;
     GetContactAttributesCallback getContactAttributesCB;
+    BaseConnection *connection;
     BaseConnectionContactsInterface::Adaptee *adaptee;
 };
 
@@ -983,9 +985,9 @@ void BaseConnectionContactsInterface::Adaptee::getContactAttributes(const Tp::UI
 /**
  * Class constructor.
  */
-BaseConnectionContactsInterface::BaseConnectionContactsInterface()
+BaseConnectionContactsInterface::BaseConnectionContactsInterface(BaseConnection *connection)
     : AbstractConnectionInterface(TP_QT_IFACE_CONNECTION_INTERFACE_CONTACTS),
-      mPriv(new Private(this))
+      mPriv(new Private(this, connection))
 {
 }
 
diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h
index 566b345..e2b1c65 100644
--- a/TelepathyQt/base-connection.h
+++ b/TelepathyQt/base-connection.h
@@ -199,15 +199,15 @@ class TP_QT_EXPORT BaseConnectionContactsInterface : public AbstractConnectionIn
     Q_DISABLE_COPY(BaseConnectionContactsInterface)
 
 public:
-    static BaseConnectionContactsInterfacePtr create()
+    static BaseConnectionContactsInterfacePtr create(BaseConnection *connection)
     {
-        return BaseConnectionContactsInterfacePtr(new BaseConnectionContactsInterface());
+        return BaseConnectionContactsInterfacePtr(new BaseConnectionContactsInterface(connection));
     }
     template<typename BaseConnectionContactsInterfaceSubclass>
-    static SharedPtr<BaseConnectionContactsInterfaceSubclass> create()
+    static SharedPtr<BaseConnectionContactsInterfaceSubclass> create(BaseConnection *connection)
     {
         return SharedPtr<BaseConnectionContactsInterfaceSubclass>(
-                new BaseConnectionContactsInterfaceSubclass());
+                new BaseConnectionContactsInterfaceSubclass(connection));
     }
 
     virtual ~BaseConnectionContactsInterface();
@@ -222,7 +222,7 @@ public:
     Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error);
 
 protected:
-    BaseConnectionContactsInterface();
+    BaseConnectionContactsInterface(BaseConnection *connection);
 
 private:
     void createAdaptor();



More information about the telepathy-commits mailing list