diff --git a/host/downloadjob.cpp b/host/downloadjob.cpp --- a/host/downloadjob.cpp +++ b/host/downloadjob.cpp @@ -146,17 +146,10 @@ emitSpeed(speed); } - // TODO use the estimatedEndTime to calculate transfer speed - - it = payload.constFind(QStringLiteral("state")); - if (it != end) { - const QString status = it->toString(); - if (status == QLatin1String("in_progress")) { - - } else if (status == QLatin1String("interrupted")) { - - const QString &error = payload.value(QStringLiteral("error")).toString(); - + it = payload.constFind(QStringLiteral("error")); + if (it != payload.constEnd()) { + const QString error = it->toString(); + if (!error.isEmpty()) { if (error == QLatin1String("USER_CANCELED") || error == QLatin1String("USER_SHUTDOWN")) { setError(KIO::ERR_USER_CANCELED); // will keep Notification applet from showing a "finished"/error message @@ -207,9 +200,17 @@ setErrorText(errorValue); emitResult(); - return; - } else if (status == QLatin1String("complete")) { + } + } + + it = payload.constFind(QStringLiteral("state")); + if (it != end) { + const QString state = it->toString(); + + // We ignore "interrupted" state and only cancel if we get supplied an "error" + if (state == QLatin1String("complete")) { + setError(KJob::NoError); emitResult(); return; }