Clone text/icon as well when cloning tabs.

Closes #316.
This commit is contained in:
Florian Bruhin 2015-01-26 07:18:07 +01:00
parent 6576796718
commit ab2d2d79ca
3 changed files with 11 additions and 1 deletions

View File

@ -381,6 +381,10 @@ class CommandDispatcher:
curtab = self._current_widget()
tabbed_browser = self._tabbed_browser(window)
newtab = tabbed_browser.tabopen(background=bg, explicit=True)
idx = tabbed_browser.indexOf(newtab)
tabbed_browser.setTabText(idx, curtab.title().replace('&', '&&'))
tabbed_browser.setTabIcon(idx, curtab.icon())
newtab.keep_icon = True
history = qtutils.serialize(curtab.history())
qtutils.deserialize(history, newtab.history())
return newtab

View File

@ -58,6 +58,8 @@ class WebView(QWebView):
open_target: Where to open the next tab ("normal", "tab", "tab_bg")
viewing_source: Whether the webview is currently displaying source
code.
keep_icon: Whether the (e.g. cloned) icon should not be cleared on page
load.
registry: The ObjectRegistry associated with this tab.
tab_id: The tab ID of the view.
_cur_url: The current URL (accessed via cur_url property).
@ -101,6 +103,7 @@ class WebView(QWebView):
self._force_open_target = None
self._zoom = None
self._has_ssl_errors = False
self.keep_icon = False
self.init_neighborlist()
cfg = objreg.get('config')
cfg.changed.connect(self.init_neighborlist)

View File

@ -426,7 +426,10 @@ class TabbedBrowser(tabwidget.TabWidget):
# We can get signals for tabs we already deleted...
log.webview.debug("Got invalid tab {}!".format(tab))
return
self.setTabIcon(idx, QIcon())
if tab.keep_icon:
tab.keep_icon = False
else:
self.setTabIcon(idx, QIcon())
if idx == self.currentIndex():
self._update_window_title()