fixup! Switch browsing history away from QWebHistoryInterface.

This commit is contained in:
Jimmy 2016-04-04 17:07:28 +12:00
parent 33fbe97863
commit b48b36a88d
2 changed files with 9 additions and 4 deletions

View File

@ -173,7 +173,11 @@ class WebHistory(QWebHistoryInterface):
self._lineparser.save() self._lineparser.save()
self._saved_count = len(self._new_history) self._saved_count = len(self._new_history)
def addHistoryEntry(self, url_string, title=""): def addHistoryEntry(self, url_string):
"""Required for a QWebHistoryInterface impl, obseleted by add_url."""
pass
def add_url(self, url_string, title=""):
"""Called by WebKit when an URL should be added to the history. """Called by WebKit when an URL should be added to the history.
Args: Args:
@ -212,3 +216,4 @@ def init(parent=None):
""" """
history = WebHistory(parent) history = WebHistory(parent)
objreg.register('web-history', history) objreg.register('web-history', history)
QWebHistoryInterface.setDefaultInterface(history)

View File

@ -146,9 +146,9 @@ class WebView(QWebView):
objreg.get('config').changed.connect(self.on_config_changed) objreg.get('config').changed.connect(self.on_config_changed)
@pyqtSlot() @pyqtSlot()
def on_initial_layout_complete(self): def on_initial_layout_completed(self):
"""Add url to history now that we have displayed something.""" """Add url to history now that we have displayed something."""
objreg.get('web-history').addHistoryEntry( objreg.get('web-history').add_url(
self.url().toDisplayString(), self.title()) self.url().toDisplayString(), self.title())
def _init_page(self): def _init_page(self):
@ -159,7 +159,7 @@ class WebView(QWebView):
page.mainFrame().loadStarted.connect(self.on_load_started) page.mainFrame().loadStarted.connect(self.on_load_started)
page.mainFrame().loadFinished.connect(self.on_load_finished) page.mainFrame().loadFinished.connect(self.on_load_finished)
page.mainFrame().initialLayoutCompleted.connect( page.mainFrame().initialLayoutCompleted.connect(
self.on_initial_layout_complete) self.on_initial_layout_completed)
page.statusBarMessage.connect( page.statusBarMessage.connect(
lambda msg: setattr(self, 'statusbar_message', msg)) lambda msg: setattr(self, 'statusbar_message', msg))
page.networkAccessManager().sslErrors.connect( page.networkAccessManager().sslErrors.connect(