Commit 7d0384ac authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Calls/Calls): handle correctly received call

parent 3f026201
...@@ -114,27 +114,32 @@ function handleCountChanged (count) { ...@@ -114,27 +114,32 @@ function handleCountChanged (count) {
calls._selectedCall = model.data(model.index(index, 0)) calls._selectedCall = model.data(model.index(index, 0))
} }
function resetSelectedCall () {
calls.currentIndex = -1
calls._selectedCall = null
}
function handleRowsAboutToBeRemoved (_, first, last) { function handleRowsAboutToBeRemoved (_, first, last) {
var index = calls.currentIndex var index = calls.currentIndex
if (index >= first && index <= last) { if (index >= first && index <= last) {
calls.currentIndex = -1 resetSelectedCall()
calls._selectedCall = null
} }
} }
function handleRowsInserted (_, first, last) { function handleRowsInserted (_, first, last) {
// The last inserted outgoing element become the selected call. // The last inserted outgoing element become the selected call.
var model = calls.model var model = calls.model
for (var index = last; index >= first; index--) { for (var index = last; index >= first; index--) {
var call = model.data(model.index(index, 0)) var call = model.data(model.index(index, 0))
if (call.isOutgoing) { if (call.isOutgoing) {
calls.currentIndex = -1 resetSelectedCall()
calls._selectedCall = null
return return
} }
} }
if (index === 0 && model.rowsCount() === 1) {
resetSelectedCall()
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment