Fixed GPS/manual states when logging in
authorlampehe-local <henri.lampela@ixonos.com>
Mon, 31 May 2010 12:37:01 +0000 (15:37 +0300)
committerlampehe-local <henri.lampela@ixonos.com>
Mon, 31 May 2010 12:37:01 +0000 (15:37 +0300)
Reviewd by: Marko Niemelä

src/ui/mainwindow.cpp
src/ui/mainwindow.h

index 09caf30..417c1ed 100644 (file)
@@ -28,6 +28,8 @@
 
 #ifdef Q_WS_MAEMO_5
 #include <QtMaemo5/QMaemo5InformationBox>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
 #endif // Q_WS_MAEMO_5
 
 #include "common.h"
@@ -42,8 +44,6 @@
 #include "mainwindow.h"
 
 #include <QtGui/QX11Info>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
 
 // values for setting screen size in desktop matching N900 screen size
 const int N900_APP_WIDTH = 800;
@@ -564,7 +564,10 @@ void MainWindow::setGPSButtonEnabled(bool enabled)
     qDebug() << __PRETTY_FUNCTION__;
 
     m_gpsToggleAct->setChecked(enabled);
-    setOwnLocationCrosshairVisibility(!enabled);
+
+    if(m_loggedIn)
+        setOwnLocationCrosshairVisibility(!enabled);
+
     m_autoCenteringAct->setVisible(enabled);
 }
 
@@ -621,30 +624,6 @@ void MainWindow::showMaemoInformationBox(const QString &message, bool modal)
 #endif
 }
 
-void MainWindow::updateItemVisibility(bool show)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    if(show) {
-        m_friendsListPanel->show();
-        m_friendsListPanelSidebar->show();
-        m_userPanel->show();
-        m_userPanelSidebar->show();
-
-        if(m_drawOwnLocationCrosshair)
-            m_ownLocationCrosshair->show();
-    }
-    else {
-        m_friendsListPanel->closePanel();
-        m_friendsListPanel->hide();
-        m_friendsListPanelSidebar->hide();
-        m_userPanel->closePanel();
-        m_userPanel->hide();
-        m_userPanelSidebar->hide();
-
-        m_ownLocationCrosshair->hide();
-    }
-}
-
 void MainWindow::startLoginProcess(const QUrl &url)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -690,6 +669,33 @@ void MainWindow::toggleProgressIndicator(bool value)
 #endif // Q_WS_MAEMO_5
 }
 
+void MainWindow::updateItemVisibility(bool show)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    if(show) {
+        m_friendsListPanel->show();
+        m_friendsListPanelSidebar->show();
+        m_userPanel->show();
+        m_userPanelSidebar->show();
+
+        if(m_drawOwnLocationCrosshair) {
+            m_ownLocationCrosshair->show();
+            setGPSButtonEnabled(false);
+            emit gpsTriggered(false);
+        }
+    }
+    else {
+        m_friendsListPanel->closePanel();
+        m_friendsListPanel->hide();
+        m_friendsListPanelSidebar->hide();
+        m_userPanel->closePanel();
+        m_userPanel->hide();
+        m_userPanelSidebar->hide();
+
+        m_ownLocationCrosshair->hide();       
+    }
+}
+
 const QString MainWindow::username()
 {
     qDebug() << __PRETTY_FUNCTION__;
index 0f890de..c8b1231 100644 (file)
@@ -155,13 +155,6 @@ public slots:
     void setUsername(const QString &username);
 
     /**
-    * @brief Shows / hides Situare related UI items
-    *
-    * @param show
-    */
-    void updateItemVisibility(bool show);
-
-    /**
     * @brief Public slot to intercept signal when old cerdentials are invalid or credentials
     *        doesn't exist yet
     *
@@ -176,6 +169,13 @@ public slots:
     */
     void toggleProgressIndicator(bool state);
 
+    /**
+    * @brief Shows / hides Situare related UI items
+    *
+    * @param show
+    */
+    void updateItemVisibility(bool show);
+
 private:
     /**
       * @brief Build friend list panel and connect slots