X-Git-Url: http://git.maemo.org/git/?p=googlelatitude;a=blobdiff_plain;f=src%2Fglatitude.cpp;h=b9a2aceb028c66a87ca70d90d0c3f9c8e36270e5;hp=2f9dcacf50656a62c683a68e828ecef9417af5c3;hb=4c9db197ce7c6a18405695885e4ce59d10bddf05;hpb=9d295c4f9e19164760e22d26f36b2a6164895441 diff --git a/src/glatitude.cpp b/src/glatitude.cpp index 2f9dcac..b9a2ace 100644 --- a/src/glatitude.cpp +++ b/src/glatitude.cpp @@ -40,11 +40,17 @@ void GoogleLatitude::set(double la, double lo, double ac) { longitude = lo; accuracy = ac; - qDebug() << "GoogleLatitude: set la = " << la << " lo = " << lo << " ac = " << ac; - qDebug() << "GoogleLatitude: set lastupdate = " << lastupdate << " current = " << QDateTime::currentDateTime().toUTC().toTime_t(); + qDebug() << "GoogleLatitude: set la" << la << "lo" << lo << "ac" << ac << "current" << QDateTime::currentDateTime().toUTC().toTime_t(); if (login_error) return; if (la*lo == 0) return; if ( QDateTime::currentDateTime().toUTC().toTime_t() < lastupdate + interval ) return; + + QNetworkConfigurationManager mgr; + if (!mgr.isOnline()) { + qDebug() << "GoogleLatitude: offline"; + return; + } + worker->get(QNetworkRequest(urllogin)); } @@ -78,16 +84,16 @@ void GoogleLatitude::finishedreply(QNetworkReply *r) { QString output = r->readAll(); QRegExp regexp ("Authentication required"); if (regexp.indexIn(output, 1) != -1) { - qDebug() << "GoogleLatitude: update error"; + qDebug() << "GoogleLatitude: update error auth"; login_error = true; emit ERROR(); } else { lastupdate = QDateTime::currentDateTime().toUTC().toTime_t(); - qDebug() << "GoogleLatitude: update ok " << "lastupdate = " << lastupdate; + qDebug() << "GoogleLatitude: update ok" << "lastupdate" << lastupdate; emit OK(); } } else { - qDebug() << "GoogleLatitude Error url:" << r->url(); + qDebug() << "GoogleLatitude Error url" << r->url(); qDebug() << r->rawHeaderList(); qDebug() << r->readAll(); }