Merge remote-tracking branch 'origin/pr/3899'
This commit is contained in:
commit
b718c8b43a
@ -23,7 +23,7 @@ import os
|
|||||||
import time
|
import time
|
||||||
import contextlib
|
import contextlib
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSlot, QUrl, QTimer
|
from PyQt5.QtCore import pyqtSlot, QUrl, QTimer, pyqtSignal
|
||||||
|
|
||||||
from qutebrowser.commands import cmdutils, cmdexc
|
from qutebrowser.commands import cmdutils, cmdexc
|
||||||
from qutebrowser.utils import (utils, objreg, log, usertypes, message,
|
from qutebrowser.utils import (utils, objreg, log, usertypes, message,
|
||||||
@ -52,6 +52,11 @@ class WebHistory(sql.SqlTable):
|
|||||||
|
|
||||||
"""The global history of visited pages."""
|
"""The global history of visited pages."""
|
||||||
|
|
||||||
|
# All web history cleared
|
||||||
|
history_cleared = pyqtSignal()
|
||||||
|
# one url cleared
|
||||||
|
url_cleared = pyqtSignal(QUrl)
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__("History", ['url', 'title', 'atime', 'redirect'],
|
super().__init__("History", ['url', 'title', 'atime', 'redirect'],
|
||||||
constraints={'url': 'NOT NULL',
|
constraints={'url': 'NOT NULL',
|
||||||
@ -157,6 +162,7 @@ class WebHistory(sql.SqlTable):
|
|||||||
with self._handle_sql_errors():
|
with self._handle_sql_errors():
|
||||||
self.delete_all()
|
self.delete_all()
|
||||||
self.completion.delete_all()
|
self.completion.delete_all()
|
||||||
|
self.history_cleared.emit()
|
||||||
|
|
||||||
def delete_url(self, url):
|
def delete_url(self, url):
|
||||||
"""Remove all history entries with the given url.
|
"""Remove all history entries with the given url.
|
||||||
@ -168,6 +174,7 @@ class WebHistory(sql.SqlTable):
|
|||||||
qtutils.ensure_valid(qurl)
|
qtutils.ensure_valid(qurl)
|
||||||
self.delete('url', self._format_url(qurl))
|
self.delete('url', self._format_url(qurl))
|
||||||
self.completion.delete('url', self._format_completion_url(qurl))
|
self.completion.delete('url', self._format_completion_url(qurl))
|
||||||
|
self.url_cleared.emit(qurl)
|
||||||
|
|
||||||
@pyqtSlot(QUrl, QUrl, str)
|
@pyqtSlot(QUrl, QUrl, str)
|
||||||
def add_from_tab(self, url, requested_url, title):
|
def add_from_tab(self, url, requested_url, title):
|
||||||
|
@ -74,6 +74,14 @@ def init():
|
|||||||
download_manager.install(webenginesettings.private_profile)
|
download_manager.install(webenginesettings.private_profile)
|
||||||
objreg.register('webengine-download-manager', download_manager)
|
objreg.register('webengine-download-manager', download_manager)
|
||||||
|
|
||||||
|
# Clear visited links on web history clear
|
||||||
|
hist = objreg.get('web-history')
|
||||||
|
for p in [webenginesettings.default_profile,
|
||||||
|
webenginesettings.private_profile]:
|
||||||
|
hist.history_cleared.connect(p.clearAllVisitedLinks)
|
||||||
|
hist.url_cleared.connect(lambda url, profile=p:
|
||||||
|
profile.clearVisitedLinks([url]))
|
||||||
|
|
||||||
|
|
||||||
# Mapping worlds from usertypes.JsWorld to QWebEngineScript world IDs.
|
# Mapping worlds from usertypes.JsWorld to QWebEngineScript world IDs.
|
||||||
_JS_WORLD_MAP = {
|
_JS_WORLD_MAP = {
|
||||||
|
Loading…
Reference in New Issue
Block a user