diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-26 09:00:33 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-01-26 09:00:33 +0900 |
commit | 76bff84a2aa63db677044cc529b910768fa018fa (patch) | |
tree | efeb34e37b436267313169a1790e45a07e8f7fcb /jobs | |
parent | 7d506f7bebbcc3b5f8a37589f8fda6fa1e7e1efd (diff) | |
parent | 2f83e4be20a15013181c1ba6944e21f051ccac9d (diff) | |
download | libquotient-76bff84a2aa63db677044cc529b910768fa018fa.tar.gz libquotient-76bff84a2aa63db677044cc529b910768fa018fa.zip |
Merge branch 'master' into kitsune-gtad
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/basejob.cpp | 7 | ||||
-rw-r--r-- | jobs/downloadfilejob.cpp | 5 |
2 files changed, 7 insertions, 5 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 7fc56287..22ce5bd5 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -290,9 +290,10 @@ bool checkContentType(const QByteArray& type, const QByteArrayList& patterns) BaseJob::Status BaseJob::checkReply(QNetworkReply* reply) const { - qCDebug(d->logCat) << this << "returned from" << reply->url().toDisplayString(); - if (reply->error() != QNetworkReply::NoError) - qCDebug(d->logCat) << this << "returned" << reply->error(); + qCDebug(d->logCat) << this << "returned" + << (reply->error() == QNetworkReply::NoError ? + "Success" : reply->errorString()) + << "from" << reply->url().toDisplayString(); switch( reply->error() ) { case QNetworkReply::NoError: diff --git a/jobs/downloadfilejob.cpp b/jobs/downloadfilejob.cpp index 2530e259..06fa3b48 100644 --- a/jobs/downloadfilejob.cpp +++ b/jobs/downloadfilejob.cpp @@ -36,14 +36,15 @@ QString DownloadFileJob::targetFileName() const void DownloadFileJob::beforeStart(const ConnectionData*) { - if (d->targetFile && !d->targetFile->open(QIODevice::WriteOnly)) + if (d->targetFile && !d->targetFile->isReadable() && + !d->targetFile->open(QIODevice::WriteOnly)) { qCWarning(JOBS) << "Couldn't open the file" << d->targetFile->fileName() << "for writing"; setStatus(FileError, "Could not open the target file for writing"); return; } - if (!d->tempFile->open(QIODevice::WriteOnly)) + if (!d->tempFile->isReadable() && !d->tempFile->open(QIODevice::WriteOnly)) { qCWarning(JOBS) << "Couldn't open the temporary file" << d->tempFile->fileName() << "for writing"; |