downloads: Return the created DownloadItem.
This commit is contained in:
parent
6301c740d1
commit
829b8df535
@ -393,6 +393,9 @@ class DownloadManager(QAbstractListModel):
|
|||||||
url: The URL to get, as QUrl
|
url: The URL to get, as QUrl
|
||||||
page: The QWebPage to get the download from.
|
page: The QWebPage to get the download from.
|
||||||
fileobj: The file object to write the answer to.
|
fileobj: The file object to write the answer to.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
The created DownloadItem.
|
||||||
"""
|
"""
|
||||||
if not url.isValid():
|
if not url.isValid():
|
||||||
urlutils.invalid_url_error(self._win_id, url, "start download")
|
urlutils.invalid_url_error(self._win_id, url, "start download")
|
||||||
@ -403,7 +406,7 @@ class DownloadManager(QAbstractListModel):
|
|||||||
else:
|
else:
|
||||||
nam = page.networkAccessManager()
|
nam = page.networkAccessManager()
|
||||||
reply = nam.get(req)
|
reply = nam.get(req)
|
||||||
self.fetch(reply, fileobj)
|
return self.fetch(reply, fileobj)
|
||||||
|
|
||||||
@cmdutils.register(instance='download-manager', scope='window')
|
@cmdutils.register(instance='download-manager', scope='window')
|
||||||
def cancel_download(self, count: {'special': 'count'}=1):
|
def cancel_download(self, count: {'special': 'count'}=1):
|
||||||
@ -427,6 +430,9 @@ class DownloadManager(QAbstractListModel):
|
|||||||
Args:
|
Args:
|
||||||
reply: The QNetworkReply to download.
|
reply: The QNetworkReply to download.
|
||||||
fileobj: The file object to write the answer to.
|
fileobj: The file object to write the answer to.
|
||||||
|
|
||||||
|
Return:
|
||||||
|
The created DownloadItem.
|
||||||
"""
|
"""
|
||||||
if fileobj is not None and getattr(fileobj, 'name', None):
|
if fileobj is not None and getattr(fileobj, 'name', None):
|
||||||
suggested_filename = fileobj.name
|
suggested_filename = fileobj.name
|
||||||
|
Loading…
Reference in New Issue
Block a user