From e43a1e6444ff4b163371d9031042017f851eaf8e Mon Sep 17 00:00:00 2001 From: Alexander Cogneau Date: Tue, 4 Aug 2015 16:30:55 +0200 Subject: [PATCH] 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."),