diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index a620ca6dd..7bb2f924c 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -287,7 +287,18 @@ App::App(int &argc, char *argv[]) .arg(Utils::getOsProduct()) .arg(qVersion()); + mCurrentDate = QDate::currentDate(); mAutoStart = autoStartEnabled(); + mDateUpdateTimer.setInterval(60000); + mDateUpdateTimer.setSingleShot(false); + connect(&mDateUpdateTimer, &QTimer::timeout, this, [this] { + auto date = QDate::currentDate(); + if (date != mCurrentDate) { + mCurrentDate = date; + emit currentDateChanged(); + } + }); + mDateUpdateTimer.start(); } App::~App() { @@ -645,6 +656,7 @@ void App::initCppInterfaces() { //------------------------------------------------------------ void App::clean() { + mDateUpdateTimer.stop(); if (mEngine) { mEngine->clearComponentCache(); mEngine->clearSingletons(); diff --git a/Linphone/core/App.hpp b/Linphone/core/App.hpp index d28dc4f1e..c10c2a371 100644 --- a/Linphone/core/App.hpp +++ b/Linphone/core/App.hpp @@ -156,6 +156,7 @@ signals: void coreStartedChanged(bool coreStarted); void accountsChanged(); void callsChanged(); + void currentDateChanged(); // void executeCommand(QString command); private: @@ -177,6 +178,8 @@ private: bool mAutoStart = false; bool mCoreStarted = false; QLocale mLocale = QLocale::system(); + QTimer mDateUpdateTimer; + QDate mCurrentDate; DECLARE_ABSTRACT_OBJECT }; diff --git a/Linphone/core/call-history/CallHistoryProxy.cpp b/Linphone/core/call-history/CallHistoryProxy.cpp index f5c9dd111..a180fd431 100644 --- a/Linphone/core/call-history/CallHistoryProxy.cpp +++ b/Linphone/core/call-history/CallHistoryProxy.cpp @@ -21,12 +21,14 @@ #include "CallHistoryProxy.hpp" #include "CallHistoryGui.hpp" #include "CallHistoryList.hpp" +#include "core/App.hpp" DEFINE_ABSTRACT_OBJECT(CallHistoryProxy) CallHistoryProxy::CallHistoryProxy(QObject *parent) : LimitProxy(parent) { mHistoryList = CallHistoryList::create(); setSourceModels(new SortFilterList(mHistoryList.get(), Qt::DescendingOrder)); + connect(App::getInstance(), &App::currentDateChanged, this, [this] { emit mHistoryList->lUpdate(); }); } CallHistoryProxy::~CallHistoryProxy() { diff --git a/Linphone/core/search/MagicSearchProxy.cpp b/Linphone/core/search/MagicSearchProxy.cpp index 97894bab3..254eb25de 100644 --- a/Linphone/core/search/MagicSearchProxy.cpp +++ b/Linphone/core/search/MagicSearchProxy.cpp @@ -20,6 +20,7 @@ #include "MagicSearchProxy.hpp" #include "MagicSearchList.hpp" +#include "core/App.hpp" #include "core/friend/FriendGui.hpp" MagicSearchProxy::MagicSearchProxy(QObject *parent) : LimitProxy(parent) { @@ -30,6 +31,7 @@ MagicSearchProxy::MagicSearchProxy(QObject *parent) : LimitProxy(parent) { connect(this, &MagicSearchProxy::forceUpdate, [this] { if (mList) emit mList->lSearch(mSearchText); }); + connect(App::getInstance(), &App::currentDateChanged, this, &MagicSearchProxy::forceUpdate); } MagicSearchProxy::~MagicSearchProxy() {