mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-25 07:28:34 +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
0b0aa40cb3
commit
cdd06c4e05
5 changed files with 10 additions and 8 deletions
|
|
@ -638,9 +638,8 @@ void ChatModel::compose () {
|
||||||
void ChatModel::resetMessageCount () {
|
void ChatModel::resetMessageCount () {
|
||||||
if (mChatRoom->getUnreadMessagesCount() > 0){
|
if (mChatRoom->getUnreadMessagesCount() > 0){
|
||||||
mChatRoom->markAsRead();// Marking as read is only for messages. Not for calls.
|
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);
|
mChatModel = CoreManager::getInstance()->getChatModel(mPeerAddress, mLocalAddress);
|
||||||
|
|
||||||
if (mChatModel) {
|
if (mChatModel) {
|
||||||
mChatModel->resetMessageCount();
|
|
||||||
mChatModel->focused();
|
|
||||||
|
|
||||||
ChatModel *chatModel = mChatModel.get();
|
ChatModel *chatModel = mChatModel.get();
|
||||||
QObject::connect(chatModel, &ChatModel::isRemoteComposingChanged, this, &ChatProxyModel::handleIsRemoteComposingChanged);
|
QObject::connect(chatModel, &ChatModel::isRemoteComposingChanged, this, &ChatProxyModel::handleIsRemoteComposingChanged);
|
||||||
|
|
@ -220,7 +218,11 @@ void ChatProxyModel::reload () {
|
||||||
|
|
||||||
static_cast<ChatModelFilter *>(sourceModel())->setSourceModel(mChatModel.get());
|
static_cast<ChatModelFilter *>(sourceModel())->setSourceModel(mChatModel.get());
|
||||||
}
|
}
|
||||||
|
void ChatProxyModel::resetMessageCount(){
|
||||||
|
if( mChatModel){
|
||||||
|
mChatModel->resetMessageCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
static inline QWindow *getParentWindow (QObject *object) {
|
static inline QWindow *getParentWindow (QObject *object) {
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,8 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void compose ();
|
Q_INVOKABLE void compose ();
|
||||||
|
|
||||||
|
Q_INVOKABLE void resetMessageCount();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void peerAddressChanged (const QString &peerAddress);
|
void peerAddressChanged (const QString &peerAddress);
|
||||||
void localAddressChanged (const QString &localAddress);
|
void localAddressChanged (const QString &localAddress);
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,6 @@ void AbstractEventCountNotifier::handleResetAllMissedCalls () {
|
||||||
internalnotifyEventCount();
|
internalnotifyEventCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) {
|
void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) {
|
||||||
auto it = mMissedCalls.find({ Utils::cleanSipAddress(chatModel->getPeerAddress()), Utils::cleanSipAddress(chatModel->getLocalAddress()) });
|
auto it = mMissedCalls.find({ Utils::cleanSipAddress(chatModel->getPeerAddress()), Utils::cleanSipAddress(chatModel->getLocalAddress()) });
|
||||||
if (it != mMissedCalls.cend()) {
|
if (it != mMissedCalls.cend()) {
|
||||||
|
|
@ -129,7 +128,6 @@ void AbstractEventCountNotifier::handleResetMissedCalls (ChatModel *chatModel) {
|
||||||
internalnotifyEventCount();
|
internalnotifyEventCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractEventCountNotifier::handleCallMissed (CallModel *callModel) {
|
void AbstractEventCountNotifier::handleCallMissed (CallModel *callModel) {
|
||||||
++mMissedCalls[{ Utils::cleanSipAddress(callModel->getPeerAddress()), Utils::cleanSipAddress(callModel->getLocalAddress()) }];
|
++mMissedCalls[{ Utils::cleanSipAddress(callModel->getPeerAddress()), Utils::cleanSipAddress(callModel->getLocalAddress()) }];
|
||||||
internalnotifyEventCount();
|
internalnotifyEventCount();
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,7 @@ ColumnLayout {
|
||||||
if (!SettingsModel.chatEnabled) {
|
if (!SettingsModel.chatEnabled) {
|
||||||
setEntryTypeFilter(ChatModel.CallEntry)
|
setEntryTypeFilter(ChatModel.CallEntry)
|
||||||
}
|
}
|
||||||
|
resetMessageCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
peerAddress: conversation.peerAddress
|
peerAddress: conversation.peerAddress
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue