Fix deprecation warning when clearing downloads.

This commit is contained in:
Florian Bruhin 2015-11-06 06:38:15 +01:00
parent 3fcc27636a
commit da88908815

View File

@ -125,6 +125,7 @@ class DownloadView(QListView):
- (QAction, callable) tuples. - (QAction, callable) tuples.
- (None, None) for a separator - (None, None) for a separator
""" """
model = self.model()
actions = [] actions = []
if item is None: if item is None:
pass pass
@ -134,13 +135,12 @@ class DownloadView(QListView):
else: else:
actions.append(("Retry", item.retry)) actions.append(("Retry", item.retry))
actions.append(("Remove", actions.append(("Remove",
functools.partial(self.model().remove_item, item))) functools.partial(model.remove_item, item)))
else: else:
actions.append(("Cancel", item.cancel)) actions.append(("Cancel", item.cancel))
if self.model().can_clear(): if model.can_clear():
actions.append((None, None)) actions.append((None, None))
actions.append(("Remove all finished", functools.partial( actions.append(("Remove all finished", model.download_clear))
self.model().download_remove, True)))
return actions return actions
@pyqtSlot('QPoint') @pyqtSlot('QPoint')