Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
328a451a
Commit
328a451a
authored
Nov 22, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
little fixes
parent
63174734
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
ContactsListModel.cpp
tests/src/components/contacts/ContactsListModel.cpp
+9
-3
ContactsListModel.hpp
tests/src/components/contacts/ContactsListModel.hpp
+6
-0
No files found.
tests/src/components/contacts/ContactsListModel.cpp
View file @
328a451a
...
@@ -10,10 +10,10 @@ using namespace std;
...
@@ -10,10 +10,10 @@ using namespace std;
// ===================================================================
// ===================================================================
ContactsListModel
::
ContactsListModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
{
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.
// 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_
);
ContactModel
*
contact
=
new
ContactModel
(
friend_
);
m_friend_to_contact
[
friend_
.
get
()]
=
contact
;
m_friend_to_contact
[
friend_
.
get
()]
=
contact
;
m_list
<<
contact
;
m_list
<<
contact
;
...
@@ -40,9 +40,15 @@ QVariant ContactsListModel::data (const QModelIndex &index, int role) const {
...
@@ -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
*
ContactsListModel
::
mapSipAddressToContact
(
const
QString
&
sipAddress
)
const
{
ContactModel
*
contact
=
m_friend_to_contact
[
ContactModel
*
contact
=
m_friend_to_contact
[
CoreManager
::
getInstance
()
->
getCore
()
->
getFriendsLists
().
front
()
->
findFriendByUri
(
m_linphone_friends
->
findFriendByUri
(
sipAddress
.
toStdString
()
sipAddress
.
toStdString
()
).
get
()
).
get
()
];
];
...
...
tests/src/components/contacts/ContactsListModel.hpp
View file @
328a451a
...
@@ -22,12 +22,18 @@ public:
...
@@ -22,12 +22,18 @@ public:
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
QHash
<
int
,
QByteArray
>
roleNames
()
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
)
const
;
ContactModel
*
mapLinphoneFriendToContact
(
const
std
::
shared_ptr
<
linphone
::
Friend
>
&
friend_
)
const
;
public
slots
:
public
slots
:
ContactModel
*
mapSipAddressToContact
(
const
QString
&
sipAddress
)
const
;
ContactModel
*
mapSipAddressToContact
(
const
QString
&
sipAddress
)
const
;
private:
private:
QList
<
ContactModel
*>
m_list
;
QList
<
ContactModel
*>
m_list
;
QHash
<
const
linphone
::
Friend
*
,
ContactModel
*
>
m_friend_to_contact
;
QHash
<
const
linphone
::
Friend
*
,
ContactModel
*
>
m_friend_to_contact
;
std
::
shared_ptr
<
linphone
::
FriendList
>
m_linphone_friends
;
};
};
#endif // CONTACTS_LIST_MODEL_H
#endif // CONTACTS_LIST_MODEL_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment