Tabs: Make the code work better with zero tabs

remotes/origin/Falkon/3.0
David Rosca 8 years ago
parent 4b33364516
commit fb652ff6cd
  1. 8
      src/lib/tabwidget/tabbar.cpp
  2. 4
      src/lib/tabwidget/tabwidget.cpp

@ -88,7 +88,7 @@ void TabBar::loadSettings()
settings.endGroup();
setSelectionBehaviorOnRemove(activateLastTab ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);
setVisible(!(count() == 1 && m_hideTabBarWithOneTab));
setVisible(!(count() <= 1 && m_hideTabBarWithOneTab));
setUpLayout();
}
@ -107,7 +107,7 @@ void TabBar::setVisible(bool visible)
// Make sure to honor user preference
if (visible) {
visible = !(count() == 1 && m_hideTabBarWithOneTab);
visible = !(count() <= 1 && m_hideTabBarWithOneTab);
}
ComboTabBar::setVisible(visible);
@ -416,7 +416,7 @@ void TabBar::tabInserted(int index)
{
Q_UNUSED(index)
setVisible(!(count() == 1 && m_hideTabBarWithOneTab));
setVisible(!(count() <= 1 && m_hideTabBarWithOneTab));
}
void TabBar::tabRemoved(int index)
@ -424,7 +424,7 @@ void TabBar::tabRemoved(int index)
Q_UNUSED(index)
showCloseButton(currentIndex());
setVisible(!(count() == 1 && m_hideTabBarWithOneTab));
setVisible(!(count() <= 1 && m_hideTabBarWithOneTab));
// Make sure to move add tab button to correct position when there are no normal tabs
if (normalTabsCount() == 0) {

@ -471,7 +471,7 @@ void TabWidget::requestCloseTab(int index)
return;
// This would close last tab, so we close the window instead
if (count() == 1) {
if (count() <= 1) {
// If we are not closing window upon closing last tab, let's just load new-tab-url
if (m_dontCloseWithOneTab) {
if (webView->url() == m_urlOnNewTab) {
@ -661,7 +661,7 @@ void TabWidget::detachTab(int index)
{
WebTab* tab = weTab(index);
if (count() < 2) {
if (count() <= 1) {
return;
}

Loading…
Cancel
Save