From 79a2f8477b02c506ff8ae18367d3739aa17307ad Mon Sep 17 00:00:00 2001 From: Krzysztof Starecki Date: Mon, 31 Dec 2018 22:45:04 +0100 Subject: Fix bug with hiding installed downloads --- src/downloadmanager.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/downloadmanager.cpp') diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index b94b5864..509323c9 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -700,22 +700,18 @@ void DownloadManager::removeDownload(int index, bool deleteFile) emit aboutToUpdate(); if (index < 0) { - DownloadState minState; - if (index == -3) { - minState = STATE_UNINSTALLED; - } - else - minState = index == -1 ? STATE_READY : STATE_INSTALLED; + bool removeAll = (index == -1); + DownloadState removeState = (index == -2 ? STATE_INSTALLED : STATE_UNINSTALLED); index = 0; - for (QVector::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end();) { - if ((*iter)->m_State >= minState) { + for (QVector::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end();) { + DownloadState downloadState = (*iter)->m_State; + if ((removeAll && (downloadState >= STATE_READY)) || + (removeState == downloadState)) { removeFile(index, deleteFile); delete *iter; iter = m_ActiveDownloads.erase(iter); - //QCoreApplication::processEvents(); - } - else { + } else { ++iter; ++index; } -- cgit v1.3.1