Error message is shown when location search does not find locations routing_and_searching_errors
authorSami Rämö <sami.ramo@ixonos.com>
Fri, 27 Aug 2010 08:20:41 +0000 (11:20 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Fri, 27 Aug 2010 08:49:04 +0000 (11:49 +0300)
 - Reviewed by Katri Kaikkonen

 - Also removed some old, unused error stuff

src/engine/engine.cpp
src/error.h
src/routing/geocodingservice.cpp

index 0878053..e78a417 100644 (file)
@@ -265,8 +265,6 @@ void SituareEngine::error(const int context, const int error)
         m_ui->buildInformationBox(tr("Data retrieval failed, please try again"), true);
         break;
     case SituareError::ADDRESS_RETRIEVAL_FAILED:
-    case SituareError::ERROR_GEOLOCATION_REQUEST_FAIL:
-    case SituareError::ERROR_GEOLOCATION_LONLAT_INVALID:
         m_ui->toggleProgressIndicator(false);
         m_ui->buildInformationBox(tr("Address retrieval failed"), true);
         break;
@@ -285,14 +283,13 @@ void SituareEngine::error(const int context, const int error)
         m_ui->loggedIn(false);
         m_facebookAuthenticator->clearAccountInformation(false); // clean all
         break;
-    case SituareError::ERROR_GEOLOCATION_SERVER_UNAVAILABLE:
-        m_ui->toggleProgressIndicator(false);
-        m_ui->buildInformationBox(tr("Address server not responding"), true);
-        break;
     case SituareError::ERROR_ROUTING_FAILED:
         m_ui->toggleProgressIndicator(false);
         m_ui->buildInformationBox(tr("Routing failed"), true);
         break;
+    case SituareError::ERROR_LOCATION_SEARCH_FAILED:
+        m_ui->buildInformationBox(tr("No results found"), true);
+        break;
     default:
         m_ui->toggleProgressIndicator(false);
         if(context == ErrorContext::NETWORK)
@@ -592,6 +589,9 @@ void SituareEngine::signalsFromGeocodingService()
 
     connect(m_geocodingService, SIGNAL(locationDataParsed(const QList<Location>&)),
             m_ui, SIGNAL(locationDataParsed(const QList<Location>&)));
+
+    connect(m_geocodingService, SIGNAL(error(int, int)),
+            this, SLOT(error(int, int)));
 }
 
 void SituareEngine::signalsFromGPS()
index 8317c92..14af6f0 100644 (file)
@@ -37,10 +37,8 @@ namespace SituareError {
         MAP_IMAGE_DOWNLOAD_FAILED,  // map image download failed from OSM
         GPS_INITIALIZATION_FAILED,  // GPS intialization failed
         INVALID_JSON,               // JSON parsing failed i.e. invalid JSON string
-        ERROR_GEOLOCATION_SERVER_UNAVAILABLE = 501, // reverseGeo server not responding
-        ERROR_GEOLOCATION_REQUEST_FAIL,             // reverseGeo response failed
-        ERROR_GEOLOCATION_LONLAT_INVALID,           // reverseGeo failed, invalid lon/lat
-        ERROR_ROUTING_FAILED       // routing failed
+        ERROR_ROUTING_FAILED,       // routing failed
+        ERROR_LOCATION_SEARCH_FAILED
     };
 }
 
index e38fc2a..165bc7b 100644 (file)
@@ -23,7 +23,7 @@
 #include "parser.h"
 
 #include "coordinates/geocoordinate.h"
-#include "error.h"
+#include "../error.h"
 #include "network/networkaccessmanager.h"
 
 #include "geocodingservice.h"
@@ -50,7 +50,7 @@ void GeocodingService::parseSearchResults(const QByteArray &jsonReply)
     bool ok;
     QVariantMap result = parser.parse(jsonReply, &ok).toMap();
     if (!ok) {
-        emit error(ErrorContext::SITUARE, SituareError::INVALID_JSON);
+        emit error(ErrorContext::SITUARE, SituareError::ERROR_LOCATION_SEARCH_FAILED);
         return;
     } else if(result.value("status") != NO_DATA) {
         foreach(QVariant hitVariant, result["results"].toList()) {
@@ -86,6 +86,8 @@ void GeocodingService::parseSearchResults(const QByteArray &jsonReply)
         }
 
         emit locationDataParsed(m_searchResults);
+    } else {
+        emit error(ErrorContext::SITUARE, SituareError::ERROR_LOCATION_SEARCH_FAILED);
     }
 }