From daee15776cdcc4e4eeb954f165adef4a6721315b Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 21 Jan 2010 12:39:26 +0000 Subject: [PATCH] added guard against downloading local files git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2105 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/SearchDialog.cpp | 55 +++++++++++-------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index c6f1debe9..4ea5a7c68 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -238,39 +238,34 @@ void SearchDialog::download() QTreeWidgetItem * item; bool attemptDownloadLocal = false; - for (int i = 0; i < numdls; ++i) { - item = itemsForDownload.at(i); - // call the download - if (item->text(SR_ID_COL) != "Local") - { - if (!item->childCount()) { - std::cerr << "SearchDialog::download() Calling File Request"; - std::cerr << std::endl; - std::list srcIds; - srcIds.push_back(item->text(SR_UID_COL).toStdString()) ; + for (int i = 0; i < numdls; ++i) + { + item = itemsForDownload.at(i); + // call the download + if (!item->childCount()) + { + std::cerr << "SearchDialog::download() Calling File Request"; + std::cerr << std::endl; + std::list srcIds; + srcIds.push_back(item->text(SR_UID_COL).toStdString()) ; - rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), - (item->text(SR_HASH_COL)).toStdString(), - (item->text(SR_REALSIZE_COL)).toInt(), - "", RS_FILE_HINTS_NETWORK_WIDE, srcIds); - - std::cout << "isuing file request from search dialog: -" << (item->text(SR_NAME_COL)).toStdString() << "-" << (item->text(SR_HASH_COL)).toStdString() << "-" << (item->text(SR_REALSIZE_COL)).toInt() << "-ids=" ; - for(std::list::const_iterator it(srcIds.begin());it!=srcIds.end();++it) - std::cout << *it << "-" << std::endl ; - } else { - // we have a folder - downloadDirectory(item, tr("")); - } - } - else - { - attemptDownloadLocal = true; - } - } + if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), + (item->text(SR_HASH_COL)).toStdString(), + (item->text(SR_REALSIZE_COL)).toInt(), + "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) + attemptDownloadLocal = true ; + else + { + std::cout << "isuing file request from search dialog: -" << (item->text(SR_NAME_COL)).toStdString() << "-" << (item->text(SR_HASH_COL)).toStdString() << "-" << (item->text(SR_REALSIZE_COL)).toInt() << "-ids=" ; + for(std::list::const_iterator it(srcIds.begin());it!=srcIds.end();++it) + std::cout << *it << "-" << std::endl ; + } + } + else // we have a folder + downloadDirectory(item, tr("")); + } if (attemptDownloadLocal) - { QMessageBox::information(0, tr("Download Notice"), tr("Skipping Local Files")); - } } void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base)