#468 If the server is stopped before a download is completed, emit the Canceled message in the progress bar

This commit is contained in:
Miguel Jacq 2017-11-03 12:58:45 +11:00
parent 4387589b4f
commit 5edd4dd22c
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6

View File

@ -376,9 +376,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
if self.new_download: if self.new_download:
self.vbar.setValue(self.vbar.maximum()) self.vbar.setValue(self.vbar.maximum())
self.new_download = False self.new_download = False
# only check for requests if the server is running
if self.server_status.status != self.server_status.STATUS_STARTED:
return
events = [] events = []
@ -415,6 +412,9 @@ class OnionShareGui(QtWidgets.QMainWindow):
# close on finish? # close on finish?
if not web.get_stay_open(): if not web.get_stay_open():
self.server_status.stop_server() self.server_status.stop_server()
else:
if self.server_status.status == self.server_status.STATUS_STOPPED:
self.downloads.cancel_download(event["data"]["id"])
elif event["type"] == web.REQUEST_CANCELED: elif event["type"] == web.REQUEST_CANCELED:
self.downloads.cancel_download(event["data"]["id"]) self.downloads.cancel_download(event["data"]["id"])