aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-12-12 19:49:09 +0300
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-12-12 19:49:09 +0300
commit7641518deea3591c6903cb5b1b6c7b551c30281b (patch)
tree45396e10a6c619a4f910e6fc6e414f36d45bbbcc /lib/room.cpp
parentf6505a541fc0a2e02f9c79496488121a3e46fb01 (diff)
downloadlibquotient-7641518deea3591c6903cb5b1b6c7b551c30281b.tar.gz
libquotient-7641518deea3591c6903cb5b1b6c7b551c30281b.zip
Room::downloadFile: minor cleanup
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index eefccdb5..69ebd677 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1902,9 +1902,8 @@ void Room::downloadFile(const QString& eventId, const QUrl& localFilename)
}
auto job = connection()->downloadFile(fileUrl, filePath);
if (isJobRunning(job)) {
- // If there was a previous transfer (completed or failed), remove it.
- d->fileTransfers.remove(eventId);
- d->fileTransfers.insert(eventId, { job, job->targetFileName() });
+ // If there was a previous transfer (completed or failed), overwrite it.
+ d->fileTransfers[eventId] = { job, job->targetFileName() };
connect(job, &BaseJob::downloadProgress, this,
[this, eventId](qint64 received, qint64 total) {
d->fileTransfers[eventId].update(received, total);