From: Jussi Laitinen Date: Wed, 1 Sep 2010 11:57:25 +0000 (+0300) Subject: Added close panel call when currently selected tab is disabled. X-Git-Tag: v2.0b-1~19^2~4 X-Git-Url: http://git.maemo.org/git/?p=situare;a=commitdiff_plain;h=a12fcf5cd7259846c1c769f801a3dd03b946ac94 Added close panel call when currently selected tab is disabled. --- diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 8b15cfb..6b6930b 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -1028,9 +1028,6 @@ void MainWindow::updateItemVisibility() { qDebug() << __PRETTY_FUNCTION__; - if (!m_loggedIn) - m_tabbedPanel->closePanel(); - m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, m_loggedIn); } diff --git a/src/ui/tabbedpanel.cpp b/src/ui/tabbedpanel.cpp index 15b87da..807409f 100644 --- a/src/ui/tabbedpanel.cpp +++ b/src/ui/tabbedpanel.cpp @@ -265,11 +265,14 @@ void TabbedPanel::setTabsEnabled(const QList &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); + } } } diff --git a/src/ui/tabbedpanel.h b/src/ui/tabbedpanel.h index c65dbbc..12fefa9 100644 --- a/src/ui/tabbedpanel.h +++ b/src/ui/tabbedpanel.h @@ -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 */