Re-introduce chatChanged as chat list update is no longer properly working after #40

This commit is contained in:
Sebastian J. Wolf 2020-10-04 16:06:20 +02:00
parent 12119c38bc
commit 92a869f7db
3 changed files with 12 additions and 0 deletions

View file

@ -244,6 +244,16 @@ Page {
} }
} }
Connections {
target: chatListModel
onChatChanged: {
if (overviewPage.chatListCreated && changedChatId === chat_id) {
// Force update of some list item elements (currently only last message text seems to create problems). dataChanged() doesn't seem to trigger them all :(
chatListLastMessageText.text = last_message_text ? Emoji.emojify(last_message_text, Theme.fontSizeExtraSmall) : qsTr("Unknown")
}
}
}
Column { Column {
id: chatListColumn id: chatListColumn
width: parent.width - ( 2 * Theme.horizontalPageMargin ) width: parent.width - ( 2 * Theme.horizontalPageMargin )

View file

@ -493,6 +493,7 @@ void ChatListModel::handleChatLastMessageUpdated(const QString &id, const QStrin
} }
const QModelIndex modelIndex(index(chatIndex)); const QModelIndex modelIndex(index(chatIndex));
emit dataChanged(modelIndex, modelIndex, chat->updateLastMessage(lastMessage)); emit dataChanged(modelIndex, modelIndex, chat->updateLastMessage(lastMessage));
emit chatChanged(chatId);
} else { } else {
ChatData *chat = hiddenChats.value(chatId); ChatData *chat = hiddenChats.value(chatId);
if (chat) { if (chat) {

View file

@ -54,6 +54,7 @@ private slots:
signals: signals:
void showAllChatsChanged(); void showAllChatsChanged();
void chatChanged(const qlonglong &changedChatId);
private: private:
class ChatData; class ChatData;