Ver Fonte

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 há 8 anos atrás
pai
commit
5066cf8da5
1 ficheiros alterados com 5 adições e 2 exclusões
  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);
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////