diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-08-28 18:39:18 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-09-08 05:57:20 +0200 |
commit | 7591a5cea5def896c354649b098b59dce792cd52 (patch) | |
tree | ddd2de7562f51d710fb4c18a8f6c86a081531b1d /src/mainview.cpp | |
parent | Revert "Revert "This commit, available just for" (diff) | |
download | rekonq-7591a5cea5def896c354649b098b59dce792cd52.tar.xz |
Add option to close window by closing last tab
Usual behavior in Firefox/Chrome. Let it be configurable here :)
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() { |