mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-26 08:18:08 +00:00
fix(ui/modules/Linphone/Chat/Chat): use Connections component
This commit is contained in:
parent
4a228d3109
commit
92d076ffb8
1 changed files with 26 additions and 19 deletions
|
|
@ -52,6 +52,13 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
function _initView () {
|
||||
_tryToLoadMoreEntries = false
|
||||
_bindToEnd = true
|
||||
|
||||
positionViewAtEnd()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
Layout.fillHeight: true
|
||||
|
|
@ -77,28 +84,12 @@ Rectangle {
|
|||
}
|
||||
goToEnd()
|
||||
|
||||
var initView = function () {
|
||||
_tryToLoadMoreEntries = false
|
||||
_bindToEnd = true
|
||||
|
||||
positionViewAtEnd()
|
||||
}
|
||||
|
||||
// Received only if more entries were loaded.
|
||||
proxyModel.moreEntriesLoaded.connect(function (n) {
|
||||
positionViewAtIndex(n - 1, ListView.Beginning)
|
||||
_tryToLoadMoreEntries = false
|
||||
})
|
||||
|
||||
// When the view is changed (for example `Calls` -> `Messages`),
|
||||
// the position is set at end and it can be possible to load
|
||||
// more entries.
|
||||
proxyModel.entryTypeFilterChanged.connect(initView)
|
||||
|
||||
// First render.
|
||||
initView()
|
||||
_initView()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
onMovementStarted: _bindToEnd = false
|
||||
onMovementEnded: {
|
||||
if (atYEnd) {
|
||||
|
|
@ -108,6 +99,22 @@ Rectangle {
|
|||
|
||||
onContentYChanged: _loadMoreEntries()
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
Connections {
|
||||
target: proxyModel
|
||||
|
||||
// When the view is changed (for example `Calls` -> `Messages`),
|
||||
// the position is set at end and it can be possible to load
|
||||
// more entries.
|
||||
onEntryTypeFilterChanged: _initView()
|
||||
|
||||
onMoreEntriesLoaded: {
|
||||
chat.positionViewAtIndex(n - 1, ListView.Beginning)
|
||||
chat._tryToLoadMoreEntries = false
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Heading.
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue