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

RecentModel: fix selection on insertCallNode

The index it was trying to select was wrong as it did not take its
parent index as an argument.

The selection is also now consistent with what happens when the
CallModel selection changes.

Change-Id: I364b059f872feaf17529eb57198d69ee8101e034
Tuleap: #203
parent 166f4dab
Branches
No related tags found
No related merge requests found
......@@ -782,8 +782,15 @@ RecentModelPrivate::insertCallNode(RecentViewNode *parent, RecentViewNode* callN
emit q_ptr->dataChanged(firstChild, firstChild);
}
// Select the newly inserted call
q_ptr->selectionModel()->setCurrentIndex(q_ptr->index(callNode->m_Index, 0), QItemSelectionModel::ClearAndSelect);
/* in the case of a conference, we select the call;
* in case the parent only has one call, we select the parent;
* in case the parent has multiple calls, we select the call;
*/
auto callIdx = q_ptr->index(callNode->m_Index, 0, parentIdx);
if (q_ptr->isConference(callIdx) || q_ptr->isConference(parentIdx) || q_ptr->rowCount(parentIdx) > 1)
q_ptr->selectionModel()->setCurrentIndex(callIdx, QItemSelectionModel::ClearAndSelect);
else
q_ptr->selectionModel()->setCurrentIndex(callIdx.parent(), QItemSelectionModel::ClearAndSelect);
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment