1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Tabs: Make the code work better with zero tabs

This commit is contained in:
David Rosca 2018-01-01 15:10:11 +01:00
parent 4b33364516
commit fb652ff6cd
2 changed files with 6 additions and 6 deletions

View File

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

View File

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