mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
show_past_meetings setting
This commit is contained in:
parent
a7022bc0cc
commit
c2f8dac06d
5 changed files with 61 additions and 29 deletions
|
|
@ -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<ConferenceInfoList *>(sourceModel());
|
||||
auto ciCore = list->getAt<ConferenceInfoCore>(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<ConferenceInfoCore> data) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
bool ConferenceInfoProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
||||
auto list = qobject_cast<ConferenceInfoList *>(sourceModel());
|
||||
auto ciCore = list->getAt<ConferenceInfoCore>(sourceRow);
|
||||
if (ciCore) {
|
||||
if (ciCore->getDuration() == 0) return false;
|
||||
auto meeting = getItemAtSource<ConferenceInfoList, ConferenceInfoCore>(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<ConferenceInfoList, ConferenceInfoCore>(sourceLeft.row());
|
||||
|
|
|
|||
|
|
@ -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<SettingsCore> 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<SettingsModel> 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<SettingsModel> &model) {
|
|||
// UI
|
||||
mDisableChatFeature = model->getDisableChatFeature();
|
||||
mDisableMeetingsFeature = model->getDisableMeetingsFeature();
|
||||
mShowPastMeetings = model->getShowPastMeetings();
|
||||
mDisableBroadcastFeature = model->getDisableBroadcastFeature();
|
||||
mHideSettings = model->getHideSettings();
|
||||
mHideAccountSettings = model->getHideAccountSettings();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue