Update only last check date when needed
This commit is contained in:
parent
b81bdc69eb
commit
8b84fef929
@ -62,12 +62,8 @@ Manager::Manager()
|
||||
|
||||
Manager::~Manager()
|
||||
{
|
||||
if (updateAutoChecker_ && updateAutoChecker_->isLastCheckDateChanged()) {
|
||||
Settings settings;
|
||||
settings.load();
|
||||
settings.lastUpdateCheck = updateAutoChecker_->lastCheckDate();
|
||||
settings.save();
|
||||
}
|
||||
if (updateAutoChecker_ && updateAutoChecker_->isLastCheckDateChanged())
|
||||
Settings::saveLastUpdateCheck(updateAutoChecker_->lastCheckDate());
|
||||
}
|
||||
|
||||
void Manager::updateSettings(const Settings &settings)
|
||||
|
@ -254,6 +254,21 @@ void Settings::load()
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
void Settings::saveLastUpdateCheck(const QDateTime& dt)
|
||||
{
|
||||
std::unique_ptr<QSettings> ptr;
|
||||
if (QFile::exists(iniFileName)) {
|
||||
ptr = std::make_unique<QSettings>(iniFileName, QSettings::IniFormat);
|
||||
} else {
|
||||
ptr = std::make_unique<QSettings>();
|
||||
}
|
||||
auto& settings = *ptr;
|
||||
|
||||
settings.beginGroup(qs_guiGroup);
|
||||
settings.setValue(qs_lastUpdateCheck, dt);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
bool Settings::isPortable() const
|
||||
{
|
||||
return isPortable_;
|
||||
|
@ -23,6 +23,8 @@ public:
|
||||
void save() const;
|
||||
void load();
|
||||
|
||||
static void saveLastUpdateCheck(const QDateTime& dt);
|
||||
|
||||
bool isPortable() const;
|
||||
void setPortable(bool isPortable);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user