Skip to content
Snippets Groups Projects
Commit 67624a8d authored by Stepan Salenikovich's avatar Stepan Salenikovich
Browse files

recentmodel: fix Person selection

This patch fixes two bugs:
- the selectNode() function was giving the wrong pointer during idx
  creation, which caused potential segfaults
- the setCurrentIndex() function should be used instead of the select()
  function to properly select the index... this fixes the issue of
  when an incoming call is not automatically selected if a new contact
  is created for its CM (eg: during new profile transfer)

Change-Id: Ie297a570ce184559eb01fe20ae2890a6573b1bf3
Tuleap: #835
parent 4909f3fc
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,7 @@ RecentModel::getParticipantNumber(Call *call) const ...@@ -196,7 +196,7 @@ RecentModel::getParticipantNumber(Call *call) const
void RecentModelPrivate::selectNode(RecentViewNode* node) const void RecentModelPrivate::selectNode(RecentViewNode* node) const
{ {
const auto idx = q_ptr->createIndex(node->m_Index, 0, node->m_pParent); const auto idx = q_ptr->createIndex(node->m_Index, 0, node);
q_ptr->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect); q_ptr->selectionModel()->setCurrentIndex(idx, QItemSelectionModel::ClearAndSelect);
} }
...@@ -748,7 +748,7 @@ void RecentModelPrivate::slotContactChanged(ContactMethod* cm, Person* np, Perso ...@@ -748,7 +748,7 @@ void RecentModelPrivate::slotContactChanged(ContactMethod* cm, Person* np, Perso
removeNode(n); removeNode(n);
if (newParentNode && newParentNode->m_lChildren.size()) { if (newParentNode && newParentNode->m_lChildren.size()) {
q_ptr->selectionModel()->select(q_ptr->getIndex(const_cast<Person*>(newParentNode->m_uContent.m_pPerson)), QItemSelectionModel::ClearAndSelect); selectNode(newParentNode);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment