Merge branch 'master' of https://vcs.maemo.org/git/situare
[situare] / src / ui / mainwindow.cpp
index 5d54ec7..48d63e5 100644 (file)
@@ -55,6 +55,7 @@ MainWindow::MainWindow(QWidget *parent)
     m_errorShown(false),
     m_loggedIn(false),
     m_refresh(false),
+    m_progressIndicatorCount(0),
     m_ownLocationCrosshair(0),
     m_email(),    
     m_password(),
@@ -669,9 +670,6 @@ void MainWindow::loginFailed()
     qDebug() << __PRETTY_FUNCTION__;
 
     clearCookieJar();
-
-    toggleProgressIndicator(false);
-
     startLoginProcess();
 }
 
@@ -878,6 +876,23 @@ void MainWindow::showInformationBox()
     }
 }
 
+void MainWindow::showPanels()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(m_loggedIn) {
+        if(!m_friendsListPanel->isVisible()) {
+            m_friendsListPanel->show();
+            m_friendsListPanelSidebar->show();
+        }
+
+        if(!m_userPanel->isVisible()) {
+            m_userPanel->show();
+            m_userPanelSidebar->show();
+        }
+    }
+}
+
 void MainWindow::startLoginProcess()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -899,7 +914,16 @@ void MainWindow::toggleProgressIndicator(bool value)
     qDebug() << __PRETTY_FUNCTION__;
 
 #ifdef Q_WS_MAEMO_5
-    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, value);
+    if(value) {
+        m_progressIndicatorCount++;
+        setAttribute(Qt::WA_Maemo5ShowProgressIndicator, true);
+    } else {
+        if(m_progressIndicatorCount > 0)
+            m_progressIndicatorCount--;
+
+        if(m_progressIndicatorCount == 0)
+            setAttribute(Qt::WA_Maemo5ShowProgressIndicator, false);
+    }
 #else
     Q_UNUSED(value);
 #endif // Q_WS_MAEMO_5
@@ -909,11 +933,7 @@ void MainWindow::updateItemVisibility()
 {
     qDebug() << __PRETTY_FUNCTION__;
     
-    if(m_loggedIn) {
-        m_friendsListPanel->show();
-        m_friendsListPanelSidebar->show();
-        m_userPanel->show();
-        m_userPanelSidebar->show();
+    if(m_loggedIn) {       
 
         if(!m_gpsToggleAct->isChecked())
             setOwnLocationCrosshairVisibility(true);
@@ -945,7 +965,6 @@ void MainWindow::webViewRequestFinished(QNetworkReply *reply)
     if(reply->error() != QNetworkReply::OperationCanceledError &&
        reply->error() != QNetworkReply::NoError) {
         emit error(reply->error());
-        toggleProgressIndicator(false);
     }
 }