Skip to content

Commit

Permalink
BaseConnectionContactsInterface: BaseConnection added as private member.
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
Kaffeine committed Aug 5, 2015
1 parent c89a98c commit 4542429
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions TelepathyQt/base-connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,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;
};

Expand Down Expand Up @@ -975,9 +977,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))
{
}

Expand Down
10 changes: 5 additions & 5 deletions TelepathyQt/base-connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -222,7 +222,7 @@ class TP_QT_EXPORT BaseConnectionContactsInterface : public AbstractConnectionIn
Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &interfaces, DBusError *error);

protected:
BaseConnectionContactsInterface();
BaseConnectionContactsInterface(BaseConnection *connection);

private:
void createAdaptor();
Expand Down

0 comments on commit 4542429

Please sign in to comment.