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
804aa0df
Commit
804aa0df
authored
May 03, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(app): deal with friends without vcard
parent
02ca3cb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
10 deletions
+23
-10
VcardModel.cpp
linphone-desktop/src/components/contact/VcardModel.cpp
+4
-1
ContactsListModel.cpp
...one-desktop/src/components/contacts/ContactsListModel.cpp
+14
-8
CoreHandlers.cpp
linphone-desktop/src/components/core/CoreHandlers.cpp
+3
-1
ContactEdit.js
linphone-desktop/ui/views/App/Main/ContactEdit.js
+2
-0
No files found.
linphone-desktop/src/components/contact/VcardModel.cpp
View file @
804aa0df
...
...
@@ -71,7 +71,10 @@ inline shared_ptr<belcard::BelCardPhoto> findBelCardPhoto (const list<shared_ptr
// -----------------------------------------------------------------------------
VcardModel
::
VcardModel
(
shared_ptr
<
linphone
::
Vcard
>
vcard
)
:
mVcard
(
vcard
)
{}
VcardModel
::
VcardModel
(
shared_ptr
<
linphone
::
Vcard
>
vcard
)
{
Q_ASSERT
(
vcard
!=
nullptr
);
mVcard
=
vcard
;
}
VcardModel
::~
VcardModel
()
{
// If it's a detached Vcard, the linked photo must be destroyed from fs.
...
...
linphone-desktop/src/components/contacts/ContactsListModel.cpp
View file @
804aa0df
...
...
@@ -36,12 +36,18 @@ ContactsListModel::ContactsListModel (QObject *parent) : QAbstractListModel(pare
mLinphoneFriends
=
CoreManager
::
getInstance
()
->
getCore
()
->
getFriendsLists
().
front
();
// Init contacts with linphone friends list.
for
(
const
auto
&
_friend
:
mLinphoneFriends
->
getFriends
())
{
ContactModel
*
contact
=
new
ContactModel
(
this
,
_friend
);
QQmlEngine
*
engine
=
App
::
getInstance
()
->
getEngine
();
for
(
const
auto
&
linphoneFriend
:
mLinphoneFriends
->
getFriends
())
{
if
(
!
linphoneFriend
->
getVcard
())
{
qWarning
()
<<
QStringLiteral
(
"Ignore one linphone friend without vcard."
);
continue
;
}
ContactModel
*
contact
=
new
ContactModel
(
this
,
linphoneFriend
);
// See: http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership
// The returned value must have a explicit parent or a QQmlEngine::CppOwnership.
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
contact
,
QQmlEngine
::
CppOwnership
);
engine
->
setObjectOwnership
(
contact
,
QQmlEngine
::
CppOwnership
);
addContact
(
contact
);
}
...
...
@@ -101,17 +107,17 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcard) {
ContactModel
*
contact
=
new
ContactModel
(
this
,
vcard
);
App
::
getInstance
()
->
getEngine
()
->
setObjectOwnership
(
contact
,
QQmlEngine
::
CppOwnership
);
qInfo
()
<<
"Add contact:"
<<
contact
;
if
(
mLinphoneFriends
->
addFriend
(
contact
->
mLinphoneFriend
)
!=
linphone
::
FriendListStatus
::
FriendListStatusOK
)
{
qWarning
()
<<
"Unable to add friend from vcard:"
<<
vcard
;
qWarning
()
<<
QStringLiteral
(
"Unable to add contact from vcard:"
)
<<
vcard
;
delete
contact
;
return
nullptr
;
}
qInfo
()
<<
QStringLiteral
(
"Add contact on vcard:"
)
<<
vcard
<<
contact
;
int
row
=
mList
.
count
();
beginInsertRows
(
QModelIndex
(),
row
,
row
);
...
...
@@ -124,11 +130,11 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcard) {
}
void
ContactsListModel
::
removeContact
(
ContactModel
*
contact
)
{
qInfo
()
<<
"Removing contact:"
<<
contact
;
qInfo
()
<<
QStringLiteral
(
"Removing contact:"
)
<<
contact
;
int
index
=
mList
.
indexOf
(
contact
);
if
(
index
==
-
1
||
!
removeRow
(
index
))
qWarning
()
<<
"Unable to remove contact:"
<<
contact
;
qWarning
()
<<
QStringLiteral
(
"Unable to remove contact:"
)
<<
contact
;
}
// -----------------------------------------------------------------------------
...
...
linphone-desktop/src/components/core/CoreHandlers.cpp
View file @
804aa0df
...
...
@@ -89,7 +89,9 @@ void CoreHandlers::onNotifyPresenceReceived (
const
shared_ptr
<
linphone
::
Core
>
&
,
const
shared_ptr
<
linphone
::
Friend
>
&
linphoneFriend
)
{
linphoneFriend
->
getData
<
ContactModel
>
(
"contact-model"
).
refreshPresence
();
// Ignore friend without vcard because the `contact-model` data doesn't exist.
if
(
linphoneFriend
->
getVcard
())
linphoneFriend
->
getData
<
ContactModel
>
(
"contact-model"
).
refreshPresence
();
}
void
CoreHandlers
::
onRegistrationStateChanged
(
...
...
linphone-desktop/ui/views/App/Main/ContactEdit.js
View file @
804aa0df
...
...
@@ -15,6 +15,7 @@ function handleCreation () {
)
if
(
!
contact
)
{
// Add a new contact.
var
vcard
=
Linphone
.
CoreManager
.
createDetachedVcardModel
()
if
(
sipAddress
&&
sipAddress
.
length
>
0
)
{
...
...
@@ -24,6 +25,7 @@ function handleCreation () {
contactEdit
.
_vcard
=
vcard
contactEdit
.
_edition
=
true
}
else
{
// See or edit a contact.
contactEdit
.
_vcard
=
contact
.
vcard
}
}
...
...
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