X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplugins%2Fsearchplugin%2FDownloadManager.cpp;h=a16d457e2bf53900db5d503c2ab88804bb490dbe;hb=a25be1792ef730256ea47908df24b1bbbded553d;hp=01e2cb48e9547db3d47e688ccc29cccce9b7906b;hpb=5032546701da06d7307fc543d74be93e5319c350;p=qtrapids diff --git a/src/plugins/searchplugin/DownloadManager.cpp b/src/plugins/searchplugin/DownloadManager.cpp index 01e2cb4..a16d457 100644 --- a/src/plugins/searchplugin/DownloadManager.cpp +++ b/src/plugins/searchplugin/DownloadManager.cpp @@ -58,7 +58,10 @@ void DownloadManager::start() void DownloadManager::on_readyRead() { //qDebug() << "on_readyRead()"; - WriteToFile(); + if(!WriteToFile()) { + qWarning() << "DownloadManager::on_readyRead(): Writing to file: " + << filepath_ << " failed."; + } } void DownloadManager::on_downloadProgress(qint64 bytesReceived, qint64 bytesTotal) @@ -83,14 +86,18 @@ void DownloadManager::on_replyFinished() } -void DownloadManager::WriteToFile() +bool DownloadManager::WriteToFile() { QByteArray readData = reply_->readAll(); if (readData.isEmpty()) { qDebug() << "on_replyFinished(): No data available for reading"; } else { - file_.write(readData); - /// @todo check file_.error() + // If writing failed, see error message. + if (file_.write(readData) == -1) { + qWarning() << file_.error(); + return false; + } } + return true; }