mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-25 15:58:16 +00:00
feat(ui/modules/Linphone/Timeline): update current index if necessary when data changed
This commit is contained in:
parent
bd53a15002
commit
32f09dd0dd
1 changed files with 16 additions and 0 deletions
|
|
@ -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.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue