new version
[googlelatitude] / src / glatitude.cpp
index 7d8881a..a00f7c9 100644 (file)
@@ -13,7 +13,6 @@ GoogleLatitude::GoogleLatitude(QObject *parent) : QObject(parent) {
     urllogin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLogin?service=friendview");
     urldologin = QUrl::fromEncoded("https://www.google.com/accounts/ServiceLoginAuth?service=friendview");
     urlupdate = QUrl::fromEncoded("http://maps.google.com/glm/mmap/mwmfr?hl=en");
-    urlloc = QUrl::fromEncoded("http://www.google.com/loc/json");
 }
 
 void GoogleLatitude::login(QString u, QString p) {
@@ -31,11 +30,6 @@ void GoogleLatitude::set(double la, double lo, double ac) {
     worker->get(QNetworkRequest(urllogin));
 }
 
-void GoogleLatitude::get() {
-    QByteArray postloc = QByteArray("{version:\"1.1.0\"}");
-    worker->post(QNetworkRequest(urlloc),postloc);
-}
-
 void GoogleLatitude::finishedreply(QNetworkReply *r) {
     if ( r->url() == urllogin ) {
         QString aidis = r->readAll();
@@ -64,21 +58,11 @@ void GoogleLatitude::finishedreply(QNetworkReply *r) {
         QString output = r->readAll();
         QRegExp regexp ("Authentication required");
         if (regexp.indexIn(output, 1) != -1) {
-            emit setERROR();
+            emit ERROR();
         } else {
-            emit setOK();
+            emit OK();
         }
         qDebug() << output;
-    } else if ( r->url() == urlloc ) {
-        QString loc = r->readAll();
-        QRegExp regexp ("\\{\"latitude\":(.*),\"longitude\":(.*),\"accuracy\":(.*)\\}");
-        regexp.setMinimal(1);
-        regexp.indexIn(loc, 1);
-        latitude = regexp.capturedTexts().at(1).toDouble();
-        longitude = regexp.capturedTexts().at(2).toDouble();
-        accuracy = regexp.capturedTexts().at(3).toDouble();
-        emit getOK();
-        qDebug() << "lat = " + QString::number(latitude) + " lng = " + QString::number(longitude) + " acc = " + QString::number(accuracy);
     } else {
         qDebug() << "Error";
         qDebug() << "url:" << r->url();