From 4b1cb237bfe974c73754234f5b130168a84c7e8d Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 7 Aug 2025 10:36:35 +0200 Subject: [PATCH] fix typo #LINQT-1876 fix chat room menu ui #LINQT-1872 update current chat message list when current chat removed #LINQT-1873 fix : remove unused connect disconnecting a usefull one --- Linphone/core/chat/message/EventLogList.cpp | 2 -- Linphone/view/Control/Display/Chat/ChatListView.qml | 13 +++++++++---- .../Control/Display/Settings/SettingsMenuItem.qml | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Linphone/core/chat/message/EventLogList.cpp b/Linphone/core/chat/message/EventLogList.cpp index 5c0dd5650..aea39b0e1 100644 --- a/Linphone/core/chat/message/EventLogList.cpp +++ b/Linphone/core/chat/message/EventLogList.cpp @@ -79,7 +79,6 @@ void EventLogList::setChatCore(QSharedPointer core) { if (mChatCore) { disconnect(mChatCore.get(), &ChatCore::eventListChanged, this, nullptr); disconnect(mChatCore.get(), &ChatCore::eventsInserted, this, nullptr); - mModelConnection->disconnect(); } mChatCore = core; if (mChatCore) { @@ -97,7 +96,6 @@ void EventLogList::setChatCore(QSharedPointer core) { } } }); - mModelConnection = SafeConnection::create(mChatCore, mChatCore->getModel()); } emit eventChanged(); lUpdate(); diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 7887424c4..925d1c00f 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -19,6 +19,7 @@ ListView { property ChatGui currentChatGui onCurrentIndexChanged: currentChatGui = model.getAt(currentIndex) || null + onCurrentChatGuiChanged: chatClicked(currentChatGui) signal resultsReceived() signal markAllAsRead() @@ -44,9 +45,9 @@ ListView { mainItem.resultsReceived() } onChatRemoved: { - var indexToSelect = mainItem.currentIndex + var currentChat = model.getAt(currentIndex) mainItem.currentIndex = -1 - mainItem.currentIndex = indexToSelect + selectChat(currentChat) } onLayoutChanged: { selectChat(mainItem.currentChatGui) @@ -57,6 +58,7 @@ ListView { function selectChat(chatGui) { var index = chatProxy.findChatIndex(chatGui) + console.log("current index", mainItem.currentIndex, "new", index) mainItem.currentIndex = index // if the chat exists, it may not be displayed // in list if hide_empty_chatrooms is set. Thus, we need @@ -366,14 +368,15 @@ ListView { } Rectangle { Layout.fillWidth: true - visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly + visible: leaveButton.visible Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) color: DefaultStyle.main2_400 } IconLabelButton { + id: leaveButton //: "leave" text: qsTr("chat_room_leave") - visible: mainItem.currentChatGui && !mainItem.currentChatGui.core.isReadOnly && mainItem.currentChatGui.core.isGroupChat + visible: !modelData.core.isReadOnly && modelData.core.isGroupChat icon.source: AppIcons.trashCan spacing: Math.round(10 * DefaultStyle.dp) Layout.fillWidth: true @@ -393,11 +396,13 @@ ListView { style: ButtonStyle.hoveredBackground } Rectangle { + visible: deleteButton.visible Layout.fillWidth: true Layout.preferredHeight: Math.min(1, Math.round(1 * DefaultStyle.dp)) color: DefaultStyle.main2_400 } IconLabelButton { + id: deleteButton //: "Delete" text: qsTr("chat_room_delete") icon.source: AppIcons.trashCan diff --git a/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml b/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml index e11d6c2fa..524745d9d 100644 --- a/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml +++ b/Linphone/view/Control/Display/Settings/SettingsMenuItem.qml @@ -59,6 +59,7 @@ Item { Text { anchors.margins: 25 anchors.left: parent.left + anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter text: titleText font: Typography.h4