diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d9200a30..3359cf611 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 5.2.3 - Undefined + +### Fixed +- Call logs : incoming filter will not display missed calls. +- Call logs synchronization. ## 5.2.2 - 2024-03-11 diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 59863e460..ba6b659cd 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -129,15 +129,6 @@ CoreManager *CoreManager::getInstance (){ return mInstance; } - -HistoryModel* CoreManager::getHistoryModel(){ - if(!mHistoryModel){ - mHistoryModel = new HistoryModel(this); - emit historyModelCreated(mHistoryModel); - } - return mHistoryModel; -} - RecorderManager* CoreManager::getRecorderManager(){ if(!mRecorderManager){ mRecorderManager = new RecorderManager(this); diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index d53116494..d28992943 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -74,7 +74,6 @@ public: return mHandlers; } - HistoryModel* getHistoryModel(); RecorderManager* getRecorderManager(); // --------------------------------------------------------------------------- @@ -184,7 +183,6 @@ signals: void coreManagerInitialized (); void chatRoomModelCreated (const QSharedPointer &chatRoomModel); - void historyModelCreated (HistoryModel *historyModel); void recorderManagerCreated(RecorderManager *recorderModel); void logsUploaded (const QString &url); diff --git a/linphone-app/src/components/history/CallHistoryListModel.cpp b/linphone-app/src/components/history/CallHistoryListModel.cpp index 1652d9088..2f999ccc7 100644 --- a/linphone-app/src/components/history/CallHistoryListModel.cpp +++ b/linphone-app/src/components/history/CallHistoryListModel.cpp @@ -44,6 +44,7 @@ QString reorder(const QString& address){ void CallHistoryListModel::reload() { beginResetModel(); mList.clear(); + mCalls.clear(); endResetModel(); auto account = CoreManager::getInstance()->getCore()->getDefaultAccount(); auto callLogs = account ? account->getCallLogs() : CoreManager::getInstance()->getCore()->getCallLogs(); @@ -76,12 +77,13 @@ void CallHistoryListModel::add(const std::listupdate(callLog); } } - + qDebug() << "Adding call : " << callLogs.size() << " => " << toAdd.size(); ProxyListModel::add(toAdd); } diff --git a/linphone-app/src/components/history/CallHistoryListModel.hpp b/linphone-app/src/components/history/CallHistoryListModel.hpp index 37888dbae..f91588610 100644 --- a/linphone-app/src/components/history/CallHistoryListModel.hpp +++ b/linphone-app/src/components/history/CallHistoryListModel.hpp @@ -48,6 +48,7 @@ signals: void countChanged(); void selectedChanged(CallHistoryModel * model); void lastCallDateChanged(); + void lastCallStatusChanged(); private: QHash> mCalls; }; diff --git a/linphone-app/src/components/history/CallHistoryProxyModel.cpp b/linphone-app/src/components/history/CallHistoryProxyModel.cpp index 6376a60d4..5c68749ab 100644 --- a/linphone-app/src/components/history/CallHistoryProxyModel.cpp +++ b/linphone-app/src/components/history/CallHistoryProxyModel.cpp @@ -40,6 +40,7 @@ CallHistoryProxyModel::CallHistoryProxyModel (QObject *parent) : QSortFilterProx sort(0); connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultAccountChanged, model, &CallHistoryListModel::reload); connect(model, &CallHistoryListModel::lastCallDateChanged, this, &CallHistoryProxyModel::invalidate); + connect(model, &CallHistoryListModel::lastCallStatusChanged, this, &CallHistoryProxyModel::invalidateFilter); App *app = App::getInstance(); connect(app->getMainWindow(), &QWindow::activeChanged, this, [this]() { handleIsActiveChanged(App::getInstance()->getMainWindow()); @@ -51,7 +52,7 @@ CallHistoryProxyModel::CallHistoryProxyModel (QObject *parent) : QSortFilterProx void CallHistoryProxyModel::setFilterFlags(int filterFlags){ if( mFilterFlags != filterFlags){ mFilterFlags = filterFlags; - invalidate(); + invalidateFilter(); emit filterFlagsChanged(); } } @@ -59,7 +60,7 @@ void CallHistoryProxyModel::setFilterFlags(int filterFlags){ void CallHistoryProxyModel::setFilterText(const QString& text){ if( mFilterText != text){ mFilterText = text; - invalidate(); + invalidateFilter(); emit filterTextChanged(); } } @@ -75,7 +76,8 @@ bool CallHistoryProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex & auto timeline = sourceModel()->data(index).value(); if( mFilterFlags > 0) { - show = ( ((mFilterFlags & CallTimelineFilter::Incoming) == CallTimelineFilter::Incoming) && !timeline->mLastCallIsOutgoing) + show = ( ((mFilterFlags & CallTimelineFilter::Incoming) == CallTimelineFilter::Incoming) + && (!timeline->mLastCallIsOutgoing && timeline->mLastCallStatus != LinphoneEnums::CallStatusMissed)) || ( ((mFilterFlags & CallTimelineFilter::Outgoing) == CallTimelineFilter::Outgoing) && timeline->mLastCallIsOutgoing) || ( ((mFilterFlags & CallTimelineFilter::Missed) == CallTimelineFilter::Missed) && timeline->mLastCallStatus == LinphoneEnums::CallStatusMissed) ; @@ -115,4 +117,4 @@ void CallHistoryProxyModel::handleIsActiveChanged (QWindow *window) { if (window->isActive() && getParentWindow(this) == window) { CoreManager::getInstance()->resetMissedCallsCount(); } -} \ No newline at end of file +} diff --git a/linphone-app/src/components/history/HistoryProxyModel.cpp b/linphone-app/src/components/history/HistoryProxyModel.cpp index e4129c414..27a83b986 100644 --- a/linphone-app/src/components/history/HistoryProxyModel.cpp +++ b/linphone-app/src/components/history/HistoryProxyModel.cpp @@ -149,13 +149,12 @@ bool HistoryProxyModel::lessThan (const QModelIndex &left, const QModelIndex &ri void HistoryProxyModel::reload () { mMaxDisplayedEntries = EntriesChunkSize; - //auto model = CoreManager::getInstance()->getHistoryModel(); - //model->reload(); static_cast(sourceModel())->setSourceModel(new HistoryModel(mCallHistoryModel)); invalidate(); } void HistoryProxyModel::resetMessageCount(){ - static_cast(static_cast(sourceModel())->sourceModel())->resetMessageCount(); + auto model = static_cast(static_cast(sourceModel())->sourceModel()); + if(model) model->resetMessageCount(); /* auto model = CoreManager::getInstance()->getHistoryModel(); if( model){ @@ -176,9 +175,7 @@ static inline QWindow *getParentWindow (QObject *object) { } void HistoryProxyModel::handleIsActiveChanged (QWindow *window) { - auto model = CoreManager::getInstance()->getHistoryModel(); - if (model && window->isActive() && getParentWindow(this) == window) { - model->focused(); - model->resetMessageCount(); + if (window->isActive() && getParentWindow(this) == window) { + resetMessageCount(); } } diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 4bd24c2db..d1d69e2c0 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -84,8 +84,9 @@ QString SipAddressesModel::DisplayNames::get(){ void SipAddressesModel::DisplayNames::updateFromCall(const std::shared_ptr& address){ auto displayName = address->getDisplayName(); - if(!displayName.empty()) + if(!displayName.empty()){ mFromCallLogs = Utils::coreStringToAppString(displayName); + } } void SipAddressesModel::DisplayNames::updateFromChatMessage(const std::shared_ptr& address){ @@ -100,7 +101,6 @@ SipAddressesModel::SipAddressesModel (QObject *parent) : QAbstractListModel(pare mCoreHandlers = coreManager->getHandlers(); QObject::connect(coreManager, &CoreManager::chatRoomModelCreated, this, &SipAddressesModel::handleChatRoomModelCreated); - QObject::connect(coreManager, &CoreManager::historyModelCreated, this, &SipAddressesModel::handleHistoryModelCreated); //Use blocking in order to apply updates before any use ContactsListModel *contacts = CoreManager::getInstance()->getContactsListModel(); QObject::connect(contacts, &ContactsListModel::contactAdded, this, &SipAddressesModel::handleContactAdded, Qt::DirectConnection); @@ -327,9 +327,6 @@ void SipAddressesModel::handleChatRoomModelCreated (const QSharedPointer contact) { for (const auto &sipAddress : contact->getVcardModel()->getLinphoneSipAddresses()) { addOrUpdateSipAddress(Utils::coreStringToAppString(sipAddress->asStringUriOnly()), sipAddress, contact); @@ -520,13 +517,14 @@ void SipAddressesModel::addOrUpdateSipAddress (SipAddressEntry &sipAddressEntry, void SipAddressesModel::addOrUpdateSipAddress (SipAddressEntry &sipAddressEntry, const shared_ptr &call) { const shared_ptr callLog = call->getCallLog(); auto lPeerAddress = callLog->getRemoteAddress(); + QString localAddress(Utils::cleanSipAddress(Utils::coreStringToAppString(callLog->getLocalAddress()->asStringUriOnly()))); QString peerAddress(Utils::cleanSipAddress(Utils::coreStringToAppString(lPeerAddress->asStringUriOnly()))); ConferenceEntry &conferenceEntry = sipAddressEntry.localAddressToConferenceEntry[ localAddress ]; - qInfo() << QStringLiteral("Update (`%1`, `%2`) from chat call.").arg(sipAddressEntry.sipAddress, localAddress); + qInfo() << QStringLiteral("Update (`%1`, `%2`, `%3`) from chat call.").arg(sipAddressEntry.sipAddress, localAddress, Utils::coreStringToAppString(lPeerAddress->asString())); conferenceEntry.timestamp = callLog->getStatus() == linphone::Call::Status::Success ? QDateTime::fromMSecsSinceEpoch((callLog->getStartDate() + callLog->getDuration()) * 1000) @@ -698,4 +696,4 @@ void SipAddressesModel::updateObservers (const QString &sipAddress, const Presen observer->setPresenceStatus(presenceStatus); observer->setPresenceTimestamp(presenceTimestamp); } -} \ No newline at end of file +} diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.hpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.hpp index 76635d7ec..639ff8ca7 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.hpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.hpp @@ -116,7 +116,6 @@ private: // --------------------------------------------------------------------------- void handleChatRoomModelCreated (const QSharedPointer &chatRoomModel); - void handleHistoryModelCreated (HistoryModel *historyModel) ; void handleContactAdded (QSharedPointer contact); void handleContactRemoved (QSharedPointer contact); diff --git a/linphone-app/ui/modules/Linphone/Timeline/CallTimeline.qml b/linphone-app/ui/modules/Linphone/Timeline/CallTimeline.qml index 6db4ad03b..550604bb0 100644 --- a/linphone-app/ui/modules/Linphone/Timeline/CallTimeline.qml +++ b/linphone-app/ui/modules/Linphone/Timeline/CallTimeline.qml @@ -122,15 +122,17 @@ ColumnLayout{ | (outgoingFilter.checked ? CallHistoryProxyModel.Outgoing : 0) | (missedFilter.checked ? CallHistoryProxyModel.Missed : 0) } + onCountChanged: if(count == 0) mainItem.entrySelected(null) delegate: Loader{ - width: view.contentWidth - asynchronous: index > 20 - active: true - sourceComponent: CallTimelineItem{ - callHistoryModel: $modelData + property CallHistoryModel historyModel: $modelData// use loader property to avoid desync variables into Component. + width: view.contentWidth + asynchronous: index > 20 + active: historyModel + sourceComponent: CallTimelineItem{ + callHistoryModel: historyModel modelIndex: index Connections{ - target: $modelData + target: historyModel onSelectedChanged:{ if(selected) { view.currentIndex = index;