Update only last check date when needed
This commit is contained in:
		
							parent
							
								
									b81bdc69eb
								
							
						
					
					
						commit
						8b84fef929
					
				@ -62,12 +62,8 @@ Manager::Manager()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Manager::~Manager()
 | 
					Manager::~Manager()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (updateAutoChecker_ && updateAutoChecker_->isLastCheckDateChanged()) {
 | 
					  if (updateAutoChecker_ && updateAutoChecker_->isLastCheckDateChanged())
 | 
				
			||||||
    Settings settings;
 | 
					    Settings::saveLastUpdateCheck(updateAutoChecker_->lastCheckDate());
 | 
				
			||||||
    settings.load();
 | 
					 | 
				
			||||||
    settings.lastUpdateCheck = updateAutoChecker_->lastCheckDate();
 | 
					 | 
				
			||||||
    settings.save();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Manager::updateSettings(const Settings &settings)
 | 
					void Manager::updateSettings(const Settings &settings)
 | 
				
			||||||
 | 
				
			|||||||
@ -254,6 +254,21 @@ void Settings::load()
 | 
				
			|||||||
  settings.endGroup();
 | 
					  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
 | 
					bool Settings::isPortable() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return isPortable_;
 | 
					  return isPortable_;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ public:
 | 
				
			|||||||
  void save() const;
 | 
					  void save() const;
 | 
				
			||||||
  void load();
 | 
					  void load();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  static void saveLastUpdateCheck(const QDateTime& dt);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  bool isPortable() const;
 | 
					  bool isPortable() const;
 | 
				
			||||||
  void setPortable(bool isPortable);
 | 
					  void setPortable(bool isPortable);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user