Browse Source

Fix wrong warning in torrent addition dialog (closes #579301)

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
ea99f44893
  1. 8
      src/downloadthread.cpp
  2. 7
      src/torrentfilesmodel.h

8
src/downloadthread.cpp

@ -57,6 +57,7 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
QString url = reply->url().toString(); QString url = reply->url().toString();
if(reply->error() != QNetworkReply::NoError) { if(reply->error() != QNetworkReply::NoError) {
// Failure // Failure
qDebug("Download failure (%s), reason: %s", qPrintable(url), qPrintable(errorCodeToString(reply->error())));
emit downloadFailure(url, errorCodeToString(reply->error())); emit downloadFailure(url, errorCodeToString(reply->error()));
} else { } else {
QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
@ -80,7 +81,9 @@ void downloadThread::processDlFinished(QNetworkReply* reply) {
qDebug("Temporary filename is: %s", qPrintable(filePath)); qDebug("Temporary filename is: %s", qPrintable(filePath));
if(reply->open(QIODevice::ReadOnly)) { if(reply->open(QIODevice::ReadOnly)) {
// TODO: Support GZIP compression // TODO: Support GZIP compression
tmpfile.write(reply->readAll()); QByteArray content = reply->readAll();
//qDebug("Read content: %s", content.data());
tmpfile.write(content);
reply->close(); reply->close();
tmpfile.close(); tmpfile.close();
// Send finished signal // Send finished signal
@ -112,7 +115,8 @@ QNetworkReply* downloadThread::downloadUrl(QString url){
// Spoof Firefox 3.5 user agent to avoid // Spoof Firefox 3.5 user agent to avoid
// Web server banning // 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"); 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); return networkManager->get(request);
} }

7
src/torrentfilesmodel.h

@ -347,8 +347,11 @@ public:
} }
bool allFiltered() const { bool allFiltered() const {
if(!rootItem->childCount()) return true; for(int i=0; i<rootItem->childCount(); ++i) {
return (rootItem->child(0)->getPriority() == IGNORED); if(rootItem->child(i)->getPriority() != IGNORED)
return false;
}
return true;
} }
int columnCount(const QModelIndex &parent=QModelIndex()) const { int columnCount(const QModelIndex &parent=QModelIndex()) const {

Loading…
Cancel
Save