Ask for confirmation with :history-clear
This commit is contained in:
parent
92c3ec6435
commit
85d8d45e19
@ -40,6 +40,7 @@ Changed
|
|||||||
- When yanking a mailto: link via hints, the mailto: prefix is now stripped
|
- When yanking a mailto: link via hints, the mailto: prefix is now stripped
|
||||||
- Zoom level messages are now not stacked on top of each other anymore.
|
- Zoom level messages are now not stacked on top of each other anymore.
|
||||||
- qutebrowser now automatically uses QtWebEngine if QtWebKit is unavailable
|
- qutebrowser now automatically uses QtWebEngine if QtWebKit is unavailable
|
||||||
|
- :history-clear now asks for a confirmation, unless it's run with --force.
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
-----
|
-----
|
||||||
|
@ -420,10 +420,15 @@ Start hinting.
|
|||||||
|
|
||||||
[[history-clear]]
|
[[history-clear]]
|
||||||
=== history-clear
|
=== history-clear
|
||||||
|
Syntax: +:history-clear [*--force*]+
|
||||||
|
|
||||||
Clear all browsing history.
|
Clear all browsing history.
|
||||||
|
|
||||||
Note this only clears the global history (e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies, the back/forward history of a tab, cache or other persistent data.
|
Note this only clears the global history (e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies, the back/forward history of a tab, cache or other persistent data.
|
||||||
|
|
||||||
|
==== optional arguments
|
||||||
|
* +*-f*+, +*--force*+: Don't ask for confirmation.
|
||||||
|
|
||||||
[[home]]
|
[[home]]
|
||||||
=== home
|
=== home
|
||||||
Open main startpage in current tab.
|
Open main startpage in current tab.
|
||||||
|
@ -26,7 +26,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, QUrl, QObject
|
|||||||
|
|
||||||
from qutebrowser.commands import cmdutils
|
from qutebrowser.commands import cmdutils
|
||||||
from qutebrowser.utils import (utils, objreg, standarddir, log, qtutils,
|
from qutebrowser.utils import (utils, objreg, standarddir, log, qtutils,
|
||||||
usertypes)
|
usertypes, message)
|
||||||
from qutebrowser.config import config
|
from qutebrowser.config import config
|
||||||
from qutebrowser.misc import lineparser, objects
|
from qutebrowser.misc import lineparser, objects
|
||||||
|
|
||||||
@ -230,13 +230,23 @@ class WebHistory(QObject):
|
|||||||
self._saved_count = len(self._new_history)
|
self._saved_count = len(self._new_history)
|
||||||
|
|
||||||
@cmdutils.register(name='history-clear', instance='web-history')
|
@cmdutils.register(name='history-clear', instance='web-history')
|
||||||
def clear(self):
|
def clear(self, force=False):
|
||||||
"""Clear all browsing history.
|
"""Clear all browsing history.
|
||||||
|
|
||||||
Note this only clears the global history
|
Note this only clears the global history
|
||||||
(e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies,
|
(e.g. `~/.local/share/qutebrowser/history` on Linux) but not cookies,
|
||||||
the back/forward history of a tab, cache or other persistent data.
|
the back/forward history of a tab, cache or other persistent data.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
force: Don't ask for confirmation.
|
||||||
"""
|
"""
|
||||||
|
if force:
|
||||||
|
self._do_clear()
|
||||||
|
else:
|
||||||
|
message.confirm_async(self._do_clear, title="Clear all browsing "
|
||||||
|
"history?")
|
||||||
|
|
||||||
|
def _do_clear(self):
|
||||||
self._lineparser.clear()
|
self._lineparser.clear()
|
||||||
self.history_dict.clear()
|
self.history_dict.clear()
|
||||||
self._temp_history.clear()
|
self._temp_history.clear()
|
||||||
|
@ -4,7 +4,7 @@ Feature: Page history
|
|||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given I open about:blank
|
Given I open about:blank
|
||||||
And I run :history-clear
|
And I run :history-clear --force
|
||||||
|
|
||||||
Scenario: Simple history saving
|
Scenario: Simple history saving
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
@ -56,8 +56,15 @@ Feature: Page history
|
|||||||
Then "Changing title for idx 1 to 'about:blank'" should be logged
|
Then "Changing title for idx 1 to 'about:blank'" should be logged
|
||||||
|
|
||||||
Scenario: Clearing history
|
Scenario: Clearing history
|
||||||
|
When I open data/title.html
|
||||||
|
And I run :history-clear --force
|
||||||
|
Then the history file should be empty
|
||||||
|
|
||||||
|
Scenario: Clearing history with confirmation
|
||||||
When I open data/title.html
|
When I open data/title.html
|
||||||
And I run :history-clear
|
And I run :history-clear
|
||||||
|
And I wait for "Asking question <* title='Clear all browsing history?'>, *" in the log
|
||||||
|
And I run :prompt-accept yes
|
||||||
Then the history file should be empty
|
Then the history file should be empty
|
||||||
|
|
||||||
Scenario: History with yanked URL and 'add to history' flag
|
Scenario: History with yanked URL and 'add to history' flag
|
||||||
|
Loading…
Reference in New Issue
Block a user