diff --git a/linphone-app/src/components/contacts/ContactsListModel.cpp b/linphone-app/src/components/contacts/ContactsListModel.cpp index 337ff8fad..139a7a900 100644 --- a/linphone-app/src/components/contacts/ContactsListModel.cpp +++ b/linphone-app/src/components/contacts/ContactsListModel.cpp @@ -61,7 +61,9 @@ bool ContactsListModel::removeRows (int row, int count, const QModelIndex &paren if (row < 0 || count < 0 || limit >= mList.count()) return false; - + + auto friendsList = CoreManager::getInstance()->getCore()->getFriendsLists(); + beginRemoveRows(parent, row, limit); for (int i = 0; i < count; ++i) { @@ -70,7 +72,7 @@ bool ContactsListModel::removeRows (int row, int count, const QModelIndex &paren mOptimizedSearch.remove(address.toString()); } - for(auto l : mLinphoneFriends) + for(auto l : friendsList) l->removeFriend(contact->mLinphoneFriend); emit contactRemoved(contact); @@ -110,7 +112,16 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) { contact = QSharedPointer::create(vcardModel); App::getInstance()->getEngine()->setObjectOwnership(contact.get(), QQmlEngine::CppOwnership); - if (mLinphoneFriends.front()->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) { + if( mLinphoneFriends.size() == 0){ + update();// Friends were not loaded correctly. Update them. + } + auto friendsList = CoreManager::getInstance()->getCore()->getDefaultFriendList(); + if( !friendsList){ + qWarning() << "There is no friends list available, cannot add a contact" ; + return nullptr; + } + + if (friendsList->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) { qWarning() << QStringLiteral("Unable to add contact from vcard:") << vcardModel; return nullptr; } @@ -118,7 +129,7 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) { qInfo() << QStringLiteral("Add contact from vcard:") << contact.get() << vcardModel; // Make sure new subscribe is issued. - mLinphoneFriends.front()->updateSubscriptions(); + friendsList->updateSubscriptions(); emit layoutChanged(); diff --git a/linphone-app/ui/modules/Common/Form/Mosaic.qml b/linphone-app/ui/modules/Common/Form/Mosaic.qml index 32151bbc5..48ea6f1bb 100644 --- a/linphone-app/ui/modules/Common/Form/Mosaic.qml +++ b/linphone-app/ui/modules/Common/Form/Mosaic.qml @@ -18,7 +18,7 @@ ColumnLayout{ } function add(item){ - if( !grid.isLayoutWillChanged() || !transitionningTimer.running) + if( !grid.isLayoutWillChanged()) appendItem(item) else bufferModels.append(item) @@ -34,7 +34,7 @@ ColumnLayout{ } function tryToAdd(item){ - if( !grid.isLayoutWillChanged() || !transitionningTimer.running) { + if( !grid.isLayoutWillChanged()) { appendItem(item) return true }else @@ -51,21 +51,7 @@ ColumnLayout{ property int transitionCount : 0 property var bufferModels : ListModel{} - property int maxTransitionTime: 250 - Timer{ - id: transitionningTimer - running: false - interval: maxTransitionTime + 5 - onTriggered: updateBuffers() - } - function startTransition(){ - transitionningTimer.restart() - } - function updateBuffers(){ - while(bufferModels.count > 0 && tryToAdd(bufferModels.get(0))){ - bufferModels.remove(0,1) - } - } + onWidthChanged: grid.updateLayout() onHeightChanged: grid.updateLayout() GridView{ @@ -120,63 +106,6 @@ ColumnLayout{ interactive: false model: DelegateModel{} - //------------------- ANIMATIONS - property Transition defaultTransition: Transition { - SequentialAnimation { - ScriptAction { - script: { - mainLayout.startTransition() - } - } - ParallelAnimation { - NumberAnimation { properties: "x,y"; duration: mainLayout.maxTransitionTime } - } - } - } - - add: Transition { - SequentialAnimation { - ScriptAction { - script: { - mainLayout.startTransition() - } - } - ParallelAnimation { - NumberAnimation { property: "opacity"; from: 0; duration: mainLayout.maxTransitionTime } - NumberAnimation { properties: "x,y"; from: 0; duration: mainLayout.maxTransitionTime; easing.type: Easing.OutBounce } - } - } - } - - addDisplaced: defaultTransition - displaced: defaultTransition - move: defaultTransition - moveDisplaced: defaultTransition - remove: Transition { - SequentialAnimation { - PropertyAction { target: grid; property: "GridView.delayRemove"; value: true } - ScriptAction { - script: { - mainLayout.startTransition() - } - } - ParallelAnimation { - NumberAnimation { property: "opacity"; to: 0; duration: mainLayout.maxTransitionTime } - NumberAnimation { properties: "x,y"; to: 0; duration: mainLayout.maxTransitionTime } - } - PropertyAction { target: grid; property: "GridView.delayRemove"; value: false } - } - } - removeDisplaced: defaultTransition - populate:defaultTransition - - Timer{ // if cell sizes change while adding/removing an item the animation will not end at the right position. - id: updateLayoutDelay - interval: mainLayout.maxTransitionTime - onTriggered: grid.updateLayout() - } - onItemCountChanged: { - updateLayoutDelay.restart() - } + onCountChanged: grid.updateLayout() } } \ No newline at end of file diff --git a/linphone-app/ui/views/App/Main/ContactEdit.qml b/linphone-app/ui/views/App/Main/ContactEdit.qml index b849d7016..96cb52522 100644 --- a/linphone-app/ui/views/App/Main/ContactEdit.qml +++ b/linphone-app/ui/views/App/Main/ContactEdit.qml @@ -35,9 +35,7 @@ ColumnLayout { Component.onDestruction: {_vcard=null}// Need to set it to null because of not calling destructor if not. Component.onCompleted:{ var sipAddress = contactEdit.sipAddress - var contact = contactEdit._contact = SipAddressesModel.mapSipAddressToContact( - sipAddress - ) + var contact = contactEdit._contact = SipAddressesModel.mapSipAddressToContact(sipAddress) if (!contact) { // Add a new contact. diff --git a/linphone-sdk b/linphone-sdk index 2cf715cb4..24d4e2b33 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit 2cf715cb4615c8115aa0102738bc3f28c6302765 +Subproject commit 24d4e2b33d036dc7942108cd2391793e58c29de5