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 | |
| 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')
| -rw-r--r-- | src/mainview.cpp | 21 | ||||
| -rw-r--r-- | src/rekonq.kcfg | 3 | ||||
| -rw-r--r-- | src/settings/settings_tabs.ui | 7 | 
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> | 
