mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 23:28:09 +00:00
little fixes
This commit is contained in:
parent
6317473442
commit
328a451aab
2 changed files with 15 additions and 3 deletions
|
|
@ -10,10 +10,10 @@ using namespace std;
|
|||
// ===================================================================
|
||||
|
||||
ContactsListModel::ContactsListModel (QObject *parent): QAbstractListModel(parent) {
|
||||
shared_ptr<linphone::Core> core(CoreManager::getInstance()->getCore());
|
||||
m_linphone_friends = CoreManager::getInstance()->getCore()->getFriendsLists().front();
|
||||
|
||||
// Init contacts with linphone friends list.
|
||||
for (const auto &friend_ : core->getFriendsLists().front()->getFriends()) {
|
||||
for (const auto &friend_ : m_linphone_friends->getFriends()) {
|
||||
ContactModel *contact = new ContactModel(friend_);
|
||||
m_friend_to_contact[friend_.get()] = contact;
|
||||
m_list << contact;
|
||||
|
|
@ -40,9 +40,15 @@ QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
|
|||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
ContactModel *ContactsListModel::mapLinphoneFriendToContact (
|
||||
const shared_ptr<linphone::Friend> &friend_
|
||||
) const {
|
||||
return m_friend_to_contact[friend_.get()];
|
||||
}
|
||||
|
||||
ContactModel *ContactsListModel::mapSipAddressToContact (const QString &sipAddress) const {
|
||||
ContactModel *contact = m_friend_to_contact[
|
||||
CoreManager::getInstance()->getCore()->getFriendsLists().front()->findFriendByUri(
|
||||
m_linphone_friends->findFriendByUri(
|
||||
sipAddress.toStdString()
|
||||
).get()
|
||||
];
|
||||
|
|
|
|||
|
|
@ -22,12 +22,18 @@ public:
|
|||
QHash<int, QByteArray> roleNames () const;
|
||||
QVariant data (const QModelIndex &index, int role) const;
|
||||
|
||||
ContactModel *mapLinphoneFriendToContact (
|
||||
const std::shared_ptr<linphone::Friend> &friend_
|
||||
) const;
|
||||
|
||||
public slots:
|
||||
ContactModel *mapSipAddressToContact (const QString &sipAddress) const;
|
||||
|
||||
private:
|
||||
QList<ContactModel *> m_list;
|
||||
QHash<const linphone::Friend *, ContactModel* > m_friend_to_contact;
|
||||
|
||||
std::shared_ptr<linphone::FriendList> m_linphone_friends;
|
||||
};
|
||||
|
||||
#endif // CONTACTS_LIST_MODEL_H
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue