Skip to content
Permalink
Browse files
WebEngine: Don't save title if generated from URL
  • Loading branch information
The-Compiler committed Aug 18, 2016
1 parent 4b7a3db commit dfed2f9c9c90c28ea768e72194b4d91b0fe0a771
@@ -638,9 +638,7 @@ def _on_load_finished(self, ok):
@pyqtSlot()
def _on_history_trigger(self):
"""Emit add_history_item when triggered by backend-specific signal."""
url = self.url()
requested_url = self.url(requested=True)
self.add_history_item.emit(url, requested_url, self.title())
raise NotImplementedError

@pyqtSlot(int)
def _on_load_progress(self, perc):
@@ -24,7 +24,7 @@

import functools

from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint
from PyQt5.QtCore import pyqtSlot, Qt, QEvent, QPoint, QUrl
from PyQt5.QtGui import QKeyEvent, QIcon
from PyQt5.QtWidgets import QApplication
# pylint: disable=no-name-in-module,import-error,useless-suppression
@@ -487,6 +487,20 @@ def set_html(self, html, base_url):
def clear_ssl_errors(self):
log.stub()

@pyqtSlot()
def _on_history_trigger(self):
url = self.url()
requested_url = self.url(requested=True)

# Don't save the title if it's generated from the URL
title = self.title()
title_url = QUrl(url)
title_url.setScheme('')
if title == title_url.toDisplayString(QUrl.RemoveScheme).strip('/'):
title = ""

self.add_history_item.emit(url, requested_url, title)

def _connect_signals(self):
view = self._widget
page = view.page()
@@ -640,6 +640,12 @@ def clear_ssl_errors(self):
nam = self._widget.page().networkAccessManager()
nam.clear_all_ssl_errors()

@pyqtSlot()
def _on_history_trigger(self):
url = self.url()
requested_url = self.url(requested=True)
self.add_history_item.emit(url, requested_url, self.title())

def set_html(self, html, base_url):
self._widget.setHtml(html, base_url)

0 comments on commit dfed2f9

Please sign in to comment.