Commit 32f09dd0 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Timeline): update current index if necessary when data changed

parent bd53a150
......@@ -15,6 +15,8 @@ ColumnLayout {
property alias model: view.model
property string _selectedSipAddress
// ---------------------------------------------------------------------------
signal entrySelected (var entry)
......@@ -27,6 +29,7 @@ ColumnLayout {
for (var i = 0; i < n; i++) {
if (sipAddress === model.data(model.index(i, 0)).sipAddress) {
view.currentIndex = i
_selectedSipAddress = sipAddress
return
}
}
......@@ -34,12 +37,25 @@ ColumnLayout {
function resetSelectedEntry () {
view.currentIndex = -1
_selectedSipAddress = ''
}
// ---------------------------------------------------------------------------
spacing: 0
SmartConnect {
Component.onCompleted: this.connect(model, 'dataChanged', function () {
var index = view.currentIndex
if (
index !== -1 &&
_selectedSipAddress !== model.data(model.index(index, 0)).sipAddress
) {
setSelectedEntry(_selectedSipAddress)
}
})
}
// ---------------------------------------------------------------------------
// Legend.
// ---------------------------------------------------------------------------
......
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