From 0e602266c8deef2dc0d968c899a9a1973d2cb5c6 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Wed, 16 Jun 2021 14:21:33 -0400
Subject: [PATCH] sip: recover call transfer contact picker

Gitlab: #455

Change-Id: Ib61d6e671d894608dc13b3583f935ebc98453504
---
 src/contactadapter.cpp                                |  6 ++----
 src/mainview/components/ContactPicker.qml             |  2 ++
 src/mainview/components/ContactPickerItemDelegate.qml |  2 ++
 src/smartlistmodel.cpp                                | 11 +++++------
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/contactadapter.cpp b/src/contactadapter.cpp
index 7c08440fa..354b4745f 100644
--- a/src/contactadapter.cpp
+++ b/src/contactadapter.cpp
@@ -37,11 +37,9 @@ ContactAdapter::getContactSelectableModel(int type)
     if (listModeltype_ == SmartListModel::Type::CONVERSATION) {
         defaultModerators_ = lrcInstance_->accountModel().getDefaultModerators(
             lrcInstance_->getCurrentAccountId());
-        smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_));
-        smartListModel_->fillConversationsList();
-    } else {
-        smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_));
     }
+
+    smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_));
     selectableProxyModel_->setSourceModel(smartListModel_.get());
 
     // Adjust filter.
diff --git a/src/mainview/components/ContactPicker.qml b/src/mainview/components/ContactPicker.qml
index 24110c82f..d0ca5582f 100644
--- a/src/mainview/components/ContactPicker.qml
+++ b/src/mainview/components/ContactPicker.qml
@@ -121,6 +121,8 @@ Popup {
 
                 delegate: ContactPickerItemDelegate {
                     id: contactPickerItemDelegate
+
+                    showPresenceIndicator: type !== ContactList.TRANSFER
                 }
             }
         }
diff --git a/src/mainview/components/ContactPickerItemDelegate.qml b/src/mainview/components/ContactPickerItemDelegate.qml
index 6c9a7d32a..e92d6ae56 100644
--- a/src/mainview/components/ContactPickerItemDelegate.qml
+++ b/src/mainview/components/ContactPickerItemDelegate.qml
@@ -29,6 +29,8 @@ import "../../commoncomponents"
 ItemDelegate {
     id: contactPickerItemDelegate
 
+    property alias showPresenceIndicator: contactPickerContactImage.showPresenceIndicator
+
     AvatarImage {
         id: contactPickerContactImage
 
diff --git a/src/smartlistmodel.cpp b/src/smartlistmodel.cpp
index 754f9c40b..cbd8f52e1 100644
--- a/src/smartlistmodel.cpp
+++ b/src/smartlistmodel.cpp
@@ -50,8 +50,7 @@ SmartListModel::rowCount(const QModelIndex& parent) const
             lrcInstance_->getCurrentAccountId());
         auto& convModel = accInfo.conversationModel;
         if (listModelType_ == Type::TRANSFER) {
-            //            auto filterType = accInfo.profileInfo.type;
-            //            return convModel->getFilteredConversations(filterType).size();
+            return convModel->getFilteredConversations(accInfo.profileInfo.type).size();
         } else if (listModelType_ == Type::CONFERENCE) {
             auto calls = conferenceables_[ConferenceableItem::CALL];
             auto contacts = conferenceables_[ConferenceableItem::CONTACT];
@@ -80,10 +79,10 @@ SmartListModel::data(const QModelIndex& index, int role) const
             auto& currentAccountInfo = lrcInstance_->accountModel().getAccountInfo(
                 lrcInstance_->getCurrentAccountId());
             auto& convModel = currentAccountInfo.conversationModel;
-            auto filterType = currentAccountInfo.profileInfo.type;
-            return {};
-            // auto& item = convModel->getFilteredConversations(filterType).at(index.row());
-            // return dataForItem(item, role);
+
+            auto& item = convModel->getFilteredConversations(currentAccountInfo.profileInfo.type)
+                             .at(index.row());
+            return dataForItem(item, role);
         } catch (const std::exception& e) {
             qWarning() << e.what();
         }
-- 
GitLab