Commit 0c1d6929 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Timeline): use `Connections` component

parent 92d076ff
...@@ -45,15 +45,13 @@ ColumnLayout { ...@@ -45,15 +45,13 @@ ColumnLayout {
spacing: 0 spacing: 0
Rectangle { // ---------------------------------------------------------------------------
anchors.fill: parent
color: TimelineStyle.color Connections {
} target: model
SmartConnect {
Component.onCompleted: {
// Handle if current entry was moved in timeline. // Handle if current entry was moved in timeline.
this.connect(model, 'dataChanged', function () { onDataChanged: {
var index = view.currentIndex var index = view.currentIndex
if ( if (
index !== -1 && index !== -1 &&
...@@ -61,18 +59,18 @@ ColumnLayout { ...@@ -61,18 +59,18 @@ ColumnLayout {
) { ) {
setSelectedEntry(_selectedSipAddress) setSelectedEntry(_selectedSipAddress)
} }
}) }
// A timeline entry is removed from timeline if there is no history entry. // A timeline entry is removed from timeline if there is no history entry.
this.connect(model, 'rowsAboutToBeRemoved', function (_, first, last) { onRowsAboutToBeRemoved: {
var index = view.currentIndex var index = view.currentIndex
if (index >= first && index <= last) { if (index >= first && index <= last) {
view.currentIndex = -1 view.currentIndex = -1
} }
}) }
// A entry is added when history is created. // A entry is added when history is created.
this.connect(model, 'rowsInserted', function (_, first, last) { onRowsInserted: {
if (_selectedSipAddress.length === 0) { if (_selectedSipAddress.length === 0) {
return return
} }
...@@ -82,10 +80,16 @@ ColumnLayout { ...@@ -82,10 +80,16 @@ ColumnLayout {
view.currentIndex = i view.currentIndex = i
} }
} }
})
} }
} }
// ---------------------------------------------------------------------------
Rectangle {
anchors.fill: parent
color: TimelineStyle.color
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Legend. // 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