mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-22 22:28:08 +00:00
- Reset all counts when requested
- Add an interface to reset count when the GUI need it - Replace handler event name to be more specific on what it is doing and make a new connection when ChatModel request to reset the count
This commit is contained in:
parent
9fb5ead0fd
commit
080b206e4a
6 changed files with 17 additions and 10 deletions
|
|
@ -638,9 +638,8 @@ void ChatModel::compose () {
|
|||
void ChatModel::resetMessageCount () {
|
||||
if (mChatRoom->getUnreadMessagesCount() > 0){
|
||||
mChatRoom->markAsRead();// Marking as read is only for messages. Not for calls.
|
||||
emit messageCountReset();
|
||||
}else if (CoreManager::getInstance()->getMissedCallCount(getPeerAddress(), getLocalAddress())>0)
|
||||
emit messageCountReset();
|
||||
}
|
||||
emit messageCountReset();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -209,8 +209,6 @@ void ChatProxyModel::reload () {
|
|||
mChatModel = CoreManager::getInstance()->getChatModel(mPeerAddress, mLocalAddress);
|
||||
|
||||
if (mChatModel) {
|
||||
mChatModel->resetMessageCount();
|
||||
mChatModel->focused();
|
||||
|
||||
ChatModel *chatModel = mChatModel.get();
|
||||
QObject::connect(chatModel, &ChatModel::isRemoteComposingChanged, this, &ChatProxyModel::handleIsRemoteComposingChanged);
|
||||
|
|
@ -220,7 +218,11 @@ void ChatProxyModel::reload () {
|
|||
|
||||
static_cast<ChatModelFilter *>(sourceModel())->setSourceModel(mChatModel.get());
|
||||
}
|
||||
|
||||
void ChatProxyModel::resetMessageCount(){
|
||||
if( mChatModel){
|
||||
mChatModel->resetMessageCount();
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static inline QWindow *getParentWindow (QObject *object) {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ public:
|
|||
|
||||
Q_INVOKABLE void compose ();
|
||||
|
||||
Q_INVOKABLE void resetMessageCount();
|
||||
|
||||
signals:
|
||||
void peerAddressChanged (const QString &peerAddress);
|
||||
void localAddressChanged (const QString &localAddress);
|
||||
|
|
|
|||
|
|
@ -98,18 +98,21 @@ void AbstractEventCountNotifier::handleChatModelCreated (const shared_ptr<ChatMo
|
|||
);
|
||||
QObject::connect(
|
||||
chatModelPtr, &ChatModel::focused,
|
||||
this, [this, chatModelPtr]() { handleChatModelFocused(chatModelPtr); }
|
||||
this, [this, chatModelPtr]() { handleResetMissedCalls(chatModelPtr); }
|
||||
);
|
||||
QObject::connect(
|
||||
chatModelPtr, &ChatModel::messageCountReset,
|
||||
this, [this, chatModelPtr]() { handleResetMissedCalls(chatModelPtr); }
|
||||
);
|
||||
}
|
||||
|
||||
void AbstractEventCountNotifier::handleChatModelFocused (ChatModel *chatModel) {
|
||||
void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) {
|
||||
auto it = mMissedCalls.find({ Utils::cleanSipAddress(chatModel->getPeerAddress()), Utils::cleanSipAddress(chatModel->getLocalAddress()) });
|
||||
if (it != mMissedCalls.cend()) {
|
||||
mMissedCalls.erase(it);
|
||||
internalnotifyEventCount();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractEventCountNotifier::handleCallMissed (CallModel *callModel) {
|
||||
++mMissedCalls[{ Utils::cleanSipAddress(callModel->getPeerAddress()), Utils::cleanSipAddress(callModel->getLocalAddress()) }];
|
||||
internalnotifyEventCount();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ private:
|
|||
|
||||
void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel);
|
||||
|
||||
void handleChatModelFocused (ChatModel *chatModel);
|
||||
void handleResetMissedCalls (ChatModel *chatModel);
|
||||
void handleCallMissed (CallModel *callModel);
|
||||
|
||||
QHash<ConferenceId, int> mMissedCalls;
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ ColumnLayout {
|
|||
if (!SettingsModel.chatEnabled) {
|
||||
setEntryTypeFilter(ChatModel.CallEntry)
|
||||
}
|
||||
resetMessageCount()
|
||||
}
|
||||
|
||||
peerAddress: conversation.peerAddress
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue