mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-21 21:58:06 +00:00
feat(src/components/contacts/ContactsListModel): remove friend without vcard
This commit is contained in:
parent
8797a2e034
commit
be46f8cf6c
1 changed files with 14 additions and 5 deletions
|
|
@ -35,14 +35,23 @@ using namespace std;
|
|||
ContactsListModel::ContactsListModel (QObject *parent) : QAbstractListModel(parent) {
|
||||
mLinphoneFriends = CoreManager::getInstance()->getCore()->getFriendsLists().front();
|
||||
|
||||
// Clean friends.
|
||||
{
|
||||
list<shared_ptr<linphone::Friend> > toRemove;
|
||||
for (const auto &linphoneFriend : mLinphoneFriends->getFriends()) {
|
||||
if (!linphoneFriend->getVcard())
|
||||
toRemove.push_back(linphoneFriend);
|
||||
}
|
||||
|
||||
for (const auto &linphoneFriend : toRemove) {
|
||||
qWarning() << QStringLiteral("Remove one linphone friend without vcard.");
|
||||
mLinphoneFriends->removeFriend(linphoneFriend);
|
||||
}
|
||||
}
|
||||
|
||||
// Init contacts with linphone friends list.
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue