Added close panel call when currently selected tab is disabled.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 1 Sep 2010 11:57:25 +0000 (14:57 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 1 Sep 2010 11:57:25 +0000 (14:57 +0300)
src/ui/mainwindow.cpp
src/ui/tabbedpanel.cpp
src/ui/tabbedpanel.h

index 8b15cfb..6b6930b 100644 (file)
@@ -1028,9 +1028,6 @@ void MainWindow::updateItemVisibility()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    if (!m_loggedIn)
-        m_tabbedPanel->closePanel();
-
     m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, m_loggedIn);
 }
 
index 15b87da..807409f 100644 (file)
@@ -265,11 +265,14 @@ void TabbedPanel::setTabsEnabled(const QList<int> &tabIndexes, bool enabled)
     QButtonGroup *tabs = m_panelTabBar->tabs();
 
     foreach (int tabIndex, tabIndexes) {
-
         QAbstractButton *tabButton = tabs->button(tabIndex);
 
-        if (tabButton)
+        if (tabButton) {
+            if (tabButton == tabs->checkedButton())
+                closePanel();
+
             tabButton->setEnabled(enabled);
+        }
     }
 }
 
index c65dbbc..12fefa9 100644 (file)
@@ -98,6 +98,7 @@ public:
     /**
     * @brief Sets tabs enabled.
     *
+    * If disabled tab is currently selected, panel will be closed also
     * @param tabIndexes tab indexes to set
     * @param enabled true if should be enabled, false otherwise
     */