Fix removing of automatic downloads w/ -1 timeout.

With ui -> remove-finished-downloads set to -1, when a download was started
with auto_remove=True (like with :adblock-update), there was a QTimer set up
with timeout -1, which causes this instead of doing something sane:

WARNING: QTimer::singleShot: Timers cannot have negative timeouts
This commit is contained in:
Florian Bruhin 2015-11-09 22:45:51 +01:00
parent 566f94111c
commit 2fc1612bd4

View File

@ -793,10 +793,15 @@ class DownloadManager(QAbstractListModel):
download = DownloadItem(reply, self._win_id, self)
download.cancelled.connect(
functools.partial(self.remove_item, download))
delay = config.get('ui', 'remove-finished-downloads')
if delay > -1 or auto_remove:
if delay > -1:
download.finished.connect(
functools.partial(self.remove_item_delayed, download, delay))
elif auto_remove:
download.finished.connect(
functools.partial(self.remove_item, download))
download.data_changed.connect(
functools.partial(self.on_data_changed, download))
download.error.connect(self.on_error)