Add check for connection to http_fetcher.
[yandex-traffic] / http_fetcher.cpp
index 787b543..a518e9f 100644 (file)
@@ -2,7 +2,8 @@
 #include <QtNetwork>
 
 #include "http_fetcher.hpp"
-
+#include "connection.hpp"
+#include "globals.hpp"
 
 // --------------------------------------------------
 // HttpFetcher
@@ -24,10 +25,11 @@ void HttpFetcher::fetch (const QString& url)
 {
     QUrl u (url);
 
-    if (u.isValid ()) {
-        _http.setHost (u.host ());
-        _http.get (u.encodedPath (), &_buffer);
-    }
+    if (!CHECK_FOR_CONNECTION || ConnectionChecker::instance ()->isConnected ())
+        if (u.isValid ()) {
+            _http.setHost (u.host ());
+            _http.get (u.encodedPath (), &_buffer);
+        }
 }