void GoogleLatitude::set(double la, double lo, double ac) {
latitude = la;
longitude = lo;
- accuracy = ac;
+ accuracy = ac>100000? 100000 : 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 (!accuracy) return;
if ( QDateTime::currentDateTime().toUTC().toTime_t() < lastupdate + interval ) return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
+ QNetworkConfigurationManager mgr;
+ if (!mgr.isOnline()) {
+ qDebug() << "GoogleLatitude: offline";
+ return;
+ }
+#endif
+
worker->get(QNetworkRequest(urllogin));
}
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;
+ qDebug() << output;
emit OK();
}
} else {
- qDebug() << "GoogleLatitude Error url:" << r->url();
+ qDebug() << "GoogleLatitude Error url" << r->url();
qDebug() << r->rawHeaderList();
qDebug() << r->readAll();
}