Changeset View
Changeset View
Standalone View
Standalone View
host/downloadplugin.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | 46 | { | |||
---|---|---|---|---|---|
48 | 48 | | |||
49 | const int id = download.value(QStringLiteral("id")).toInt(-1); | 49 | const int id = download.value(QStringLiteral("id")).toInt(-1); | ||
50 | if (id < 0) { | 50 | if (id < 0) { | ||
51 | qWarning() << "Cannot update download with invalid id" << id; | 51 | qWarning() << "Cannot update download with invalid id" << id; | ||
52 | return; | 52 | return; | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | if (event == QLatin1String("created")) { | 55 | if (event == QLatin1String("created")) { | ||
56 | auto *job = new DownloadJob(id); | 56 | // If we get a created event for an already existing job, update it instead | ||
57 | auto *job = m_jobs.value(id); | ||||
58 | if (job) { | ||||
59 | job->update(download); | ||||
60 | return; | ||||
61 | } | ||||
62 | | ||||
63 | job = new DownloadJob(id); | ||||
57 | 64 | | |||
58 | // first register and then update, otherwise we miss the initial population.. | 65 | // first register and then update, otherwise we miss the initial population.. | ||
59 | KIO::getJobTracker()->registerJob(job); | 66 | KIO::getJobTracker()->registerJob(job); | ||
60 | 67 | | |||
61 | job->update(download); | 68 | job->update(download); | ||
62 | 69 | | |||
63 | m_jobs.insert(id, job); | 70 | m_jobs.insert(id, job); | ||
64 | 71 | | |||
Show All 38 Lines |