Selaa lähdekoodia

Respect automatic updates settings value in the updater

This was broken since we moved the updater internally. Now we check
this value before starting the timer to check for updates.
Tobias Hieta 8 vuotta sitten
vanhempi
commit
5066cf8da5
1 muutettua tiedostoa jossa 5 lisäystä ja 2 poistoa
  1. 5 2
      src/system/UpdaterComponent.cpp

+ 5 - 2
src/system/UpdaterComponent.cpp

@@ -42,7 +42,8 @@ UpdaterComponent::UpdaterComponent(QObject* parent) :
   connect(&m_netManager, &QNetworkAccessManager::finished, this, &UpdaterComponent::dlComplete);
 
   connect(&SystemComponent::Get(), &SystemComponent::userInfoChanged, [&](){
-    QTimer::singleShot(10 * 1000, this, &UpdaterComponent::checkForUpdate);
+    if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "automaticUpdates").toBool())
+      QTimer::singleShot(10 * 1000, this, &UpdaterComponent::checkForUpdate);
   });
 
   auto updateTimer = new QTimer(this);
@@ -52,7 +53,9 @@ UpdaterComponent::UpdaterComponent(QObject* parent) :
     if (diff >= (3 * 60 * 60))
       checkForUpdate();
   });
-  updateTimer->start(5 * 60 * 1000);
+
+  if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "automaticUpdates").toBool())
+    updateTimer->start(5 * 60 * 1000);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////