mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
fix chatroom selection when filter change #LINQT-2199
This commit is contained in:
parent
fea9a1b7be
commit
514c337192
6 changed files with 79 additions and 87 deletions
|
|
@ -81,7 +81,6 @@ void EventLogList::connectItem(const QSharedPointer<EventLogCore> &item) {
|
|||
}
|
||||
|
||||
void EventLogList::setChatCore(QSharedPointer<ChatCore> core) {
|
||||
auto updateChatCore = [this](QSharedPointer<ChatCore> core) {
|
||||
if (mChatCore != core) {
|
||||
if (mChatCore) {
|
||||
disconnect(mChatCore.get(), &ChatCore::eventsInserted, this, nullptr);
|
||||
|
|
@ -90,12 +89,10 @@ void EventLogList::setChatCore(QSharedPointer<ChatCore> core) {
|
|||
mChatCore = core;
|
||||
if (mChatCore) {
|
||||
connect(mChatCore.get(), &ChatCore::eventListCleared, this, [this] { resetData(); });
|
||||
connect(mChatCore.get(), &ChatCore::eventsInserted, this,
|
||||
[this](QList<QSharedPointer<EventLogCore>> list) {
|
||||
connect(mChatCore.get(), &ChatCore::eventsInserted, this, [this](QList<QSharedPointer<EventLogCore>> list) {
|
||||
auto eventsList = getSharedList<EventLogCore>();
|
||||
for (auto &event : list) {
|
||||
auto it = std::find_if(
|
||||
eventsList.begin(), eventsList.end(),
|
||||
auto it = std::find_if(eventsList.begin(), eventsList.end(),
|
||||
[event](const QSharedPointer<EventLogCore> item) { return item == event; });
|
||||
if (it == eventsList.end()) {
|
||||
connectItem(event);
|
||||
|
|
@ -108,19 +105,9 @@ void EventLogList::setChatCore(QSharedPointer<ChatCore> core) {
|
|||
});
|
||||
}
|
||||
lUpdate();
|
||||
// setIsUpdating(false);
|
||||
emit chatGuiChanged();
|
||||
}
|
||||
};
|
||||
if (mIsUpdating) {
|
||||
connect(this, &EventLogList::isUpdatingChanged, this, [this, core, updateChatCore] {
|
||||
if (!mIsUpdating) {
|
||||
updateChatCore(core);
|
||||
disconnect(this, &EventLogList::isUpdatingChanged, this, nullptr);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updateChatCore(core);
|
||||
}
|
||||
}
|
||||
|
||||
void EventLogList::setChatGui(ChatGui *chat) {
|
||||
|
|
|
|||
|
|
@ -2112,65 +2112,65 @@
|
|||
<context>
|
||||
<name>ChatListView</name>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="280"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="287"/>
|
||||
<source>chat_message_is_writing_info</source>
|
||||
<extracomment>%1 is writing…</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="282"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="289"/>
|
||||
<source>chat_message_draft_sending_text</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="425"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="432"/>
|
||||
<source>chat_room_delete</source>
|
||||
<extracomment>"Delete"</extracomment>
|
||||
<translation>Löschen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="364"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
|
||||
<source>chat_room_mute</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="370"/>
|
||||
<source>chat_room_unmute</source>
|
||||
<extracomment>"Mute"</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="384"/>
|
||||
<source>chat_room_mark_as_read</source>
|
||||
<extracomment>"Mark as read"</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="396"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="403"/>
|
||||
<source>chat_room_leave</source>
|
||||
<extracomment>"leave"</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="402"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="409"/>
|
||||
<source>chat_list_leave_chat_popup_title</source>
|
||||
<extracomment>leave the conversation ?</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="404"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/>
|
||||
<source>chat_list_leave_chat_popup_message</source>
|
||||
<extracomment>You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="431"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="438"/>
|
||||
<source>chat_list_delete_chat_popup_title</source>
|
||||
<extracomment>Delete the conversation ?</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="433"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="440"/>
|
||||
<source>chat_list_delete_chat_popup_message</source>
|
||||
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
|
|||
|
|
@ -2089,65 +2089,65 @@
|
|||
<context>
|
||||
<name>ChatListView</name>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="280"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="287"/>
|
||||
<source>chat_message_is_writing_info</source>
|
||||
<extracomment>%1 is writing…</extracomment>
|
||||
<translation>%1 is writing…</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="282"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="289"/>
|
||||
<source>chat_message_draft_sending_text</source>
|
||||
<translation>Draft : %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="425"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="432"/>
|
||||
<source>chat_room_delete</source>
|
||||
<extracomment>"Delete"</extracomment>
|
||||
<translation>Delete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="364"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
|
||||
<source>chat_room_mute</source>
|
||||
<translation>Mute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="370"/>
|
||||
<source>chat_room_unmute</source>
|
||||
<extracomment>"Mute"</extracomment>
|
||||
<translation>Unmute</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="384"/>
|
||||
<source>chat_room_mark_as_read</source>
|
||||
<extracomment>"Mark as read"</extracomment>
|
||||
<translation>Mark as read</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="396"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="403"/>
|
||||
<source>chat_room_leave</source>
|
||||
<extracomment>"leave"</extracomment>
|
||||
<translation>Leave</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="402"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="409"/>
|
||||
<source>chat_list_leave_chat_popup_title</source>
|
||||
<extracomment>leave the conversation ?</extracomment>
|
||||
<translation>Leave the conversation ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="404"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/>
|
||||
<source>chat_list_leave_chat_popup_message</source>
|
||||
<extracomment>You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?</extracomment>
|
||||
<translation>You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="431"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="438"/>
|
||||
<source>chat_list_delete_chat_popup_title</source>
|
||||
<extracomment>Delete the conversation ?</extracomment>
|
||||
<translation>Delete the conversation ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="433"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="440"/>
|
||||
<source>chat_list_delete_chat_popup_message</source>
|
||||
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment>
|
||||
<translation>This conversation and all its messages will be deleted. Do You want to continue ?</translation>
|
||||
|
|
|
|||
|
|
@ -2089,65 +2089,65 @@
|
|||
<context>
|
||||
<name>ChatListView</name>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="280"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="287"/>
|
||||
<source>chat_message_is_writing_info</source>
|
||||
<extracomment>%1 is writing…</extracomment>
|
||||
<translation>%1 est en train d'écrire…</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="282"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="289"/>
|
||||
<source>chat_message_draft_sending_text</source>
|
||||
<translation>Brouillon : %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="425"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="432"/>
|
||||
<source>chat_room_delete</source>
|
||||
<extracomment>"Delete"</extracomment>
|
||||
<translation>Supprimer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="364"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
|
||||
<source>chat_room_mute</source>
|
||||
<translation>Mettre en sourdine</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="370"/>
|
||||
<source>chat_room_unmute</source>
|
||||
<extracomment>"Mute"</extracomment>
|
||||
<translation>Enlever la sourdine </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="384"/>
|
||||
<source>chat_room_mark_as_read</source>
|
||||
<extracomment>"Mark as read"</extracomment>
|
||||
<translation>Marquer comme lu</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="396"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="403"/>
|
||||
<source>chat_room_leave</source>
|
||||
<extracomment>"leave"</extracomment>
|
||||
<translation>Quitter la conversation</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="402"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="409"/>
|
||||
<source>chat_list_leave_chat_popup_title</source>
|
||||
<extracomment>leave the conversation ?</extracomment>
|
||||
<translation>Quitter la conversation ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="404"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/>
|
||||
<source>chat_list_leave_chat_popup_message</source>
|
||||
<extracomment>You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?</extracomment>
|
||||
<translation>Vous ne pourrez plus envoyer ou recevoir de messages dans cette conversation. Souhaitez-vous continuer ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="431"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="438"/>
|
||||
<source>chat_list_delete_chat_popup_title</source>
|
||||
<extracomment>Delete the conversation ?</extracomment>
|
||||
<translation>Supprimer la conversation ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="433"/>
|
||||
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="440"/>
|
||||
<source>chat_list_delete_chat_popup_message</source>
|
||||
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment>
|
||||
<translation>La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ?</translation>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ ListView {
|
|||
property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60)
|
||||
|
||||
property ChatGui currentChatGui: model.getAt(currentIndex) || null
|
||||
onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center)
|
||||
property ChatGui chatToSelect: null
|
||||
property ChatGui chatToSelectLater: null
|
||||
onChatToSelectChanged: {
|
||||
var index = chatProxy.findChatIndex(chatToSelect)
|
||||
if (index != -1) {
|
||||
|
|
@ -28,9 +30,6 @@ ListView {
|
|||
}
|
||||
|
||||
onChatClicked: (chat) => {selectChat(chat)}
|
||||
onCountChanged: {
|
||||
selectChat(currentChatGui)
|
||||
}
|
||||
|
||||
signal markAllAsRead()
|
||||
signal chatClicked(ChatGui chat)
|
||||
|
|
@ -41,14 +40,11 @@ ListView {
|
|||
loading = true
|
||||
}
|
||||
filterText: mainItem.searchText
|
||||
onFilterTextChanged: {
|
||||
chatToSelectLater = currentChatGui
|
||||
}
|
||||
initialDisplayItems: Math.max(20, Math.round(2 * mainItem.height / Utils.getSizeWithScreenRatio(56)))
|
||||
displayItemsStep: 3 * initialDisplayItems / 2
|
||||
onModelReset: {
|
||||
loading = false
|
||||
if (mainItem.chatToSelect) {
|
||||
selectChat(mainItem.chatToSelect)
|
||||
}
|
||||
}
|
||||
onModelAboutToBeReset: {
|
||||
loading = true
|
||||
}
|
||||
|
|
@ -58,8 +54,19 @@ ListView {
|
|||
mainItem.currentIndex = index
|
||||
}
|
||||
onLayoutChanged: {
|
||||
loading = false
|
||||
if (mainItem.chatToSelectLater) {
|
||||
selectChat(mainItem.chatToSelectLater)
|
||||
mainItem.chatToSelectLater = null
|
||||
}
|
||||
else if (mainItem.chatToSelect) {
|
||||
selectChat(mainItem.chatToSelect)
|
||||
mainItem.chatToSelect = null
|
||||
}
|
||||
else {
|
||||
selectChat(mainItem.currentChatGui)
|
||||
}
|
||||
}
|
||||
onChatCreated: (chat) => {
|
||||
selectChat(chat)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ AbstractMainPage {
|
|||
Layout.rightMargin: Utils.getSizeWithScreenRatio(8)
|
||||
Layout.topMargin: Utils.getSizeWithScreenRatio(18)
|
||||
onGroupCreationRequested: {
|
||||
console.log("groupe call requetsed")
|
||||
console.log("groupe call requested")
|
||||
listStackView.push(groupChatItem)
|
||||
}
|
||||
onContactClicked: (contact) => {
|
||||
|
|
@ -371,9 +371,7 @@ AbstractMainPage {
|
|||
visible: chat != undefined //&& (chat.core.isBasic || chat.core.conferenceJoined)
|
||||
anchors.fill: parent
|
||||
chat: mainItem.selectedChatGui ? mainItem.selectedChatGui : null
|
||||
onChatChanged: {
|
||||
if (mainItem.selectedChatGui !== chat) mainItem.selectedChatGui = chat
|
||||
}
|
||||
|
||||
// Reset current chat when switching account, otherwise the binding makes
|
||||
// the last chat from last account the current chat for the new default account
|
||||
Connections {
|
||||
|
|
@ -387,7 +385,7 @@ AbstractMainPage {
|
|||
Connections {
|
||||
target: mainItem
|
||||
function onSelectedChatGuiChanged() {
|
||||
if (mainItem.selectedChatGui) selectedChatView.chat = mainItem.selectedChatGui
|
||||
selectedChatView.chat = mainItem.selectedChatGui ? mainItem.selectedChatGui : null
|
||||
}
|
||||
}
|
||||
Binding {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue