summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainview.cpp21
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings/settings_tabs.ui7
3 files changed, 24 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()
{
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 @@
<entry name="openTabNoWindow" type="Bool">
<default>true</default>
</entry>
+ <entry name="lastTabClosesWindow" type="Bool">
+ <default>false</default>
+ </entry>
<entry name="alwaysShowTabBar" type="Bool">
<default>true</default>
</entry>
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
@@ -198,6 +198,13 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="kcfg_lastTabClosesWindow">
+ <property name="text">
+ <string>Closing last tab closes window</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QCheckBox" name="kcfg_openTabsBack">
<property name="text">
<string>Open new tabs in the background</string>