summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2015-01-25 23:53:23 +0100
committerFlorian Bruhin <git@the-compiler.org>2015-02-11 23:11:34 +0100
commit9625791018950c5f20466f1f290de8178450fc01 (patch)
tree1479223502b37aa7fd5a3ad5eab6a7b83ee5a9ad
parent5c9718c8cd2165470f45cd1de56b0d0db523f2ea (diff)
downloadqutebrowser-9625791018950c5f20466f1f290de8178450fc01.tar.gz
qutebrowser-9625791018950c5f20466f1f290de8178450fc01.zip
Fix retrying of downloads after the tab is closed.
-rw-r--r--qutebrowser/browser/downloads.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py
index ce2cceff3..e56971426 100644
--- a/qutebrowser/browser/downloads.py
+++ b/qutebrowser/browser/downloads.py
@@ -165,13 +165,13 @@ class DownloadItem(QObject):
done.
fileobj: The file object to download the file to.
reply: The QNetworkReply associated with this download.
+ retry_info: A RetryInfo instance.
_filename: The filename of the download.
_redirects: How many time we were redirected already.
_buffer: A BytesIO object to buffer incoming data until we know the
target file.
_read_timer: A QTimer which reads the QNetworkReply into self._buffer
periodically.
- _retry_info: A RetryInfo instance.
_win_id: The window ID the DownloadItem runs in.
Signals:
@@ -202,7 +202,7 @@ class DownloadItem(QObject):
reply: The QNetworkReply to download.
"""
super().__init__(parent)
- self._retry_info = None
+ self.retry_info = None
self.done = False
self.stats = DownloadItemStats(self)
self.stats.updated.connect(self.data_changed)
@@ -311,8 +311,8 @@ class DownloadItem(QObject):
reply.finished.connect(self.on_reply_finished)
reply.error.connect(self.on_reply_error)
reply.readyRead.connect(self.on_ready_read)
- self._retry_info = RetryInfo(request=reply.request(),
- manager=reply.manager())
+ self.retry_info = RetryInfo(request=reply.request(),
+ manager=reply.manager())
if not self.fileobj:
self._read_timer.start()
# We could have got signals before we connected slots to them.
@@ -365,7 +365,7 @@ class DownloadItem(QObject):
def retry(self):
"""Retry a failed download."""
self.cancel()
- new_reply = self._retry_info.manager.get(self._retry_info.request)
+ new_reply = self.retry_info.manager.get(self.retry_info.request)
self.do_retry.emit(new_reply)
def open_file(self):
@@ -800,6 +800,10 @@ class DownloadManager(QAbstractListModel):
for download in self.downloads:
if download.reply is not None and download.reply.manager() is nam:
return True
+ if (download.done and (not download.successful) and
+ download.retry_info.manager is nam):
+ # user could request retry after tab is closed.
+ return True
return False
def can_clear(self):