update lists if day change
This commit is contained in:
parent
48ccfe95c7
commit
10ab8395f7
4 changed files with 19 additions and 0 deletions
|
|
@ -287,7 +287,18 @@ App::App(int &argc, char *argv[])
|
||||||
.arg(Utils::getOsProduct())
|
.arg(Utils::getOsProduct())
|
||||||
.arg(qVersion());
|
.arg(qVersion());
|
||||||
|
|
||||||
|
mCurrentDate = QDate::currentDate();
|
||||||
mAutoStart = autoStartEnabled();
|
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() {
|
App::~App() {
|
||||||
|
|
@ -645,6 +656,7 @@ void App::initCppInterfaces() {
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|
||||||
void App::clean() {
|
void App::clean() {
|
||||||
|
mDateUpdateTimer.stop();
|
||||||
if (mEngine) {
|
if (mEngine) {
|
||||||
mEngine->clearComponentCache();
|
mEngine->clearComponentCache();
|
||||||
mEngine->clearSingletons();
|
mEngine->clearSingletons();
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ signals:
|
||||||
void coreStartedChanged(bool coreStarted);
|
void coreStartedChanged(bool coreStarted);
|
||||||
void accountsChanged();
|
void accountsChanged();
|
||||||
void callsChanged();
|
void callsChanged();
|
||||||
|
void currentDateChanged();
|
||||||
// void executeCommand(QString command);
|
// void executeCommand(QString command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -177,6 +178,8 @@ private:
|
||||||
bool mAutoStart = false;
|
bool mAutoStart = false;
|
||||||
bool mCoreStarted = false;
|
bool mCoreStarted = false;
|
||||||
QLocale mLocale = QLocale::system();
|
QLocale mLocale = QLocale::system();
|
||||||
|
QTimer mDateUpdateTimer;
|
||||||
|
QDate mCurrentDate;
|
||||||
|
|
||||||
DECLARE_ABSTRACT_OBJECT
|
DECLARE_ABSTRACT_OBJECT
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,14 @@
|
||||||
#include "CallHistoryProxy.hpp"
|
#include "CallHistoryProxy.hpp"
|
||||||
#include "CallHistoryGui.hpp"
|
#include "CallHistoryGui.hpp"
|
||||||
#include "CallHistoryList.hpp"
|
#include "CallHistoryList.hpp"
|
||||||
|
#include "core/App.hpp"
|
||||||
|
|
||||||
DEFINE_ABSTRACT_OBJECT(CallHistoryProxy)
|
DEFINE_ABSTRACT_OBJECT(CallHistoryProxy)
|
||||||
|
|
||||||
CallHistoryProxy::CallHistoryProxy(QObject *parent) : LimitProxy(parent) {
|
CallHistoryProxy::CallHistoryProxy(QObject *parent) : LimitProxy(parent) {
|
||||||
mHistoryList = CallHistoryList::create();
|
mHistoryList = CallHistoryList::create();
|
||||||
setSourceModels(new SortFilterList(mHistoryList.get(), Qt::DescendingOrder));
|
setSourceModels(new SortFilterList(mHistoryList.get(), Qt::DescendingOrder));
|
||||||
|
connect(App::getInstance(), &App::currentDateChanged, this, [this] { emit mHistoryList->lUpdate(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CallHistoryProxy::~CallHistoryProxy() {
|
CallHistoryProxy::~CallHistoryProxy() {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "MagicSearchProxy.hpp"
|
#include "MagicSearchProxy.hpp"
|
||||||
#include "MagicSearchList.hpp"
|
#include "MagicSearchList.hpp"
|
||||||
|
#include "core/App.hpp"
|
||||||
#include "core/friend/FriendGui.hpp"
|
#include "core/friend/FriendGui.hpp"
|
||||||
|
|
||||||
MagicSearchProxy::MagicSearchProxy(QObject *parent) : LimitProxy(parent) {
|
MagicSearchProxy::MagicSearchProxy(QObject *parent) : LimitProxy(parent) {
|
||||||
|
|
@ -30,6 +31,7 @@ MagicSearchProxy::MagicSearchProxy(QObject *parent) : LimitProxy(parent) {
|
||||||
connect(this, &MagicSearchProxy::forceUpdate, [this] {
|
connect(this, &MagicSearchProxy::forceUpdate, [this] {
|
||||||
if (mList) emit mList->lSearch(mSearchText);
|
if (mList) emit mList->lSearch(mSearchText);
|
||||||
});
|
});
|
||||||
|
connect(App::getInstance(), &App::currentDateChanged, this, &MagicSearchProxy::forceUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
MagicSearchProxy::~MagicSearchProxy() {
|
MagicSearchProxy::~MagicSearchProxy() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue