+ return;
+ }
+
+ // Handle download success
+ QByteArray data = downloadReply->readAll();
+ quint64 size = (quint64)data.size();
+ qDebug() << "Got" << size << "bytes";
+ downloadReply->deleteLater();
+ downloadReply = 0;
+ QFile out(downloadFileName);
+ int status = Search::FileError;
+ if (out.open(QIODevice::WriteOnly)) {
+ if (size == out.write(data, size)) {
+ qDebug() << "Book saved to" << downloadFileName;
+ status = Search::Ok;
+ } else {
+ qCritical() << "Search::downloadFinished: Failed to write" << size
+ << "bytes to" << downloadFileName;
+ }
+ out.close();