From e43a1e6444ff4b163371d9031042017f851eaf8e Mon Sep 17 00:00:00 2001 From: Alexander Cogneau Date: Tue, 4 Aug 2015 16:30:55 +0200 Subject: [PATCH 1/4] Added config option for prompting the user for a download location. --- qutebrowser/browser/downloads.py | 9 +++++++++ qutebrowser/config/configdata.py | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index d4960f5de..f389dbaa3 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -713,6 +713,11 @@ class DownloadManager(QAbstractListModel): request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, QNetworkRequest.AlwaysNetwork) suggested_fn = urlutils.filename_from_url(request.url()) + + prompt_download_location = config.get('storage', 'prompt-download-location') + if not prompt_download_location: + filename = config.get('storage', 'download-directory') + if fileobj is not None or filename is not None: return self.fetch_request(request, page, fileobj, filename, auto_remove, suggested_fn) @@ -802,6 +807,10 @@ class DownloadManager(QAbstractListModel): if not self._update_timer.isActive(): self._update_timer.start() + prompt_download_location = config.get('storage', 'prompt-download-location') + if not prompt_download_location: + filename = config.get('storage', 'download-directory') + if filename is not None: download.set_filename(filename) elif fileobj is not None: diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 75fd1b6ad..548fe087e 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -558,6 +558,11 @@ def data(readonly=False): "sensible os-specific default. Will expand environment " "variables."), + ('prompt-download-location', + SettingValue(typ.Bool(), 'true'), + "Whether to prompt the user for the download location.\n" + "If set to false, 'download-directory' will be used."), + ('remember-download-directory', SettingValue(typ.Bool(), 'true'), "Whether to remember the last used download directory."), From 8ffe73cc5f918afc146e82192117491d5ac29fd1 Mon Sep 17 00:00:00 2001 From: Alexander Cogneau Date: Thu, 6 Aug 2015 16:44:58 +0200 Subject: [PATCH 2/4] Change 'prompt-download-location' setting to 'prompt-download-directory' --- qutebrowser/browser/downloads.py | 8 ++++---- qutebrowser/config/configdata.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index f389dbaa3..a0241f716 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -714,8 +714,8 @@ class DownloadManager(QAbstractListModel): QNetworkRequest.AlwaysNetwork) suggested_fn = urlutils.filename_from_url(request.url()) - prompt_download_location = config.get('storage', 'prompt-download-location') - if not prompt_download_location: + prompt_download_directory = config.get('storage', 'prompt-download-directory') + if not prompt_download_directory: filename = config.get('storage', 'download-directory') if fileobj is not None or filename is not None: @@ -807,8 +807,8 @@ class DownloadManager(QAbstractListModel): if not self._update_timer.isActive(): self._update_timer.start() - prompt_download_location = config.get('storage', 'prompt-download-location') - if not prompt_download_location: + prompt_download_directory = config.get('storage', 'prompt-download-directory') + if not prompt_download_directory: filename = config.get('storage', 'download-directory') if filename is not None: diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 6e0f954de..7a1f4f236 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -558,7 +558,7 @@ def data(readonly=False): "sensible os-specific default. Will expand environment " "variables."), - ('prompt-download-location', + ('prompt-download-directory', SettingValue(typ.Bool(), 'true'), "Whether to prompt the user for the download location.\n" "If set to false, 'download-directory' will be used."), From a34fa93f62c8669481d76de69bbea2bee9a7c742 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Aug 2015 18:50:32 +0200 Subject: [PATCH 3/4] Wrap long lines. --- qutebrowser/browser/downloads.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index a0241f716..4a4efe4b4 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -714,7 +714,8 @@ class DownloadManager(QAbstractListModel): QNetworkRequest.AlwaysNetwork) suggested_fn = urlutils.filename_from_url(request.url()) - prompt_download_directory = config.get('storage', 'prompt-download-directory') + prompt_download_directory = config.get('storage', + 'prompt-download-directory') if not prompt_download_directory: filename = config.get('storage', 'download-directory') @@ -807,7 +808,8 @@ class DownloadManager(QAbstractListModel): if not self._update_timer.isActive(): self._update_timer.start() - prompt_download_directory = config.get('storage', 'prompt-download-directory') + prompt_download_directory = config.get('storage', + 'prompt-download-directory') if not prompt_download_directory: filename = config.get('storage', 'download-directory') From 55d282dadb9459fc2ec57c67f9cc37ba6a38eb2a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 6 Aug 2015 18:58:09 +0200 Subject: [PATCH 4/4] Regenerate docs. --- CHANGELOG.asciidoc | 2 ++ README.asciidoc | 1 + doc/help/settings.asciidoc | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 353f5b25a..c1f4e2d2f 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -34,6 +34,8 @@ Added them. There's also a new `show-switching` option to configure the timeout. - New setting `storage -> remember-download-directory` to remember the last used download directory. +- New setting `storage -> prompt-download-directory` to download all downloads + without asking. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index 7d5431fdd..c2ecbf107 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -153,6 +153,7 @@ Contributors, sorted by the number of commits in descending order: * Martin Zimmermann * Error 800 * Brian Jackson +* Alexander Cogneau * sbinix * Tobias Patzl * Johannes Altmanninger diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 3cb7f400f..114f06b30 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -123,6 +123,7 @@ |============== |Setting|Description |<>|The directory to save downloads to. An empty value selects a sensible os-specific default. Will expand environment variables. +|<>|Whether to prompt the user for the download location. |<>|Whether to remember the last used download directory. |<>|The maximum number of pages to hold in the global memory page cache. |<>|The capacities for the global memory cache for dead objects such as stylesheets or scripts. Syntax: cacheMinDeadCapacity, cacheMaxDead, totalCapacity. @@ -1106,6 +1107,18 @@ The directory to save downloads to. An empty value selects a sensible os-specifi Default: empty +[[storage-prompt-download-directory]] +=== prompt-download-directory +Whether to prompt the user for the download location. +If set to false, 'download-directory' will be used. + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[true]+ + [[storage-remember-download-directory]] === remember-download-directory Whether to remember the last used download directory.