mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Synchronize markAsRead from devices.
This commit is contained in:
parent
60cc154576
commit
d0ca9c36ef
4 changed files with 21 additions and 0 deletions
|
|
@ -124,6 +124,10 @@ void CoreHandlers::onCallCreated(const shared_ptr<linphone::Core> &,
|
|||
emit callCreated(call);
|
||||
}
|
||||
|
||||
void CoreHandlers::onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom){
|
||||
emit chatRoomRead(chatRoom);
|
||||
}
|
||||
|
||||
void CoreHandlers::onChatRoomStateChanged(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
const std::shared_ptr<linphone::ChatRoom> & chatRoom,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ signals:
|
|||
void callTransferFailed (const std::shared_ptr<linphone::Call> &call);
|
||||
void callTransferSucceeded (const std::shared_ptr<linphone::Call> &call);
|
||||
void callCreated(const std::shared_ptr<linphone::Call> & call);
|
||||
void chatRoomRead(const std::shared_ptr<linphone::ChatRoom> &chatRoom);
|
||||
void chatRoomStateChanged(const std::shared_ptr<linphone::ChatRoom> &chatRoom,linphone::ChatRoom::State state);
|
||||
void coreStarting();
|
||||
void coreStarted ();
|
||||
|
|
@ -103,6 +104,8 @@ private:
|
|||
const std::shared_ptr<linphone::Core> & lc,
|
||||
const std::shared_ptr<linphone::Call> & call
|
||||
) override;
|
||||
|
||||
void onChatRoomRead(const std::shared_ptr<linphone::Core> & core, const std::shared_ptr<linphone::ChatRoom> & chatRoom) override;
|
||||
|
||||
void onChatRoomStateChanged(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
TimelineListModel::TimelineListModel (QObject *parent) : ProxyListModel(parent) {
|
||||
mSelectedCount = 0;
|
||||
CoreHandlers* coreHandlers= CoreManager::getInstance()->getHandlers().get();
|
||||
connect(coreHandlers, &CoreHandlers::chatRoomRead, this, &TimelineListModel::onChatRoomRead);
|
||||
connect(coreHandlers, &CoreHandlers::chatRoomStateChanged, this, &TimelineListModel::onChatRoomStateChanged);
|
||||
connect(coreHandlers, &CoreHandlers::messagesReceived, this, &TimelineListModel::update);
|
||||
connect(coreHandlers, &CoreHandlers::messagesReceived, this, &TimelineListModel::updated);
|
||||
|
|
@ -56,6 +57,7 @@ TimelineListModel::TimelineListModel (QObject *parent) : ProxyListModel(parent)
|
|||
TimelineListModel::TimelineListModel(const TimelineListModel* model){
|
||||
mSelectedCount = model->mSelectedCount;
|
||||
CoreHandlers* coreHandlers= CoreManager::getInstance()->getHandlers().get();
|
||||
connect(coreHandlers, &CoreHandlers::chatRoomRead, this, &TimelineListModel::onChatRoomRead);
|
||||
connect(coreHandlers, &CoreHandlers::chatRoomStateChanged, this, &TimelineListModel::onChatRoomStateChanged);
|
||||
connect(coreHandlers, &CoreHandlers::messagesReceived, this, &TimelineListModel::update);
|
||||
connect(coreHandlers, &CoreHandlers::messagesReceived, this, &TimelineListModel::updated);
|
||||
|
|
@ -330,6 +332,17 @@ void TimelineListModel::select(ChatRoomModel * chatRoomModel){
|
|||
}
|
||||
}
|
||||
|
||||
void TimelineListModel::onChatRoomRead(const std::shared_ptr<linphone::ChatRoom> &chatRoom){
|
||||
auto timeline = getTimeline(chatRoom, false);
|
||||
if(timeline) {
|
||||
if(timeline->getChatRoomModel()){
|
||||
timeline->getChatRoomModel()->enableMarkAsRead(true);
|
||||
timeline->getChatRoomModel()->resetMessageCount();
|
||||
timeline->getChatRoomModel()->enableMarkAsRead(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineListModel::onChatRoomStateChanged(const std::shared_ptr<linphone::ChatRoom> &chatRoom,linphone::ChatRoom::State state){
|
||||
if( state == linphone::ChatRoom::State::Created
|
||||
&& !getTimeline(chatRoom, false)){// Create a new Timeline if needed
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public slots:
|
|||
void update();
|
||||
void removeChatRoomModel(QSharedPointer<ChatRoomModel> model);
|
||||
void onSelectedHasChanged(bool selected);
|
||||
void onChatRoomRead(const std::shared_ptr<linphone::ChatRoom> &chatRoom);
|
||||
void onChatRoomStateChanged(const std::shared_ptr<linphone::ChatRoom> &chatRoom,linphone::ChatRoom::State state);
|
||||
void onCallStateChanged (const std::shared_ptr<linphone::Call> &call, linphone::Call::State state) ;
|
||||
void onCallCreated(const std::shared_ptr<linphone::Call> &call);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue