diff options
author | Alvaro Soliverez <alvaro.soliverez@collabora.co.uk> | 2011-08-08 07:51:10 -0700 |
---|---|---|
committer | Alvaro Soliverez <alvaro.soliverez@collabora.co.uk> | 2011-08-08 07:51:10 -0700 |
commit | 57093b9c5a3b23dd06379ab89de1d73ea1a25394 (patch) | |
tree | 114dfdd4b63b5ec8c8b1c4907f3eba52e1fcc53c | |
parent | 9a769da18d5a1b2d43952e3bda8dc83c17a4d11a (diff) |
Added AccountForContactItem method to AccountsModel - Upstreamed from KDE Telepathy changes
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | TelepathyQt4Yell/Models/accounts-model.cpp | 10 | ||||
-rw-r--r-- | TelepathyQt4Yell/Models/accounts-model.h | 2 |
3 files changed, 13 insertions, 0 deletions
@@ -11,6 +11,7 @@ Enhancements: * Add method to remove contact in ContactModelItem * Add method to request or remove subscription in ContactModelItem * Add id and presence type roles to AbstractConversationModel + * Added AccountForContactItem method to AccountsModel Fixes: * Report the connection status reason using the Connection object if possible diff --git a/TelepathyQt4Yell/Models/accounts-model.cpp b/TelepathyQt4Yell/Models/accounts-model.cpp index 8a8a618..2a2f73a 100644 --- a/TelepathyQt4Yell/Models/accounts-model.cpp +++ b/TelepathyQt4Yell/Models/accounts-model.cpp @@ -333,4 +333,14 @@ QModelIndex AccountsModel::parent(const QModelIndex &index) const } } +Tp::AccountPtr AccountsModel::accountForContactItem(ContactModelItem *contactItem) const +{ + AccountsModelItem *accountItem = qobject_cast<AccountsModelItem*>(contactItem->parent()); + if (accountItem) { + return accountItem->account(); + } else { + return Tp::AccountPtr(); + } +} + } diff --git a/TelepathyQt4Yell/Models/accounts-model.h b/TelepathyQt4Yell/Models/accounts-model.h index 8075175..f2304ab 100644 --- a/TelepathyQt4Yell/Models/accounts-model.h +++ b/TelepathyQt4Yell/Models/accounts-model.h @@ -26,6 +26,7 @@ #endif #include <TelepathyQt4Yell/Models/AccountsModelItem> +#include <TelepathyQt4Yell/Models/ContactModelItem> #include <TelepathyQt4/Account> #include <TelepathyQt4/AccountManager> @@ -111,6 +112,7 @@ public: Tp::AccountPtr accountForIndex(const QModelIndex &index) const; Tp::AccountPtr accountForContactIndex(const QModelIndex &index) const; Tp::ContactPtr contactForIndex(const QModelIndex &index) const; + Tp::AccountPtr accountForContactItem(Tpy::ContactModelItem* contactItem) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); |