diff options
| author | Krzysztof Starecki <krzysztof.starecki@gmail.com> | 2018-12-31 22:45:04 +0100 |
|---|---|---|
| committer | Krzysztof Starecki <krzysztof.starecki@gmail.com> | 2018-12-31 22:45:04 +0100 |
| commit | 79a2f8477b02c506ff8ae18367d3739aa17307ad (patch) | |
| tree | 3c29b227a91b9d5c46b6ca7a9ce6ded297f898eb | |
| parent | 954785f83e466d56450af76db8a1f2e72a09ddaa (diff) | |
Fix bug with hiding installed downloads
| -rw-r--r-- | src/downloadmanager.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
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<DownloadInfo*>::iterator iter = m_ActiveDownloads.begin(); iter != m_ActiveDownloads.end();) {
- if ((*iter)->m_State >= minState) {
+ for (QVector<DownloadInfo*>::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;
}
|
