Added config option for prompting the user for a download location.

This commit is contained in:
Alexander Cogneau 2015-08-04 16:30:55 +02:00
parent c4183bc34d
commit e43a1e6444
2 changed files with 14 additions and 0 deletions

View File

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

View File

@ -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."),