From c2f8dac06d374a456e862991471d151e5ef57372 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 4 Mar 2026 12:56:39 +0100 Subject: [PATCH] show_past_meetings setting --- .../core/conference/ConferenceInfoProxy.cpp | 63 ++++++++++--------- Linphone/core/setting/SettingsCore.cpp | 12 ++++ Linphone/core/setting/SettingsCore.hpp | 1 + Linphone/model/setting/SettingsModel.cpp | 9 +++ Linphone/model/setting/SettingsModel.hpp | 5 ++ 5 files changed, 61 insertions(+), 29 deletions(-) diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 8db8619cf..bd295bff7 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -83,35 +83,6 @@ bool ConferenceInfoProxy::getAccountConnected() const { return mList && mList->getAccountConnected(); } -bool ConferenceInfoProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - auto list = qobject_cast(sourceModel()); - auto ciCore = list->getAt(sourceRow); - if (ciCore) { - if (ciCore->getDuration() == 0) return false; - bool searchTextInSubject = false; - bool searchTextInParticipant = false; - if (ciCore->getSubject().contains(mFilterText, Qt::CaseInsensitive)) searchTextInSubject = true; - for (auto &contact : ciCore->getParticipants()) { - auto infos = contact.toMap(); - if (infos["displayName"].toString().contains(mFilterText, Qt::CaseInsensitive)) { - searchTextInParticipant = true; - break; - } - } - if (!searchTextInSubject && !searchTextInParticipant) return false; - QDateTime currentDateTime = QDateTime::currentDateTimeUtc(); - if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::None)) { - return true; - } else if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::Future)) { - auto res = ciCore->getEndDateTimeUtc() >= currentDateTime; - return res; - } else return mFilterType == -1; - } else { - // if mlist count == 1 there is only the dummy row which we don't display alone - return !list->haveCurrentDate() && list->getCount() > 1 && mFilterText.isEmpty(); - } -} - void ConferenceInfoProxy::clear() { mList->clearData(); } @@ -156,6 +127,40 @@ int ConferenceInfoProxy::loadUntil(QSharedPointer data) { return -1; } +bool ConferenceInfoProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { + auto list = qobject_cast(sourceModel()); + auto ciCore = list->getAt(sourceRow); + if (ciCore) { + if (ciCore->getDuration() == 0) return false; + auto meeting = getItemAtSource(sourceRow); + auto showPastMeetings = App::getInstance()->getSettings()->getShowPastMeetings(); + if (!showPastMeetings && Utils::daysOffset(QDateTime::currentDateTimeUtc(), meeting->getDateTimeUtc()) < 0) + return false; + + bool searchTextInSubject = false; + bool searchTextInParticipant = false; + if (ciCore->getSubject().contains(mFilterText, Qt::CaseInsensitive)) searchTextInSubject = true; + for (auto &contact : ciCore->getParticipants()) { + auto infos = contact.toMap(); + if (infos["displayName"].toString().contains(mFilterText, Qt::CaseInsensitive)) { + searchTextInParticipant = true; + break; + } + } + if (!searchTextInSubject && !searchTextInParticipant) return false; + QDateTime currentDateTime = QDateTime::currentDateTimeUtc(); + if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::None)) { + return true; + } else if (mFilterType == int(ConferenceInfoProxy::ConferenceInfoFiltering::Future)) { + auto res = ciCore->getEndDateTimeUtc() >= currentDateTime; + return res; + } else return mFilterType == -1; + } else { + // if mlist count == 1 there is only the dummy row which we don't display alone + return !list->haveCurrentDate() && list->getCount() > 1 && mFilterText.isEmpty(); + } +} + bool ConferenceInfoProxy::SortFilterList::lessThan(const QModelIndex &sourceLeft, const QModelIndex &sourceRight) const { auto l = getItemAtSource(sourceLeft.row()); diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index 6fedae0a3..22745a990 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -122,6 +122,7 @@ SettingsCore::SettingsCore(QObject *parent) : QObject(parent) { // Ui INIT_CORE_MEMBER(DisableChatFeature, settingsModel) INIT_CORE_MEMBER(DisableMeetingsFeature, settingsModel) + INIT_CORE_MEMBER(ShowPastMeetings, settingsModel) INIT_CORE_MEMBER(DisableBroadcastFeature, settingsModel) INIT_CORE_MEMBER(HideSettings, settingsModel) INIT_CORE_MEMBER(HideAccountSettings, settingsModel) @@ -201,6 +202,7 @@ SettingsCore::SettingsCore(const SettingsCore &settingsCore) { // UI mDisableChatFeature = settingsCore.mDisableChatFeature; mDisableMeetingsFeature = settingsCore.mDisableMeetingsFeature; + mShowPastMeetings = settingsCore.mShowPastMeetings; mDisableBroadcastFeature = settingsCore.mDisableBroadcastFeature; mHideSettings = settingsCore.mHideSettings; mHideAccountSettings = settingsCore.mHideAccountSettings; @@ -313,6 +315,7 @@ void SettingsCore::reloadSettings() { setDisableChatFeature(settingsModel->getDisableChatFeature()); setDisableMeetingsFeature(settingsModel->getDisableMeetingsFeature()); + setShowPastMeetings(settingsModel->getShowPastMeetings()); setDisableBroadcastFeature(settingsModel->getDisableBroadcastFeature()); setHideSettings(settingsModel->getHideSettings()); @@ -564,6 +567,8 @@ void SettingsCore::setSelf(QSharedPointer me) { disableChatFeature, DisableChatFeature) DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, disableMeetingsFeature, DisableMeetingsFeature) + DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, + showPastMeetings, ShowPastMeetings) DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, disableBroadcastFeature, DisableBroadcastFeature) DEFINE_CORE_GETSET_CONNECT(mSettingsModelConnection, SettingsCore, SettingsModel, settingsModel, bool, hideSettings, @@ -690,6 +695,7 @@ void SettingsCore::reset(const SettingsCore &settingsCore) { // UI setDisableChatFeature(settingsCore.mDisableChatFeature); setDisableMeetingsFeature(settingsCore.mDisableMeetingsFeature); + setShowPastMeetings(settingsCore.mShowPastMeetings); setDisableBroadcastFeature(settingsCore.mDisableBroadcastFeature); setHideSettings(settingsCore.mHideSettings); setHideAccountSettings(settingsCore.mHideAccountSettings); @@ -1220,6 +1226,10 @@ void SettingsCore::setShowAccountDevices(bool show) { } } +bool SettingsCore::getShowPastMeetings() const { + return mShowPastMeetings; +} + bool SettingsCore::getExitOnClose() const { return mExitOnClose; } @@ -1303,6 +1313,7 @@ void SettingsCore::writeIntoModel(std::shared_ptr model) const { // UI model->setDisableChatFeature(mDisableChatFeature); model->setDisableMeetingsFeature(mDisableMeetingsFeature); + model->setShowPastMeetings(mShowPastMeetings); model->setDisableBroadcastFeature(mDisableBroadcastFeature); model->setHideSettings(mHideSettings); model->setHideAccountSettings(mHideAccountSettings); @@ -1386,6 +1397,7 @@ void SettingsCore::writeFromModel(const std::shared_ptr &model) { // UI mDisableChatFeature = model->getDisableChatFeature(); mDisableMeetingsFeature = model->getDisableMeetingsFeature(); + mShowPastMeetings = model->getShowPastMeetings(); mDisableBroadcastFeature = model->getDisableBroadcastFeature(); mHideSettings = model->getHideSettings(); mHideAccountSettings = model->getHideAccountSettings(); diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index aec2115f4..e1c58b2b6 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -279,6 +279,7 @@ public: DECLARE_CORE_GETSET_MEMBER(bool, disableChatFeature, DisableChatFeature) DECLARE_CORE_GETSET_MEMBER(bool, disableMeetingsFeature, DisableMeetingsFeature) + DECLARE_CORE_GETSET(bool, showPastMeetings, ShowPastMeetings) DECLARE_CORE_GETSET_MEMBER(bool, disableBroadcastFeature, DisableBroadcastFeature) DECLARE_CORE_GETSET_MEMBER(bool, hideSettings, HideSettings) DECLARE_CORE_GETSET_MEMBER(bool, hideAccountSettings, HideAccountSettings) diff --git a/Linphone/model/setting/SettingsModel.cpp b/Linphone/model/setting/SettingsModel.cpp index d3abeab96..d11580465 100644 --- a/Linphone/model/setting/SettingsModel.cpp +++ b/Linphone/model/setting/SettingsModel.cpp @@ -931,6 +931,15 @@ bool SettingsModel::getDisableMeetingsFeature() const { return !!mConfig->getInt(UiSection, "disable_meetings_feature", 0); } +bool SettingsModel::getShowPastMeetings() const { + return !!mConfig->getInt(UiSection, "show_past_meetings", 0); +} + +void SettingsModel::setShowPastMeetings(bool show) { + mConfig->setBool(UiSection, "show_past_meetings", show); + emit showPastMeetingsChanged(show); +} + bool SettingsModel::isCheckForUpdateAvailable() const { #ifdef ENABLE_UPDATE_CHECK return true; diff --git a/Linphone/model/setting/SettingsModel.hpp b/Linphone/model/setting/SettingsModel.hpp index 9b5adb6fa..8460f65e1 100644 --- a/Linphone/model/setting/SettingsModel.hpp +++ b/Linphone/model/setting/SettingsModel.hpp @@ -195,6 +195,9 @@ public: void setDisableMeetingsFeature(bool value); bool getDisableMeetingsFeature() const; + bool getShowPastMeetings() const; + void setShowPastMeetings(bool show); + bool isCheckForUpdateAvailable() const; bool isCheckForUpdateEnabled() const; void setCheckForUpdateEnabled(bool enable); @@ -285,6 +288,8 @@ signals: void disableMeetingsFeatureChanged(bool value); + void showPastMeetingsChanged(bool value); + void checkForUpdateEnabledChanged(); void versionCheckUrlChanged();