From ea99f44893a25bc4641612736bfec2ab3e0dd933 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 12 May 2010 18:34:16 +0000 Subject: [PATCH] Fix wrong warning in torrent addition dialog (closes #579301) --- src/downloadthread.cpp | 8 ++++++-- src/torrentfilesmodel.h | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/downloadthread.cpp b/src/downloadthread.cpp index 27a9c9530..1e70c6c65 100644 --- a/src/downloadthread.cpp +++ b/src/downloadthread.cpp @@ -57,6 +57,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) { QString url = reply->url().toString(); if(reply->error() != QNetworkReply::NoError) { // Failure + qDebug("Download failure (%s), reason: %s", qPrintable(url), qPrintable(errorCodeToString(reply->error()))); emit downloadFailure(url, errorCodeToString(reply->error())); } else { QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); @@ -80,7 +81,9 @@ void downloadThread::processDlFinished(QNetworkReply* reply) { qDebug("Temporary filename is: %s", qPrintable(filePath)); if(reply->open(QIODevice::ReadOnly)) { // TODO: Support GZIP compression - tmpfile.write(reply->readAll()); + QByteArray content = reply->readAll(); + //qDebug("Read content: %s", content.data()); + tmpfile.write(content); reply->close(); tmpfile.close(); // Send finished signal @@ -112,7 +115,8 @@ QNetworkReply* downloadThread::downloadUrl(QString url){ // Spoof Firefox 3.5 user agent to avoid // Web server banning request.setRawHeader("User-Agent", "Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5"); - qDebug("Downloading %s...", qPrintable(request.url().toString())); + qDebug("Downloading %s...", request.url().toEncoded().data()); + qDebug("Header: %s", qPrintable(request.header(QNetworkRequest::LocationHeader).toString())); return networkManager->get(request); } diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index af535fbbf..47fb88b50 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -347,8 +347,11 @@ public: } bool allFiltered() const { - if(!rootItem->childCount()) return true; - return (rootItem->child(0)->getPriority() == IGNORED); + for(int i=0; ichildCount(); ++i) { + if(rootItem->child(i)->getPriority() != IGNORED) + return false; + } + return true; } int columnCount(const QModelIndex &parent=QModelIndex()) const {