Merge branch 'acogneau-master'

This commit is contained in:
Florian Bruhin 2015-08-06 19:00:02 +02:00
commit c715b24bd3
5 changed files with 32 additions and 0 deletions

View File

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

View File

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

View File

@ -123,6 +123,7 @@
|==============
|Setting|Description
|<<storage-download-directory,download-directory>>|The directory to save downloads to. An empty value selects a sensible os-specific default. Will expand environment variables.
|<<storage-prompt-download-directory,prompt-download-directory>>|Whether to prompt the user for the download location.
|<<storage-remember-download-directory,remember-download-directory>>|Whether to remember the last used download directory.
|<<storage-maximum-pages-in-cache,maximum-pages-in-cache>>|The maximum number of pages to hold in the global memory page cache.
|<<storage-object-cache-capacities,object-cache-capacities>>|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.

View File

@ -713,6 +713,12 @@ class DownloadManager(QAbstractListModel):
request.setAttribute(QNetworkRequest.CacheLoadControlAttribute,
QNetworkRequest.AlwaysNetwork)
suggested_fn = urlutils.filename_from_url(request.url())
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:
return self.fetch_request(request, page, fileobj, filename,
auto_remove, suggested_fn)
@ -802,6 +808,11 @@ class DownloadManager(QAbstractListModel):
if not self._update_timer.isActive():
self._update_timer.start()
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:
download.set_filename(filename)
elif fileobj is not None:

View File

@ -558,6 +558,11 @@ def data(readonly=False):
"sensible os-specific default. Will expand environment "
"variables."),
('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."),
('remember-download-directory',
SettingValue(typ.Bool(), 'true'),
"Whether to remember the last used download directory."),