mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-21 13:48:08 +00:00
Fix empty chat room on received message notification.
Remove multiple chat room reloading on notification.
This commit is contained in:
parent
bfca74ddd6
commit
938477a2c0
4 changed files with 19 additions and 19 deletions
|
|
@ -857,7 +857,8 @@ void ChatRoomModel::updateNewMessageNotice(const int& count){
|
|||
}
|
||||
}
|
||||
mUnreadMessageNotice = ChatNoticeModel::create(ChatNoticeModel::NoticeType::NoticeUnreadMessages, lastUnreadMessage,lastReceivedMessage, QString::number(count));
|
||||
prepend(mUnreadMessageNotice);
|
||||
if(mIsInitialized)
|
||||
prepend(mUnreadMessageNotice);
|
||||
qDebug() << "New message notice timestamp to :" << lastUnreadMessage.toString() << " recv at " << lastReceivedMessage.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -931,14 +932,16 @@ void ChatRoomModel::removeBindingCall(){
|
|||
}
|
||||
|
||||
void ChatRoomModel::resetData(){
|
||||
if( mBindingCalls == 0)
|
||||
if( mBindingCalls == 0) {
|
||||
ProxyListModel::resetData();
|
||||
mIsInitialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ChatRoomModel::initEntries(){
|
||||
if( mList.size() > mLastEntriesStep)
|
||||
resetData();
|
||||
if(mList.size() <= (mUnreadMessageNotice ? 1 : 0)) {
|
||||
if(!mIsInitialized) {
|
||||
qDebug() << "Internal Entries : Init";
|
||||
// On call : reinitialize all entries. This allow to free up memory
|
||||
QList<QSharedPointer<ChatEvent> > entries;
|
||||
|
|
@ -981,11 +984,11 @@ void ChatRoomModel::initEntries(){
|
|||
endInsertRows();
|
||||
auto lastIndex = index(mList.size()-1,0);
|
||||
emit dataChanged(firstIndex,lastIndex);
|
||||
updateNewMessageNotice(mChatRoom->getUnreadMessagesCount());
|
||||
updateNewMessageNotice(mChatRoom->getUnreadMessagesCount());// it will prepend notice if needed.
|
||||
}
|
||||
qDebug() << "Internal Entries : End";
|
||||
qDebug() << "Internal Entries (" << mList.size() << ") : End ";
|
||||
mIsInitialized = true;
|
||||
}
|
||||
mIsInitialized = true;
|
||||
}
|
||||
void ChatRoomModel::setEntriesLoading(const bool& loading){
|
||||
if( mEntriesLoading != loading){
|
||||
|
|
|
|||
|
|
@ -291,10 +291,8 @@ void ChatRoomProxyModel::reload (ChatRoomModel *chatRoomModel) {
|
|||
}
|
||||
|
||||
mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoomModel);
|
||||
setSourceModel(mChatRoomModel.get());
|
||||
sort(0);
|
||||
|
||||
if (mChatRoomModel) {
|
||||
|
||||
ChatRoomModel *ChatRoomModel = mChatRoomModel.get();
|
||||
QObject::connect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged);
|
||||
QObject::connect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived);
|
||||
|
|
@ -304,6 +302,8 @@ void ChatRoomProxyModel::reload (ChatRoomModel *chatRoomModel) {
|
|||
QObject::connect(ChatRoomModel, &ChatRoomModel::chatRoomDeleted, this, &ChatRoomProxyModel::chatRoomDeleted);
|
||||
mChatRoomModel->initEntries();// This way, we don't load huge chat rooms (that lead to freeze GUI)
|
||||
}
|
||||
setSourceModel(mChatRoomModel.get());
|
||||
sort(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,12 +43,8 @@ RowLayout {
|
|||
width: ChatStyle.entry.message.incoming.avatarSize
|
||||
|
||||
// The avatar is only visible for the first message of a incoming messages sequence.
|
||||
visible: {
|
||||
if (index <= 0) {
|
||||
return true // 1. First message, so visible.
|
||||
}
|
||||
return !$chatEntry.isOutgoing && !mainRow.isTopGrouped
|
||||
}
|
||||
visible: index <= 0 ? true // 1. First message, so visible.
|
||||
: $chatEntry && !$chatEntry.isOutgoing && !mainRow.isTopGrouped || false
|
||||
TooltipArea{
|
||||
delay:0
|
||||
text:avatar.username+'\n'+$chatEntry.fromSipAddress
|
||||
|
|
|
|||
|
|
@ -97,11 +97,12 @@ Notification {
|
|||
|
||||
onClicked: notification._close(function () {
|
||||
AccountSettingsModel.setDefaultAccountFromSipAddress(notification.localAddress)
|
||||
var chatroom = notification.timelineModel.getChatRoomModel()
|
||||
console.debug("Load conversation from notification: "+chatroom)
|
||||
//notification.notificationData.window.setView('Conversation', {
|
||||
// chatRoomModel: chatroom
|
||||
// })
|
||||
notification.timelineModel.selected = true
|
||||
console.debug("Load conversation from notification")
|
||||
notification.notificationData.window.setView('Conversation', {
|
||||
chatRoomModel:notification.timelineModel.getChatRoomModel()
|
||||
})
|
||||
App.smartShowWindow(notification.notificationData.window)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue