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

recentmodel: improve selection behaviour

The parent idx should not be selected if the child is part of a
conference or if the parent has multiple calls.

Change-Id: I2b74fd2c5bfee959487b3437e3aa9f9a490a5d04
Tuleap: #203
parent b371c7c3
No related branches found
No related tags found
No related merge requests found
...@@ -1048,7 +1048,15 @@ RecentModelPrivate::slotCurrentCallChanged(const QModelIndex &current, const QMo ...@@ -1048,7 +1048,15 @@ RecentModelPrivate::slotCurrentCallChanged(const QModelIndex &current, const QMo
{ {
auto callIdx = q_ptr->getIndex(CallModel::instance().getCall(current)); auto callIdx = q_ptr->getIndex(CallModel::instance().getCall(current));
if (callIdx.isValid()) { if (callIdx.isValid()) {
q_ptr->selectionModel()->setCurrentIndex(q_ptr->isConference(callIdx) ? callIdx : callIdx.parent(), 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 parentIdx = callIdx.parent();
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);
} else { } else {
q_ptr->selectionModel()->clearCurrentIndex(); q_ptr->selectionModel()->clearCurrentIndex();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment