diff options
Diffstat (limited to 'src/mainview.cpp')
-rw-r--r-- | src/mainview.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index 9869aafd..6d907ea2 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -434,9 +434,21 @@ void MainView::cloneTab(int index) // When index is -1 index chooses the current tab void MainView::closeTab(int index, bool del) { - // open default homePage if just one tab is opened + if (index < 0) + index = currentIndex(); + if (index < 0 || index >= count()) + return; + if (count() == 1) { + if (ReKonfig::lastTabClosesWindow()) + { + // closing window... + m_parentWindow->close(); + return; + } + + // open default homePage if just one tab is opened WebView *w = currentWebTab()->view(); if (currentWebTab()->url().protocol() == QL1S("about")) @@ -458,11 +470,6 @@ void MainView::closeTab(int index, bool del) return; } - if (index < 0) - index = currentIndex(); - if (index < 0 || index >= count()) - return; - WebTab *tabToClose = webTab(index); if (!tabToClose) return; @@ -505,8 +512,8 @@ void MainView::closeTab(int index, bool del) // if tab was not focused, current index does not change... if (index != currentIndex()) emit tabsChanged(); -} +} void MainView::webViewLoadStarted() { |