telepathy-qt: BaseConnectionContactsInterface: Code uniformed with other classes.

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


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

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Tue Jun  2 20:14:15 2015 +0600

BaseConnectionContactsInterface: Code uniformed with other classes.

No actual changes.

---

 TelepathyQt/base-connection.cpp |   61 +++++++++++++++++++++------------------
 TelepathyQt/base-connection.h   |   21 +++++++-------
 2 files changed, 44 insertions(+), 38 deletions(-)

diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index 37275ac..fc50fd3 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -933,6 +933,18 @@ 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))
+    {
+    }
+
+    QStringList contactAttributeInterfaces;
+    GetContactAttributesCallback getContactAttributesCB;
+    BaseConnectionContactsInterface::Adaptee *adaptee;
+};
+
 BaseConnectionContactsInterface::Adaptee::Adaptee(BaseConnectionContactsInterface *interface)
     : QObject(interface),
       mInterface(interface)
@@ -943,31 +955,21 @@ BaseConnectionContactsInterface::Adaptee::~Adaptee()
 {
 }
 
-void BaseConnectionContactsInterface::Adaptee::getContactAttributes(const Tp::UIntList &handles,
-        const QStringList &interfaces, bool /*hold*/,
+QStringList BaseConnectionContactsInterface::Adaptee::contactAttributeInterfaces() const
+{
+    return mInterface->contactAttributeInterfaces();
+}
+
+void BaseConnectionContactsInterface::Adaptee::getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, bool /* hold */,
         const Tp::Service::ConnectionInterfaceContactsAdaptor::GetContactAttributesContextPtr &context)
 {
     DBusError error;
-    ContactAttributesMap contactAttributes = mInterface->getContactAttributes(handles, interfaces, &error);
+    Tp::ContactAttributesMap attributes = mInterface->getContactAttributes(handles, interfaces, &error);
     if (error.isValid()) {
         context->setFinishedWithError(error.name(), error.message());
         return;
     }
-    context->setFinished(contactAttributes);
-}
-
-struct TP_QT_NO_EXPORT BaseConnectionContactsInterface::Private {
-    Private(BaseConnectionContactsInterface *parent)
-        : adaptee(new BaseConnectionContactsInterface::Adaptee(parent)) {
-    }
-    QStringList contactAttributeInterfaces;
-    GetContactAttributesCallback getContactAttributesCallback;
-    BaseConnectionContactsInterface::Adaptee *adaptee;
-};
-
-QStringList BaseConnectionContactsInterface::Adaptee::contactAttributeInterfaces() const
-{
-    return mInterface->mPriv->contactAttributeInterfaces;
+    context->setFinished(attributes);
 }
 
 /**
@@ -1011,10 +1013,9 @@ QVariantMap BaseConnectionContactsInterface::immutableProperties() const
     return map;
 }
 
-void BaseConnectionContactsInterface::createAdaptor()
+QStringList BaseConnectionContactsInterface::contactAttributeInterfaces() const
 {
-    (void) new Service::ConnectionInterfaceContactsAdaptor(dbusObject()->dbusConnection(),
-            mPriv->adaptee, dbusObject());
+    return mPriv->contactAttributeInterfaces;
 }
 
 void BaseConnectionContactsInterface::setContactAttributeInterfaces(const QStringList &contactAttributeInterfaces)
@@ -1022,20 +1023,24 @@ void BaseConnectionContactsInterface::setContactAttributeInterfaces(const QStrin
     mPriv->contactAttributeInterfaces = contactAttributeInterfaces;
 }
 
+void BaseConnectionContactsInterface::createAdaptor()
+{
+    (void) new Tp::Service::ConnectionInterfaceContactsAdaptor(dbusObject()->dbusConnection(),
+            mPriv->adaptee, dbusObject());
+}
+
 void BaseConnectionContactsInterface::setGetContactAttributesCallback(const GetContactAttributesCallback &cb)
 {
-    mPriv->getContactAttributesCallback = cb;
+    mPriv->getContactAttributesCB = cb;
 }
 
-ContactAttributesMap BaseConnectionContactsInterface::getContactAttributes(const Tp::UIntList &handles,
-        const QStringList &interfaces,
-        DBusError *error)
+Tp::ContactAttributesMap BaseConnectionContactsInterface::getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error)
 {
-    if (!mPriv->getContactAttributesCallback.isValid()) {
+    if (!mPriv->getContactAttributesCB.isValid()) {
         error->set(TP_QT_ERROR_NOT_IMPLEMENTED, QLatin1String("Not implemented"));
-        return ContactAttributesMap();
+        return Tp::ContactAttributesMap();
     }
-    return mPriv->getContactAttributesCallback(handles, interfaces, error);
+    return mPriv->getContactAttributesCB(handles, interfaces, error);
 }
 
 // Conn.I.SimplePresence
diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h
index b390851..566b345 100644
--- a/TelepathyQt/base-connection.h
+++ b/TelepathyQt/base-connection.h
@@ -193,33 +193,34 @@ private:
     Private *mPriv;
 };
 
-
 class TP_QT_EXPORT BaseConnectionContactsInterface : public AbstractConnectionInterface
 {
     Q_OBJECT
     Q_DISABLE_COPY(BaseConnectionContactsInterface)
 
-
 public:
-    static BaseConnectionContactsInterfacePtr create() {
+    static BaseConnectionContactsInterfacePtr create()
+    {
         return BaseConnectionContactsInterfacePtr(new BaseConnectionContactsInterface());
     }
     template<typename BaseConnectionContactsInterfaceSubclass>
-    static SharedPtr<BaseConnectionContactsInterfaceSubclass> create() {
+    static SharedPtr<BaseConnectionContactsInterfaceSubclass> create()
+    {
         return SharedPtr<BaseConnectionContactsInterfaceSubclass>(
-                   new BaseConnectionContactsInterfaceSubclass());
+                new BaseConnectionContactsInterfaceSubclass());
     }
 
     virtual ~BaseConnectionContactsInterface();
 
     QVariantMap immutableProperties() const;
 
-    typedef Callback3<ContactAttributesMap, const Tp::UIntList&, const QStringList&, DBusError*> GetContactAttributesCallback;
-    void setGetContactAttributesCallback(const GetContactAttributesCallback &cb);
-    ContactAttributesMap getContactAttributes(const Tp::UIntList &handles,
-            const QStringList &interfaces,
-            DBusError *error);
+    QStringList contactAttributeInterfaces() const;
     void setContactAttributeInterfaces(const QStringList &contactAttributeInterfaces);
+
+    typedef Callback3<Tp::ContactAttributesMap, const Tp::UIntList &, const QStringList &, DBusError*> GetContactAttributesCallback;
+    void setGetContactAttributesCallback(const GetContactAttributesCallback &cb);
+    Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error);
+
 protected:
     BaseConnectionContactsInterface();
 



More information about the telepathy-commits mailing list