fix confirm-quit=downloads with finished downloads

Issue #846

.rowCount() returns all downloads, even the finished ones that have not
yet been removed from the list. For confirming the quit event, we should
only consider downloads that are still running.
This commit is contained in:
Daniel Schadt 2016-05-08 03:17:30 +02:00
parent a23aa1cc47
commit 643d2cc6dd
2 changed files with 9 additions and 1 deletions

View File

@ -1238,3 +1238,11 @@ class DownloadManager(QAbstractListModel):
# We don't have children
return 0
return len(self.downloads)
def running_downloads(self):
"""Return the amount of still running downloads.
Return:
The number of unfinished downloads.
"""
return len([1 for download in self.downloads if not download.done])

View File

@ -413,7 +413,7 @@ class MainWindow(QWidget):
tab_count = self.tabbed_browser.count()
download_manager = objreg.get('download-manager', scope='window',
window=self.win_id)
download_count = download_manager.rowCount()
download_count = download_manager.running_downloads()
quit_texts = []
# Ask if multiple-tabs are open
if 'multiple-tabs' in confirm_quit and tab_count > 1: