From 7591a5cea5def896c354649b098b59dce792cd52 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 28 Aug 2011 18:39:18 +0200 Subject: Add option to close window by closing last tab Usual behavior in Firefox/Chrome. Let it be configurable here :) --- src/mainview.cpp | 21 ++++++++++++++------- src/rekonq.kcfg | 3 +++ src/settings/settings_tabs.ui | 7 +++++++ 3 files changed, 24 insertions(+), 7 deletions(-) (limited to 'src') 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() { diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 2d19b723..b583aa8e 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -108,6 +108,9 @@ true + + false + true diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index eb775d5d..2591fb4d 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -197,6 +197,13 @@ + + + + Closing last tab closes window + + + -- cgit v1.2.1