telepathy-qt: Services/Channel, Connection: Added a method to set base for interface.

Alexandr Akulich kaffeine at kemper.freedesktop.org
Fri Nov 20 08:40:11 PST 2015


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

Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Sun Oct 11 14:31:41 2015 +0500

Services/Channel, Connection: Added a method to set base for interface.

Added a virtual method to set base for an interface.
This let us to use base methods without adding a new argument to
interface create() method.

The base class calls the virtual method on interface plug in.

---

 TelepathyQt/base-channel.cpp    |    6 ++++++
 TelepathyQt/base-channel.h      |    3 +++
 TelepathyQt/base-connection.cpp |    6 ++++++
 TelepathyQt/base-connection.h   |    3 +++
 4 files changed, 18 insertions(+)

diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index 8eb33cf..bb8efe7 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -346,6 +346,7 @@ bool BaseChannel::plugInterface(const AbstractChannelInterfacePtr &interface)
 
     debug() << "Interface" << interface->interfaceName() << "plugged";
     mPriv->interfaces.insert(interface->interfaceName(), interface);
+    interface->setBaseChannel(this);
     return true;
 }
 
@@ -366,6 +367,11 @@ AbstractChannelInterface::~AbstractChannelInterface()
 {
 }
 
+void AbstractChannelInterface::setBaseChannel(BaseChannel *channel)
+{
+    Q_UNUSED(channel)
+}
+
 // Chan.T.Text
 BaseChannelTextType::Adaptee::Adaptee(BaseChannelTextType *interface)
     : QObject(interface),
diff --git a/TelepathyQt/base-channel.h b/TelepathyQt/base-channel.h
index d59d16a..af54835 100644
--- a/TelepathyQt/base-channel.h
+++ b/TelepathyQt/base-channel.h
@@ -103,6 +103,9 @@ public:
     AbstractChannelInterface(const QString &interfaceName);
     virtual ~AbstractChannelInterface();
 
+protected:
+    virtual void setBaseChannel(BaseChannel *channel);
+
 private:
     friend class BaseChannel;
 
diff --git a/TelepathyQt/base-connection.cpp b/TelepathyQt/base-connection.cpp
index a332a56..d62b031 100644
--- a/TelepathyQt/base-connection.cpp
+++ b/TelepathyQt/base-connection.cpp
@@ -656,6 +656,7 @@ bool BaseConnection::plugInterface(const AbstractConnectionInterfacePtr &interfa
 
     debug() << "Interface" << interface->interfaceName() << "plugged";
     mPriv->interfaces.insert(interface->interfaceName(), interface);
+    interface->setBaseConnection(this);
     return true;
 }
 
@@ -797,6 +798,11 @@ AbstractConnectionInterface::~AbstractConnectionInterface()
 {
 }
 
+void AbstractConnectionInterface::setBaseConnection(BaseConnection *connection)
+{
+    Q_UNUSED(connection)
+}
+
 // Conn.I.Requests
 BaseConnectionRequestsInterface::Adaptee::Adaptee(BaseConnectionRequestsInterface *interface)
     : QObject(interface),
diff --git a/TelepathyQt/base-connection.h b/TelepathyQt/base-connection.h
index 76eef59..044f0be 100644
--- a/TelepathyQt/base-connection.h
+++ b/TelepathyQt/base-connection.h
@@ -143,6 +143,9 @@ public:
     AbstractConnectionInterface(const QString &interfaceName);
     virtual ~AbstractConnectionInterface();
 
+protected:
+    virtual void setBaseConnection(BaseConnection *connection);
+
 private:
     friend class BaseConnection;
 



More information about the telepathy-commits mailing list