Merge branch 'Carpetsmoker-last-tab'

This commit is contained in:
Florian Bruhin 2015-07-17 06:40:14 +02:00
commit bbea66c91f

View File

@ -234,17 +234,19 @@ class TabbedBrowser(tabwidget.TabWidget):
tab: The QWebView to be closed.
"""
last_close = config.get('tabs', 'last-close')
if self.count() > 1:
self._remove_tab(tab)
elif last_close == 'close':
self._remove_tab(tab)
self.close_window.emit()
elif last_close == 'blank':
tab.openurl(QUrl('about:blank'))
elif last_close == 'startpage':
tab.openurl(QUrl(config.get('general', 'startpage')[0]))
elif last_close == 'default-page':
tab.openurl(config.get('general', 'default-page'))
self._remove_tab(tab)
if self.count() == 0:
if last_close == 'close':
self.close_window.emit()
elif last_close == 'blank':
self.openurl(QUrl('about:blank'), newtab=True)
elif last_close == 'startpage':
url = QUrl(config.get('general', 'startpage')[0])
self.openurl(url, newtab=True)
elif last_close == 'default-page':
url = config.get('general', 'default-page')
self.openurl(url, newtab=True)
def _remove_tab(self, tab):
"""Remove a tab from the tab list and delete it properly.