Added error messages and error handling for UI timeout
authorlampehe-local <henri.lampela@ixonos.com>
Thu, 3 Jun 2010 12:07:27 +0000 (15:07 +0300)
committerlampehe-local <henri.lampela@ixonos.com>
Thu, 3 Jun 2010 12:07:27 +0000 (15:07 +0300)
Reviewed by: Kaj Wallin

src/engine/engine.cpp
src/situareservice/situareservice.cpp
src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 29510b4..534a4c9 100644 (file)
@@ -374,7 +374,7 @@ void SituareEngine::signalsFromGPS()
             m_ui, SLOT(gpsTimeout()));
 
     connect(m_gps, SIGNAL(error(QString)),
-            m_ui, SLOT(gpsError(QString))); // todo...
+            this, SLOT(error(QString)));
 
     connect(m_gps, SIGNAL(position(QPointF,qreal)),
             this, SLOT(saveGPSPosition(QPointF)));
index 0cb8c4a..3a0c225 100644 (file)
@@ -206,8 +206,7 @@ QString SituareService::formUrlParameters(const QPointF &coordinates, QString st
         parameters.append(PUBLISH);
         parameters.append(EQUAL_MARK);
         parameters.append(PUBLISH_TRUE);
-    }
-    else if(publish.compare(PUBLISH_FALSE) == 0) {
+    } else if(publish.compare(PUBLISH_FALSE) == 0) {
         parameters.append(AMBERSAND_MARK);
         parameters.append(PUBLISH);
         parameters.append(EQUAL_MARK);
@@ -251,8 +250,7 @@ void SituareService::requestFinished(QNetworkReply *reply)
 
         if (reply->error()) {
             emit error(reply->errorString());
-        }
-        else {
+        } else {
             qint64 max = reply->size();
             QByteArray replyArray = reply->read(max);
             qDebug() << "Reply from: " << url << "reply " << replyArray;
@@ -260,29 +258,23 @@ void SituareService::requestFinished(QNetworkReply *reply)
             if(replyArray == ERROR_LAT.toAscii()) {
                 qDebug() << "Error: " << ERROR_LAT;
                 emit error(UPDATE_FAILED);
-            }
-            else if(replyArray == ERROR_LON.toAscii()) {
+            } else if(replyArray == ERROR_LON.toAscii()) {
                 qDebug() << "Error: " << ERROR_LON;
                 emit error(UPDATE_FAILED);
-            }
-            else if(replyArray.contains(ERROR_SESSION.toAscii())) {
+            } else if(replyArray.contains(ERROR_SESSION.toAscii())) {
                 qDebug() << "Error: " << ERROR_SESSION;
                 emit error(SESSION_EXPIRED);
-            }
-            else if(replyArray.startsWith(OPENING_BRACE_MARK.toAscii())) {
+            } else if(replyArray.startsWith(OPENING_BRACE_MARK.toAscii())) {
                 qDebug() << "JSON string";
                 parseUserData(replyArray);
-            }
-            else if(replyArray.isEmpty()) {
+            } else if(replyArray.isEmpty()) {
                 if(url.toString().contains(UPDATE_LOCATION.toAscii())) {
                     emit updateWasSuccessful();
-                }
-                else {
+                } else {
                     // session credentials are invalid
                     emit error(SESSION_EXPIRED);
                 }
-            }
-            else {
+            } else {
                 // Street address ready
                 QString address = QString::fromUtf8(replyArray);
                 emit reverseGeoReady(address);
index 44225c6..80a7b7a 100644 (file)
@@ -337,13 +337,6 @@ void MainWindow::drawOwnLocationCrosshair(int width, int height)
     }
 }
 
-void MainWindow::gpsError(const QString &message)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    showMaemoInformationBox(message);
-}
-
 void MainWindow::gpsTimeout()
 {
     qDebug() << __PRETTY_FUNCTION__;
index 55df773..af11d07 100644 (file)
@@ -249,13 +249,6 @@ private slots:
     void drawOwnLocationCrosshair(int width, int height);
 
     /**
-    * @brief Slot for gps error.
-    *
-    * @param message error message
-    */
-    void gpsError(const QString &message);
-
-    /**
     * @brief Slot for gps timeout.
     *
     * Called when request timeout occurs.