Clear visited links db when running :history-clear on webengine

This commit is contained in:
Jay Kamat 2018-05-07 13:35:41 -07:00
parent d6cacdb42f
commit d0b2360745
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 11 additions and 1 deletions

View File

@ -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.

View File

@ -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 = {