Commit 28d64620 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(MessagesCountNotifier): avoid pure virtual call

parent 97c57547
......@@ -62,7 +62,10 @@ CoreManager::CoreManager (QObject *parent, const QString &configPath) :
CoreHandlers *coreHandlers = mHandlers.get();
QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] {
new MessagesCountNotifier(mInstance);
{
MessagesCountNotifier *messagesCountNotifier = new MessagesCountNotifier(mInstance);
messagesCountNotifier->updateUnreadMessagesCount();
}
mInstance->mCallsListModel = new CallsListModel(mInstance);
mInstance->mContactsListModel = new ContactsListModel(mInstance);
......
......@@ -38,14 +38,10 @@ AbstractMessagesCountNotifier::AbstractMessagesCountNotifier (QObject *parent) :
coreManager->getHandlers().get(), &CoreHandlers::messageReceived,
this, &AbstractMessagesCountNotifier::handleMessageReceived
);
updateUnreadMessagesCount();
}
// -----------------------------------------------------------------------------
void AbstractMessagesCountNotifier::notifyUnreadMessagesCount (int) {}
void AbstractMessagesCountNotifier::updateUnreadMessagesCount () {
mUnreadMessagesCount = 0;
for (const auto &chatRoom : CoreManager::getInstance()->getCore()->getChatRooms())
......
......@@ -39,11 +39,12 @@ public:
AbstractMessagesCountNotifier (QObject *parent = Q_NULLPTR);
virtual ~AbstractMessagesCountNotifier () = default;
void updateUnreadMessagesCount ();
protected:
virtual void notifyUnreadMessagesCount (int n) = 0;
private:
void updateUnreadMessagesCount ();
void internalNotifyUnreadMessagesCount ();
void handleChatModelCreated (const std::shared_ptr<ChatModel> &chatModel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment