ChatCore: wait for deleted state before emitting deleted signal

fix chats selection and remove useless signal
This commit is contained in:
Gaelle Braud 2025-12-02 14:26:07 +01:00
parent 60517741a2
commit 21e8e2aaba
10 changed files with 54 additions and 99 deletions

View file

@ -163,14 +163,13 @@ void ChatCore::setSelf(QSharedPointer<ChatCore> me) {
mChatModelConnection->makeConnectToCore(&ChatCore::lDelete, [this]() { mChatModelConnection->makeConnectToCore(&ChatCore::lDelete, [this]() {
mChatModelConnection->invokeToModel([this]() { mChatModel->deleteChatRoom(); }); mChatModelConnection->invokeToModel([this]() { mChatModel->deleteChatRoom(); });
}); });
mChatModelConnection->makeConnectToModel(
&ChatModel::deleted, [this]() { mChatModelConnection->invokeToCore([this]() { emit deleted(); }); });
mChatModelConnection->makeConnectToModel( mChatModelConnection->makeConnectToModel(
&ChatModel::stateChanged, &ChatModel::stateChanged,
[this](const std::shared_ptr<linphone::ChatRoom> &chatRoom, linphone::ChatRoom::State newState) { [this](const std::shared_ptr<linphone::ChatRoom> &chatRoom, linphone::ChatRoom::State newState) {
auto state = LinphoneEnums::fromLinphone(newState); auto state = LinphoneEnums::fromLinphone(newState);
bool isReadOnly = chatRoom->isReadOnly(); bool isReadOnly = chatRoom->isReadOnly();
if (newState == linphone::ChatRoom::State::Deleted) emit deleted();
mChatModelConnection->invokeToCore([this, state, isReadOnly]() { mChatModelConnection->invokeToCore([this, state, isReadOnly]() {
setChatRoomState(state); setChatRoomState(state);
setIsReadOnly(isReadOnly); setIsReadOnly(isReadOnly);

View file

@ -54,13 +54,15 @@ ChatList::~ChatList() {
} }
void ChatList::connectItem(QSharedPointer<ChatCore> chat) { void ChatList::connectItem(QSharedPointer<ChatCore> chat) {
connect(chat.get(), &ChatCore::deleted, this, [this, chat] { connect(
disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr); chat.get(), &ChatCore::deleted, this,
disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr); [this, chat] {
disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr); disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr);
disconnect(chat.get(), &ChatCore::deleted, this, nullptr); disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr);
remove(chat); disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr);
}); remove(chat);
},
Qt::SingleShotConnection);
auto dataChange = [this, chat] { auto dataChange = [this, chat] {
int i = -1; int i = -1;
get(chat.get(), &i); get(chat.get(), &i);
@ -167,30 +169,6 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
addChatToList(core, room, message); addChatToList(core, room, message);
}); });
mModelConnection->makeConnectToModel(
&CoreModel::chatRoomStateChanged,
[this](const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::ChatRoom> &chatRoom,
linphone::ChatRoom::State state) {
auto chatRoomAccount = chatRoom->getAccount();
auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount();
if (!chatRoomAccount || !currentAccount || !chatRoomAccount->getParams() || !currentAccount->getParams() ||
!chatRoomAccount->getParams()->getIdentityAddress()->weakEqual(
currentAccount->getParams()->getIdentityAddress())) {
lInfo() << "ChatRoom state of another account changed, return";
return;
}
if (chatRoom->getState() == linphone::ChatRoom::State::Created) {
lInfo() << "ChatRoom created, add it to the list" << chatRoom.get();
auto chatCore = ChatCore::create(chatRoom);
if (chatCore) {
mModelConnection->invokeToCore([this, chatCore] {
bool added = addChatInList(chatCore);
if (added) emit chatCreated(new ChatGui(chatCore));
});
}
}
});
connect(this, &ChatList::filterChanged, [this](QString filter) { connect(this, &ChatList::filterChanged, [this](QString filter) {
mFilter = filter; mFilter = filter;
lUpdate(); lUpdate();
@ -212,8 +190,7 @@ bool ChatList::addChatInList(QSharedPointer<ChatCore> chatCore) {
mustBeInMainThread(log().arg(Q_FUNC_INFO)); mustBeInMainThread(log().arg(Q_FUNC_INFO));
auto chatList = getSharedList<ChatCore>(); auto chatList = getSharedList<ChatCore>();
auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) { auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer<ChatCore> item) {
return item && chatCore && item->getModel() && chatCore->getModel() && return item && chatCore && item->getIdentifier() == chatCore->getIdentifier();
item->getModel()->getMonitor() == chatCore->getModel()->getMonitor();
}); });
if (it == chatList.end()) { if (it == chatList.end()) {
connectItem(chatCore); connectItem(chatCore);

View file

@ -50,9 +50,6 @@ signals:
void filterChanged(QString filter); void filterChanged(QString filter);
void chatAdded(); void chatAdded();
void chatUpdated(); void chatUpdated();
// emit this signal to force selection when
// newly created chat added to the list
void chatCreated(ChatGui *chatGui);
private: private:
QString mFilter; QString mFilter;

View file

@ -46,10 +46,6 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) {
connect(this, &ChatProxy::filterTextChanged, newChatList, connect(this, &ChatProxy::filterTextChanged, newChatList,
[this, newChatList] { emit newChatList->filterChanged(getFilterText()); }); [this, newChatList] { emit newChatList->filterChanged(getFilterText()); });
connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); }); connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); });
connect(newChatList, &ChatList::chatCreated, this, [this](ChatGui *chatGui) {
invalidate();
emit chatCreated(chatGui);
});
connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); }); connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); });
} }
QSortFilterProxyModel::setSourceModel(newChatList); QSortFilterProxyModel::setSourceModel(newChatList);

View file

@ -41,8 +41,6 @@ public:
Q_INVOKABLE int findChatIndex(ChatGui *chatGui); Q_INVOKABLE int findChatIndex(ChatGui *chatGui);
Q_INVOKABLE bool addChatInList(ChatGui *chatGui); Q_INVOKABLE bool addChatInList(ChatGui *chatGui);
signals:
void chatCreated(ChatGui *chatGui);
protected: protected:
QSharedPointer<ChatList> mList; QSharedPointer<ChatList> mList;

View file

@ -2099,65 +2099,65 @@
<context> <context>
<name>ChatListView</name> <name>ChatListView</name>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="264"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="253"/>
<source>chat_message_is_writing_info</source> <source>chat_message_is_writing_info</source>
<extracomment>%1 is writing</extracomment> <extracomment>%1 is writing</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="266"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="255"/>
<source>chat_message_draft_sending_text</source> <source>chat_message_draft_sending_text</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="400"/>
<source>chat_room_delete</source> <source>chat_room_delete</source>
<extracomment>&quot;Delete&quot;</extracomment> <extracomment>&quot;Delete&quot;</extracomment>
<translation>Löschen</translation> <translation>Löschen</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="350"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="339"/>
<source>chat_room_mute</source> <source>chat_room_mute</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="349"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="338"/>
<source>chat_room_unmute</source> <source>chat_room_unmute</source>
<extracomment>&quot;Mute&quot;</extracomment> <extracomment>&quot;Mute&quot;</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="352"/>
<source>chat_room_mark_as_read</source> <source>chat_room_mark_as_read</source>
<extracomment>&quot;Mark as read&quot;</extracomment> <extracomment>&quot;Mark as read&quot;</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="382"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
<source>chat_room_leave</source> <source>chat_room_leave</source>
<extracomment>&quot;leave&quot;</extracomment> <extracomment>&quot;leave&quot;</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="388"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
<source>chat_list_leave_chat_popup_title</source> <source>chat_list_leave_chat_popup_title</source>
<extracomment>leave the conversation ?</extracomment> <extracomment>leave the conversation ?</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="390"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="379"/>
<source>chat_list_leave_chat_popup_message</source> <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> <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> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="417"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="406"/>
<source>chat_list_delete_chat_popup_title</source> <source>chat_list_delete_chat_popup_title</source>
<extracomment>Delete the conversation ?</extracomment> <extracomment>Delete the conversation ?</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="419"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="408"/>
<source>chat_list_delete_chat_popup_message</source> <source>chat_list_delete_chat_popup_message</source>
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment> <extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -2723,19 +2723,19 @@ Error</extracomment>
<translation type="vanished">Fehler</translation> <translation type="vanished">Fehler</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="150"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="164"/>
<source>information_popup_error_title</source> <source>information_popup_error_title</source>
<extracomment>Erreur</extracomment> <extracomment>Erreur</extracomment>
<translation>Fehler</translation> <translation>Fehler</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="152"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/>
<source>information_popup_voicemail_address_undefined_message</source> <source>information_popup_voicemail_address_undefined_message</source>
<extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment> <extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment>
<translation>Die Voicemail-URI ist nicht definiert.</translation> <translation>Die Voicemail-URI ist nicht definiert.</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="180"/>
<source>account_settings_name_accessible_name</source> <source>account_settings_name_accessible_name</source>
<extracomment>Account settings of %1</extracomment> <extracomment>Account settings of %1</extracomment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View file

@ -2086,65 +2086,65 @@
<context> <context>
<name>ChatListView</name> <name>ChatListView</name>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="264"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="253"/>
<source>chat_message_is_writing_info</source> <source>chat_message_is_writing_info</source>
<extracomment>%1 is writing</extracomment> <extracomment>%1 is writing</extracomment>
<translation>%1 is writing</translation> <translation>%1 is writing</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="266"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="255"/>
<source>chat_message_draft_sending_text</source> <source>chat_message_draft_sending_text</source>
<translation>Draft : %1</translation> <translation>Draft : %1</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="400"/>
<source>chat_room_delete</source> <source>chat_room_delete</source>
<extracomment>&quot;Delete&quot;</extracomment> <extracomment>&quot;Delete&quot;</extracomment>
<translation>Delete</translation> <translation>Delete</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="350"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="339"/>
<source>chat_room_mute</source> <source>chat_room_mute</source>
<translation>Mute</translation> <translation>Mute</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="349"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="338"/>
<source>chat_room_unmute</source> <source>chat_room_unmute</source>
<extracomment>&quot;Mute&quot;</extracomment> <extracomment>&quot;Mute&quot;</extracomment>
<translation>Unmute</translation> <translation>Unmute</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="352"/>
<source>chat_room_mark_as_read</source> <source>chat_room_mark_as_read</source>
<extracomment>&quot;Mark as read&quot;</extracomment> <extracomment>&quot;Mark as read&quot;</extracomment>
<translation>Mark as read</translation> <translation>Mark as read</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="382"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
<source>chat_room_leave</source> <source>chat_room_leave</source>
<extracomment>&quot;leave&quot;</extracomment> <extracomment>&quot;leave&quot;</extracomment>
<translation>Leave</translation> <translation>Leave</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="388"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
<source>chat_list_leave_chat_popup_title</source> <source>chat_list_leave_chat_popup_title</source>
<extracomment>leave the conversation ?</extracomment> <extracomment>leave the conversation ?</extracomment>
<translation>Leave the conversation ?</translation> <translation>Leave the conversation ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="390"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="379"/>
<source>chat_list_leave_chat_popup_message</source> <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> <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> <translation>You will not be able to send or receive messages in this conversation anymore. Do You want to continue ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="417"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="406"/>
<source>chat_list_delete_chat_popup_title</source> <source>chat_list_delete_chat_popup_title</source>
<extracomment>Delete the conversation ?</extracomment> <extracomment>Delete the conversation ?</extracomment>
<translation>Delete the conversation ?</translation> <translation>Delete the conversation ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="419"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="408"/>
<source>chat_list_delete_chat_popup_message</source> <source>chat_list_delete_chat_popup_message</source>
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment> <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> <translation>This conversation and all its messages will be deleted. Do You want to continue ?</translation>
@ -2682,19 +2682,19 @@ Only your correspondent can decrypt them.</translation>
<context> <context>
<name>Contact</name> <name>Contact</name>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="150"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="164"/>
<source>information_popup_error_title</source> <source>information_popup_error_title</source>
<extracomment>Erreur</extracomment> <extracomment>Erreur</extracomment>
<translation>Error</translation> <translation>Error</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="152"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/>
<source>information_popup_voicemail_address_undefined_message</source> <source>information_popup_voicemail_address_undefined_message</source>
<extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment> <extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment>
<translation>The voicemail URI is not defined.</translation> <translation>The voicemail URI is not defined.</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="180"/>
<source>account_settings_name_accessible_name</source> <source>account_settings_name_accessible_name</source>
<extracomment>Account settings of %1</extracomment> <extracomment>Account settings of %1</extracomment>
<translation>Account settings of %1</translation> <translation>Account settings of %1</translation>

View file

@ -2086,65 +2086,65 @@
<context> <context>
<name>ChatListView</name> <name>ChatListView</name>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="264"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="253"/>
<source>chat_message_is_writing_info</source> <source>chat_message_is_writing_info</source>
<extracomment>%1 is writing</extracomment> <extracomment>%1 is writing</extracomment>
<translation>%1 est en train d&apos;écrire</translation> <translation>%1 est en train d&apos;écrire</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="266"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="255"/>
<source>chat_message_draft_sending_text</source> <source>chat_message_draft_sending_text</source>
<translation>Brouillon : %1</translation> <translation>Brouillon : %1</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="411"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="400"/>
<source>chat_room_delete</source> <source>chat_room_delete</source>
<extracomment>&quot;Delete&quot;</extracomment> <extracomment>&quot;Delete&quot;</extracomment>
<translation>Supprimer</translation> <translation>Supprimer</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="350"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="339"/>
<source>chat_room_mute</source> <source>chat_room_mute</source>
<translation>Mettre en sourdine</translation> <translation>Mettre en sourdine</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="349"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="338"/>
<source>chat_room_unmute</source> <source>chat_room_unmute</source>
<extracomment>&quot;Mute&quot;</extracomment> <extracomment>&quot;Mute&quot;</extracomment>
<translation>Enlever la sourdine </translation> <translation>Enlever la sourdine </translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="363"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="352"/>
<source>chat_room_mark_as_read</source> <source>chat_room_mark_as_read</source>
<extracomment>&quot;Mark as read&quot;</extracomment> <extracomment>&quot;Mark as read&quot;</extracomment>
<translation>Marquer comme lu</translation> <translation>Marquer comme lu</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="382"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="371"/>
<source>chat_room_leave</source> <source>chat_room_leave</source>
<extracomment>&quot;leave&quot;</extracomment> <extracomment>&quot;leave&quot;</extracomment>
<translation>Quitter la conversation</translation> <translation>Quitter la conversation</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="388"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="377"/>
<source>chat_list_leave_chat_popup_title</source> <source>chat_list_leave_chat_popup_title</source>
<extracomment>leave the conversation ?</extracomment> <extracomment>leave the conversation ?</extracomment>
<translation>Quitter la conversation ?</translation> <translation>Quitter la conversation ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="390"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="379"/>
<source>chat_list_leave_chat_popup_message</source> <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> <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> <translation>Vous ne pourrez plus envoyer ou recevoir de messages dans cette conversation. Souhaitez-vous continuer ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="417"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="406"/>
<source>chat_list_delete_chat_popup_title</source> <source>chat_list_delete_chat_popup_title</source>
<extracomment>Delete the conversation ?</extracomment> <extracomment>Delete the conversation ?</extracomment>
<translation>Supprimer la conversation ?</translation> <translation>Supprimer la conversation ?</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Chat/ChatListView.qml" line="419"/> <location filename="../../view/Control/Display/Chat/ChatListView.qml" line="408"/>
<source>chat_list_delete_chat_popup_message</source> <source>chat_list_delete_chat_popup_message</source>
<extracomment>This conversation and all its messages will be deleted. Do You want to continue ?</extracomment> <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> <translation>La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ?</translation>
@ -2682,19 +2682,19 @@ en bout. Seul votre correspondant peut les déchiffrer.</translation>
<context> <context>
<name>Contact</name> <name>Contact</name>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="150"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="164"/>
<source>information_popup_error_title</source> <source>information_popup_error_title</source>
<extracomment>Erreur</extracomment> <extracomment>Erreur</extracomment>
<translation>Erreur</translation> <translation>Erreur</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="152"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/>
<source>information_popup_voicemail_address_undefined_message</source> <source>information_popup_voicemail_address_undefined_message</source>
<extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment> <extracomment>L&apos;URI de messagerie vocale n&apos;est pas définie.</extracomment>
<translation>L&apos;URI de messagerie vocale n&apos;est pas définie.</translation> <translation>L&apos;URI de messagerie vocale n&apos;est pas définie.</translation>
</message> </message>
<message> <message>
<location filename="../../view/Control/Display/Contact/Contact.qml" line="166"/> <location filename="../../view/Control/Display/Contact/Contact.qml" line="180"/>
<source>account_settings_name_accessible_name</source> <source>account_settings_name_accessible_name</source>
<extracomment>Account settings of %1</extracomment> <extracomment>Account settings of %1</extracomment>
<translation>Paramaètres de compte de %1</translation> <translation>Paramaètres de compte de %1</translation>

View file

@ -44,7 +44,7 @@ ChatModel::ChatModel(const std::shared_ptr<linphone::ChatRoom> &chatroom, QObjec
ChatModel::~ChatModel() { ChatModel::~ChatModel() {
mustBeInLinphoneThread("~" + getClassName()); mustBeInLinphoneThread("~" + getClassName());
disconnect(CoreModel::getInstance().get(), &CoreModel::messageReadInChatRoom, this, nullptr); disconnect(CoreModel::getInstance().get(), &CoreModel::chatRoomRead, this, nullptr);
} }
QDateTime ChatModel::getLastUpdateTime() { QDateTime ChatModel::getLastUpdateTime() {
@ -173,7 +173,6 @@ void ChatModel::leave() {
void ChatModel::deleteChatRoom() { void ChatModel::deleteChatRoom() {
CoreModel::getInstance()->getCore()->deleteChatRoom(mMonitor); CoreModel::getInstance()->getCore()->deleteChatRoom(mMonitor);
emit deleted();
} }
std::shared_ptr<linphone::ChatMessage> std::shared_ptr<linphone::ChatMessage>

View file

@ -18,13 +18,11 @@ ListView {
property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60)
property ChatGui currentChatGui: model.getAt(currentIndex) || null property ChatGui currentChatGui: model.getAt(currentIndex) || null
onCurrentIndexChanged: console.log("current index changed", currentIndex)
onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center) onCurrentChatGuiChanged: positionViewAtIndex(currentIndex, ListView.Center)
property ChatGui chatToSelect: null property ChatGui chatToSelect: null
property ChatGui chatToSelectLater: null property ChatGui chatToSelectLater: null
onChatToSelectChanged: { onChatToSelectChanged: {
if (chatToSelect) { if (chatToSelect) {
console.log("chat to select changed, select", (chatToSelect ? chatToSelect.core.title : "NULL"))
// first clear the chatToSelect property in case we need to // first clear the chatToSelect property in case we need to
// force adding the chat to the list and the layout changes // force adding the chat to the list and the layout changes
var toselect = chatToSelect var toselect = chatToSelect
@ -72,9 +70,6 @@ ListView {
selectChat(mainItem.currentChatGui) selectChat(mainItem.currentChatGui)
} }
} }
onChatCreated: (chat) => {
selectChat(chat)
}
} }
// flickDeceleration: 10000 // flickDeceleration: 10000
spacing: Utils.getSizeWithScreenRatio(10) spacing: Utils.getSizeWithScreenRatio(10)
@ -100,12 +95,6 @@ ListView {
onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0)
currentIndex = 0 currentIndex = 0
onAtYEndChanged: {
if (atYEnd && count > 0) {
chatProxy.displayMore()
}
}
//---------------------------------------------------------------- //----------------------------------------------------------------
function moveToCurrentItem() { function moveToCurrentItem() {
if (mainItem.currentIndex >= 0) if (mainItem.currentIndex >= 0)