diff --git a/README.asciidoc b/README.asciidoc index a28b089cc..859856d40 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -167,6 +167,7 @@ Contributors, sorted by the number of commits in descending order: * jnphilipp * Tobias Patzl * Peter Michely +* Panagiotis Ktistakis * Johannes Altmanninger * Samir Benmendil * Regina Hug diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index e21eecaf7..7be64122a 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -14,6 +14,7 @@ |<>|Close the current window. |<>|Download a given URL, or current page if no URL given. |<>|Cancel the last/[count]th download. +|<>|Remove all finished downloads from the list. |<>|Delete the last/[count]th download from disk. |<>|Open the last/[count]th download. |<>|Remove the last/[count]th download from the list. @@ -158,6 +159,10 @@ Cancel the last/[count]th download. ==== count The index of the download to cancel. +[[download-clear]] +=== download-clear +Remove all finished downloads from the list. + [[download-delete]] === download-delete Delete the last/[count]th download from disk. @@ -179,7 +184,7 @@ Syntax: +:download-remove [*--all*]+ Remove the last/[count]th download from the list. ==== optional arguments -* +*-a*+, +*--all*+: If given removes all finished downloads. +* +*-a*+, +*--all*+: Deprecated argument for removing all finished downloads. ==== count The index of the download to cancel. diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 187e23e1c..c8f434072 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -964,18 +964,25 @@ class DownloadManager(QAbstractListModel): """Check if there are finished downloads to clear.""" return any(download.done for download in self.downloads) + @cmdutils.register(instance='download-manager', scope='window') + def download_clear(self): + """Remove all finished downloads from the list.""" + finished_items = [d for d in self.downloads if d.done] + self.remove_items(finished_items) + @cmdutils.register(instance='download-manager', scope='window', count='count') def download_remove(self, all_=False, count=0): """Remove the last/[count]th download from the list. Args: - all_: If given removes all finished downloads. + all_: Deprecated argument for removing all finished downloads. count: The index of the download to cancel. """ if all_: - finished_items = [d for d in self.downloads if d.done] - self.remove_items(finished_items) + message.warning(self._win_id, ":download-remove --all is " + "deprecated - use :download-clear instead!") + self.download_clear() else: try: download = self.downloads[count - 1] diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index a5d4c00b8..6f9d7c82d 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -1373,7 +1373,7 @@ KEY_DATA = collections.OrderedDict([ ('inspector', ['wi']), ('download', ['gd']), ('download-cancel', ['ad']), - ('download-remove --all', ['cd']), + ('download-clear', ['cd']), ('view-source', ['gf']), ('tab-focus last', ['']), ('enter-mode passthrough', ['']), @@ -1497,4 +1497,6 @@ CHANGED_KEY_COMMANDS = [ (re.compile(r'^search *;; *clear-keychain$'), r'clear-keychain ;; search'), (re.compile(r'^leave-mode$'), r'clear-keychain ;; leave-mode'), + + (re.compile(r'^download-remove --all$'), r'download-clear'), ] diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index de19e0fdf..4910e2ad2 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -251,6 +251,8 @@ class TestKeyConfigParser: ('search;;foo', None), ('leave-mode', 'clear-keychain ;; leave-mode'), ('leave-mode ;; foo', None), + + ('download-remove --all', 'download-clear'), ] ) def test_migrations(self, old, new_expected):