Clear visited links db when running :history-clear on webengine
This commit is contained in:
parent
d6cacdb42f
commit
d0b2360745
@ -23,7 +23,7 @@ import os
|
||||
import time
|
||||
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.utils import (utils, objreg, log, usertypes, message,
|
||||
@ -52,6 +52,8 @@ class WebHistory(sql.SqlTable):
|
||||
|
||||
"""The global history of visited pages."""
|
||||
|
||||
history_cleared = pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__("History", ['url', 'title', 'atime', 'redirect'],
|
||||
constraints={'url': 'NOT NULL',
|
||||
@ -157,6 +159,7 @@ class WebHistory(sql.SqlTable):
|
||||
with self._handle_sql_errors():
|
||||
self.delete_all()
|
||||
self.completion.delete_all()
|
||||
self.history_cleared.emit()
|
||||
|
||||
def delete_url(self, url):
|
||||
"""Remove all history entries with the given url.
|
||||
|
@ -73,6 +73,13 @@ def init():
|
||||
download_manager.install(webenginesettings.private_profile)
|
||||
objreg.register('webengine-download-manager', download_manager)
|
||||
|
||||
# Clear visited links on web history clear
|
||||
hist = objreg.get('web-history')
|
||||
hist.history_cleared.connect(
|
||||
webenginesettings.default_profile.clearAllVisitedLinks)
|
||||
hist.history_cleared.connect(
|
||||
webenginesettings.private_profile.clearAllVisitedLinks)
|
||||
|
||||
|
||||
# Mapping worlds from usertypes.JsWorld to QWebEngineScript world IDs.
|
||||
_JS_WORLD_MAP = {
|
||||
|
Loading…
Reference in New Issue
Block a user