From 98d91794199e586986b4d48225294251370ef614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABlle=20Braud?= Date: Thu, 17 Jul 2025 13:31:47 +0000 Subject: [PATCH] fix #LINQT-1796 don't scroll to main list when selecting contact from favorites \ fix crash --- Linphone/CMakeLists.txt | 5 +++-- Linphone/core/chat/ChatList.cpp | 7 +++++-- Linphone/core/participant/ParticipantInfoList.cpp | 5 +++-- Linphone/model/core/CoreModel.cpp | 6 +++--- .../view/Control/Display/Chat/ChatMessagesListView.qml | 1 + Linphone/view/Control/Display/Contact/ContactListView.qml | 4 ---- Linphone/view/Page/Window/Main/MainWindow.qml | 2 +- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Linphone/CMakeLists.txt b/Linphone/CMakeLists.txt index 837b9a195..994dcbc84 100644 --- a/Linphone/CMakeLists.txt +++ b/Linphone/CMakeLists.txt @@ -22,11 +22,11 @@ set(APP_TARGETS ${LinphoneCxx_TARGET} ${LibLinphone_TARGET})#Liblinphone set(QT_DEFAULT_MAJOR_VERSION 6) -set(QT_PACKAGES Core Quick Qml Widgets Svg Multimedia Test NetworkAuth Concurrent)# Search Core at first for initialize Qt scripts for next find_packages. +set(QT_PACKAGES Quick Qml Widgets Svg Multimedia Test NetworkAuth Concurrent Core5Compat)# Search Core at first for initialize Qt scripts for next find_packages. if (UNIX AND NOT APPLE) list(APPEND QT_PACKAGES DBus) endif() -find_package(Qt6 REQUIRED COMPONENTS Core) +find_package(Qt6 REQUIRED COMPONENTS Core) find_package(Qt6 REQUIRED COMPONENTS ${QT_PACKAGES}) find_package(Qt6 REQUIRED COMPONENTS LinguistTools) @@ -214,6 +214,7 @@ foreach(T ${APP_TARGETS}) target_link_libraries(${TARGET_NAME} PUBLIC ${T}) endforeach() +target_link_libraries(${TARGET_NAME} PRIVATE Qt6::Core) foreach(T ${QT_PACKAGES}) target_link_libraries(${TARGET_NAME} PRIVATE Qt6::${T}) endforeach() diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index d2e89aec5..09a94028c 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -101,8 +101,11 @@ void ChatList::setSelf(QSharedPointer me) { connectItem(chat); } mustBeInMainThread(getClassName()); - resetData(*chats); - delete chats; + clearData(); + for(auto chat: *chats) { + add(chat); + } + delete chats; }); }); }); diff --git a/Linphone/core/participant/ParticipantInfoList.cpp b/Linphone/core/participant/ParticipantInfoList.cpp index 4132a8716..e836deda2 100644 --- a/Linphone/core/participant/ParticipantInfoList.cpp +++ b/Linphone/core/participant/ParticipantInfoList.cpp @@ -57,7 +57,8 @@ void ParticipantInfoList::setChatCore(const QSharedPointer &chatCore) QStringList participantAddresses; QList> participantList; auto participants = mChatCore->getParticipants(); - resetData(participants); + resetData(); + for(auto p: participants) add(p); }; connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList); buildList(); @@ -71,4 +72,4 @@ QVariant ParticipantInfoList::data(const QModelIndex &index, int role) const { return QVariant::fromValue(new ParticipantGui(mList[row].objectCast())); } return QVariant(); -} \ No newline at end of file +} diff --git a/Linphone/model/core/CoreModel.cpp b/Linphone/model/core/CoreModel.cpp index 90db5e672..c40856d5e 100644 --- a/Linphone/model/core/CoreModel.cpp +++ b/Linphone/model/core/CoreModel.cpp @@ -409,7 +409,7 @@ void CoreModel::onCallStateChanged(const std::shared_ptr &core, linphone::Call::State state, const std::string &message) { if (state == linphone::Call::State::IncomingReceived) { - App::getInstance()->getNotifier()->notifyReceivedCall(call); + if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedCall(call); if (!core->getConfig()->getBool(SettingsModel::UiSection, "disable_command_line", false) && !core->getConfig()->getString(SettingsModel::UiSection, "command_line", "").empty()) { QString command = Utils::coreStringToAppString( @@ -513,14 +513,14 @@ void CoreModel::onMessageReceived(const std::shared_ptr &core, emit unreadNotificationsChanged(); std::list> messages; messages.push_back(message); - App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); + if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); emit messageReceived(core, room, message); } void CoreModel::onMessagesReceived(const std::shared_ptr &core, const std::shared_ptr &room, const std::list> &messages) { emit unreadNotificationsChanged(); - App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); + if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); emit messagesReceived(core, room, messages); } diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index d43cb2f4b..26204d78a 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -169,6 +169,7 @@ ListView { if (isFullyVisible) modelData.core.lMarkAsRead() } + Component.onCompleted: if (index === mainItem.count - 1) mainItem.lastItemVisible = isFullyVisible chatMessage: modelData chat: mainItem.chat searchedTextPart: mainItem.filterText diff --git a/Linphone/view/Control/Display/Contact/ContactListView.qml b/Linphone/view/Control/Display/Contact/ContactListView.qml index f9ae92c46..b0a2ece26 100644 --- a/Linphone/view/Control/Display/Contact/ContactListView.qml +++ b/Linphone/view/Control/Display/Contact/ContactListView.qml @@ -59,10 +59,6 @@ ListView { onVisibleChanged: if (visible && !expanded) expanded = true - property var _currentItemY: currentItem?.y - on_CurrentItemYChanged: if(_currentItemY){ - updatePosition() - } onYChanged: updatePosition() // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. diff --git a/Linphone/view/Page/Window/Main/MainWindow.qml b/Linphone/view/Page/Window/Main/MainWindow.qml index b2d8ef389..5f55a64ee 100644 --- a/Linphone/view/Page/Window/Main/MainWindow.qml +++ b/Linphone/view/Page/Window/Main/MainWindow.qml @@ -28,7 +28,7 @@ AbstractWindow { property var accountProxy // TODO : use this to make the border transparent - flags: Qt.Window | Qt.WindowTitleHint + flags: Qt.Window // menuBar: Rectangle { // width: parent.width // height: Math.round(40 * DefaultStyle.dp)