Fixed following things: Crosshair is now visible when GPS is not in use on
authorlampehe-local <henri.lampela@ixonos.com>
Fri, 11 Jun 2010 12:48:53 +0000 (15:48 +0300)
committerlampehe-local <henri.lampela@ixonos.com>
Fri, 11 Jun 2010 12:48:53 +0000 (15:48 +0300)
login, saved update location message is cleared when logout is made,
notification for location update failed is not re-formatted and is set to
be non-modal, user data is now cleared from UI when session is expired and
re-login is cancelled i.e. it reflects logged out state for UI

Reviewed by: Katri Kaikkonen & Kai Wallin

src/common.h
src/engine/engine.cpp
src/engine/engine.h
src/facebookservice/facebookauthentication.cpp
src/map/mapcommon.h
src/src.pro
src/ui/mainwindow.cpp
src/ui/mainwindow.h
src/ui/userinfo.cpp
src/ui/userinfopanel.cpp
src/ui/userinfopanel.h

index e8c2373..3ef080f 100644 (file)
@@ -35,6 +35,8 @@ const QString COOKIES = "cookies";
 const QString EMPTY = "";
 const QString SETTINGS_AUTOMATIC_UPDATE_ENABLED = "SETTINGS_AUTOMATIC_UPDATE_ENABLED";
 const QString SETTINGS_AUTOMATIC_UPDATE_INTERVAL = "SETTINGS_AUTOMATIC_UPDATE_INTERVAL";
+const QString USER_UNSEND_MESSAGE = "UNSEND_MESSAGE_CONTENT";
+const QString USER_UNSEND_MESSAGE_PUBLISH = "UNSEND_MESSAGE_PUBLISH_POLICITY";
 
 const QColor COLOR_GRAY = QColor(152, 152, 152);                           ///< Gray color
 const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
index f5bad41..7472232 100644 (file)
@@ -232,6 +232,8 @@ void SituareEngine::error(const int error)
     case SituareError::SESSION_EXPIRED:
         m_ui->buildInformationBox(tr("Session expired. Please login again"), true);
         m_facebookAuthenticator->clearAccountInformation(true); // keep username = true
+        m_loggedIn = false;
+        m_situareService->clearUserData();
         m_ui->loggedIn(false);
         m_ui->loginFailed();
         break;
@@ -357,6 +359,15 @@ void SituareEngine::logout()
 
     m_loggedIn = false;
     m_ui->loggedIn(m_loggedIn);
+
+    // we use existing updateWasSuccessful signal to clear locationUpdateDialog's data
+    connect(this, SIGNAL(clearUpdateLocationDialogData()),
+            m_ui, SIGNAL(clearUpdateLocationDialogData()));
+    emit clearUpdateLocationDialogData();
+    // disconnect immediately
+    disconnect(this, SIGNAL(clearUpdateLocationDialogData()),
+            m_ui, SIGNAL(clearUpdateLocationDialogData()));
+
     m_facebookAuthenticator->clearAccountInformation(); // clear all
     m_automaticUpdateEnabled = false;
     m_automaticUpdateFirstStart = true;
@@ -581,7 +592,7 @@ void SituareEngine::signalsFromSituareService()
             this, SLOT(updateWasSuccessful()));
 
     connect(m_situareService, SIGNAL(updateWasSuccessful()),
-            m_ui, SIGNAL(updateWasSuccessful()));
+            m_ui, SIGNAL(clearUpdateLocationDialogData()));
 }
 
 void SituareEngine::updateWasSuccessful()
index 2b93fda..39515cc 100644 (file)
@@ -68,12 +68,6 @@ public:
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public slots:
-//    /**
-//    * @brief Slot to intercept error signal from ImageFetcher and SituareService
-//    *
-//    * @param error Error message
-//    */
-//    void error(const QString &error);
     /**
     * @brief Slot to intercept error signal from ImageFetcher and SituareService
     *
@@ -263,6 +257,12 @@ signals:
     void automaticLocationUpdateEnabled(bool enabled);
 
     /**
+    * @brief Signal to clear locationUpdateDialog's data
+    *
+    */
+    void clearUpdateLocationDialogData();
+
+    /**
     * @brief Signals when new friends data is ready
     *
     * @param friendList List of User instances (friends)
index 9d0eab7..fe3d4a5 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "facebookauthentication.h"
 #include "facebookcommon.h"
-#include "../common.h"
+#include "common.h"
 #include "parser.h"
 
 FacebookAuthentication::FacebookAuthentication(QObject *parent)
@@ -58,6 +58,8 @@ void FacebookAuthentication::clearAccountInformation(bool keepUsername)
     }
 
     settings.remove(COOKIES);
+    settings.remove(USER_UNSEND_MESSAGE);
+    settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
 }
 
 const QString FacebookAuthentication::loadUsername()
index 5d66384..955ab75 100644 (file)
@@ -81,8 +81,8 @@ const QString OSM_LICENSE = QString::fromUtf8("© OpenStreetMap contributors, CC
 const int AUTO_CENTERING_DISABLE_DISTANCE = 200; ///< Distance in pixels
 
 //String constants for storing map settings:
-const QString MAP_LAST_ZOOMLEVEL = "Last_map_zoom_level"; ///< Maps last zoom level before logout
-const QString MAP_LAST_POSITION = "Last_map_location"; ///< Maps last postion before logout
+const QString MAP_LAST_ZOOMLEVEL = "LAST_MAP_ZOOM_LEVEL";   ///< Maps last zoom level before logout
+const QString MAP_LAST_POSITION = "LAST_MAP_LOCATION";      ///< Maps last postion before logout
 /**
 * @var ERROR_VALUE_NOT_FOUND_ON_SETTINGS
 * @brief Error string that program will get if value is not found on settings
index 5a88115..288513a 100644 (file)
@@ -100,7 +100,7 @@ HEADERS += ui/mainwindow.h \
 QT += network \
     webkit
 
-#DEFINES += QT_NO_DEBUG_OUTPUT
+DEFINES += QT_NO_DEBUG_OUTPUT
 
 simulator {
     SOURCES += network/networkhandlerprivatestub.cpp \
index 89c5e75..acb38c1 100644 (file)
@@ -322,8 +322,8 @@ void MainWindow::buildUserInfoPanel()
     connect(m_mapView, SIGNAL(viewResized(QSize)),
             m_userPanel, SLOT(screenResized(QSize)));
 
-    connect(this, SIGNAL(updateWasSuccessful()),
-            m_userPanel, SIGNAL(updateWasSuccessful()));
+    connect(this, SIGNAL(clearUpdateLocationDialogData()),
+            m_userPanel, SIGNAL(clearUpdateLocationDialogData()));
 
     connect(this, SIGNAL(messageSendingFailed(int)),
             m_userPanel, SIGNAL(messageSendingFailed(int)));
index 162870b..b9a1b09 100644 (file)
@@ -265,13 +265,6 @@ private:
     */
     void queueDialog(QDialog *dialog);
 
-//    /**
-//      * @brief Set own location crosshair visibility
-//      *
-//      * @param visible
-//      */
-//    void setOwnLocationCrosshairVisibility(bool visible);
-
     /**
     * @brief Shows queued error information box
     *
@@ -546,10 +539,10 @@ signals:
     void updateCredentials(const QUrl &url);
 
     /**
-    * @brief Signals when updateLocation request finished successfully
+    * @brief Signals when updateLocationDialog's data must be cleared
     *
     */
-    void updateWasSuccessful();
+    void clearUpdateLocationDialogData();
 
     /**
     * @brief MapView has finished zooming
index 22f1e21..400904d 100644 (file)
@@ -36,8 +36,6 @@ const int ICON_WIDTH = 24;  ///< Icon width
 const int MARGIN = 5; ///< Icon margin
 const int MOUSE_PRESS_AREA_WIDTH = 20;  ///< Area width for item height toggling
 const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
-const QString USER_UNSEND_MESSAGE = "User_unsend_message_content";
-const QString USER_UNSEND_MESSAGE_PUBLISH_POLICITY = "User_unsend_message_publish";
 
 /**
 * @var LABEL_MAX_WIDTH
@@ -144,10 +142,10 @@ UserInfo::~UserInfo()
 
     if (!m_backupMessage.isEmpty()) {        
         settings.setValue(USER_UNSEND_MESSAGE, m_backupMessage.toAscii());
-        settings.setValue(USER_UNSEND_MESSAGE_PUBLISH_POLICITY, m_backupFacebookPublishPolicity);
+        settings.setValue(USER_UNSEND_MESSAGE_PUBLISH, m_backupFacebookPublishPolicity);
     } else {
         settings.remove(USER_UNSEND_MESSAGE);
-        settings.remove(USER_UNSEND_MESSAGE_PUBLISH_POLICITY);
+        settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
     }
 }
 
@@ -306,9 +304,9 @@ void UserInfo::restoreUnsendMessage()
     qDebug() << __PRETTY_FUNCTION__;
 
     QSettings settings(DIRECTORY_NAME, FILE_NAME);
-    m_backupMessage = settings.value(USER_UNSEND_MESSAGE, "").toString();
+    m_backupMessage = settings.value(USER_UNSEND_MESSAGE, EMPTY).toString();
     m_backupFacebookPublishPolicity =
-            settings.value(USER_UNSEND_MESSAGE_PUBLISH_POLICITY, false).toBool();
+            settings.value(USER_UNSEND_MESSAGE_PUBLISH, false).toBool();
 }
 
 QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
@@ -337,8 +335,6 @@ void UserInfo::verifyMessageUpdateFailure(const int error)
     if (!m_messageUpdateVerified) {
 
         if (m_messageText != m_backupMessage && !m_backupMessage.isEmpty())
-//            emit notificateUpdateFailing(tr("Location update failed\n\nYour message is saved to "
-//                                            "textbox until sending will succeed"), true);
             emit notificateUpdateFailing(tr("Location update failed, please try again"), false);
     }
 
index 6cf98af..2d6dc4d 100644 (file)
@@ -64,7 +64,7 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     connect(m_userInfo, SIGNAL(refreshUserData()),
             this, SIGNAL(refreshUserData()));
 
-    connect(this, SIGNAL(updateWasSuccessful()),
+    connect(this, SIGNAL(clearUpdateLocationDialogData()),
             m_userInfo, SLOT(clearUpdateLocationDialogData()));
 
     connect (this, SIGNAL(messageSendingFailed(int)),
index 02f2713..11efde9 100644 (file)
@@ -115,10 +115,10 @@ signals:
     void statusUpdate(const QString &status, const bool &publish);
 
     /**
-    * @brief Signals when updateLocation request finished successfully
+    * @brief Signals when updateLocationDialog's data must be cleared
     *
     */
-    void updateWasSuccessful();
+    void clearUpdateLocationDialogData();
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/