Check one day and try remind again.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-07-15 12:30:55 +03:00
parent 1e6dc7c0a8
commit d61c1c13bf
3 changed files with 28 additions and 1 deletions

View File

@ -157,6 +157,8 @@ void FvUpdater::RemindMeLater()
{
qDebug() << "Remind me later";
qApp->Settings()->SetDateOfLastRemind(QDate::currentDate());
hideUpdaterWindow();
}
@ -229,7 +231,14 @@ bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::CheckForUpdatesSilent()
{
if (qApp->Settings()->GetDateOfLastRemind().daysTo(QDate::currentDate()) >= 1)
{
return CheckForUpdates(true);
}
else
{
return true;
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -32,6 +32,7 @@
#include <QDebug>
#include <QLocale>
#include <QApplication>
#include <QDate>
#include "../ifc/ifcdef.h"
@ -66,6 +67,7 @@ const QString VCommonSettings::SettingGeneralWindowState = QString
const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString VCommonSettings::SettingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString VCommonSettings::SettingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
static const QString commonIniFilename = QStringLiteral("common");
@ -442,3 +444,15 @@ void VCommonSettings::SetLatestSkippedVersion(int value)
{
setValue(SettingLatestSkippedVersion, value);
}
//---------------------------------------------------------------------------------------------------------------------
QDate VCommonSettings::GetDateOfLastRemind() const
{
return value(SettingDateOfLastRemind, QDate(1900, 1, 1)).toDate();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetDateOfLastRemind(const QDate &date)
{
setValue(SettingDateOfLastRemind, date);
}

View File

@ -105,6 +105,9 @@ public:
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);
QDate GetDateOfLastRemind() const;
void SetDateOfLastRemind(const QDate &date);
private:
Q_DISABLE_COPY(VCommonSettings)
@ -132,6 +135,7 @@ private:
static const QString SettingGeneralToolbarsState;
static const QString SettingPreferenceDialogSize;
static const QString SettingLatestSkippedVersion;
static const QString SettingDateOfLastRemind;
};
#endif // VCOMMONSETTINGS_H