From 7f1708dacbd1595d49b3a55cf721fbd7fa024bfc Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 15 Jan 2026 11:44:22 +0100 Subject: [PATCH] fix call history list sorting #LINQT-2346 --- .../core/call-history/CallHistoryList.cpp | 2 +- .../core/call-history/CallHistoryProxy.cpp | 5 +---- .../Display/Call/CallHistoryListView.qml | 20 +++++++------------ 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Linphone/core/call-history/CallHistoryList.cpp b/Linphone/core/call-history/CallHistoryList.cpp index 58dec0086..8b02d5184 100644 --- a/Linphone/core/call-history/CallHistoryList.cpp +++ b/Linphone/core/call-history/CallHistoryList.cpp @@ -70,7 +70,7 @@ void CallHistoryList::setSelf(QSharedPointer me) { for (auto it : linphoneCallLogs) { auto model = createCallHistoryCore(it); toConnect(model.get()); - callLogs->push_back(model); + callLogs->push_front(model); } mModelConnection->invokeToCore([this, callLogs]() { mustBeInMainThread(getClassName()); diff --git a/Linphone/core/call-history/CallHistoryProxy.cpp b/Linphone/core/call-history/CallHistoryProxy.cpp index 1573e6430..f60385a13 100644 --- a/Linphone/core/call-history/CallHistoryProxy.cpp +++ b/Linphone/core/call-history/CallHistoryProxy.cpp @@ -68,8 +68,5 @@ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo } bool CallHistoryProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { - auto l = getItemAtSource(sourceLeft.row()); - auto r = getItemAtSource(sourceRight.row()); - if (l && r) return l->mDate < r->mDate; - return false; + return true; } diff --git a/Linphone/view/Control/Display/Call/CallHistoryListView.qml b/Linphone/view/Control/Display/Call/CallHistoryListView.qml index 9592d1f39..89c023c2d 100644 --- a/Linphone/view/Control/Display/Call/CallHistoryListView.qml +++ b/Linphone/view/Control/Display/Call/CallHistoryListView.qml @@ -21,7 +21,6 @@ ListView { onResultsReceived: { loading = false - // contentY = 0 } model: CallHistoryProxy { @@ -49,13 +48,12 @@ ListView { Component.onCompleted: cacheBuffer = Math.max(mainItem.height,0) //contentHeight>0 ? contentHeight : 0// cache all items // remove binding loop - onContentHeightChanged: Qt.callLater(function () { - if (mainItem) - mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 - }) + // onContentHeightChanged: Qt.callLater(function () { + // if (mainItem) + // mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 + // }) - onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) - currentIndex = 0 + onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) currentIndex = 0 onCountChanged: { if (currentIndex < 0 && count > 0) { mainItem.currentIndex = 0 // Select first item after loading model @@ -86,8 +84,8 @@ ListView { // Update position only if we are moving to current item and its position is changing. property var _currentItemY: currentItem?.y on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { - moveToCurrentItem() - } + moveToCurrentItem() + } Behavior on contentY { NumberAnimation { id: moveAnimation @@ -98,10 +96,6 @@ ListView { } //---------------------------------------------------------------- - onVisibleChanged: { -// if (!visible) -// currentIndex = -1 - } BusyIndicator { anchors.horizontalCenter: mainItem.horizontalCenter