if not network, not start up gps
authorRodrigo Linfati <rodrigo@linfati.cl>
Wed, 26 Jan 2011 17:17:56 +0000 (18:17 +0100)
committerRodrigo Linfati <rodrigo@linfati.cl>
Wed, 26 Jan 2011 17:17:56 +0000 (18:17 +0100)
src/gps.cpp
src/latitude.cpp

index 05fd97d..833e438 100644 (file)
@@ -23,6 +23,14 @@ void GpsMaemo5::refresh() {
     QTimer::singleShot(interval*1000, this, SLOT(refresh()));
     QTimer::singleShot(wait*1000, this, SLOT(stop()));
 
     QTimer::singleShot(interval*1000, this, SLOT(refresh()));
     QTimer::singleShot(wait*1000, this, SLOT(stop()));
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+    QNetworkConfigurationManager mgr;
+    if (!mgr.isOnline()) {
+        qDebug() << "GpsMaemo5: offline";
+        return;
+    }
+#endif
+
 #ifdef Q_WS_MAEMO_5
     g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
     if (usegps) {
 #ifdef Q_WS_MAEMO_5
     g_object_set(G_OBJECT(control), "preferred-method", LOCATION_METHOD_ACWP, NULL);
     if (usegps) {
index 7708be8..b1b89c1 100644 (file)
@@ -43,7 +43,6 @@ LatitudeGUI::LatitudeGUI(QMainWindow *parent) : QMainWindow(parent) {
 
 void LatitudeGUI::set() {
     qDebug() << "LatitudeGUI: set";
 
 void LatitudeGUI::set() {
     qDebug() << "LatitudeGUI: set";
-    set_config();
     glatitude->update(gps->get_lat(),
                       gps->get_lon(),
                       gps->get_acc());
     glatitude->update(gps->get_lat(),
                       gps->get_lon(),
                       gps->get_acc());