added guard against downloading local files

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2105 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-01-21 12:39:26 +00:00
parent 751a466083
commit daee15776c

View File

@ -238,39 +238,34 @@ void SearchDialog::download()
QTreeWidgetItem * item; QTreeWidgetItem * item;
bool attemptDownloadLocal = false; bool attemptDownloadLocal = false;
for (int i = 0; i < numdls; ++i) { for (int i = 0; i < numdls; ++i)
item = itemsForDownload.at(i); {
// call the download item = itemsForDownload.at(i);
if (item->text(SR_ID_COL) != "Local") // call the download
{ if (!item->childCount())
if (!item->childCount()) { {
std::cerr << "SearchDialog::download() Calling File Request"; std::cerr << "SearchDialog::download() Calling File Request";
std::cerr << std::endl; std::cerr << std::endl;
std::list<std::string> srcIds; std::list<std::string> srcIds;
srcIds.push_back(item->text(SR_UID_COL).toStdString()) ; srcIds.push_back(item->text(SR_UID_COL).toStdString()) ;
rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(), if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toStdString(),
(item->text(SR_HASH_COL)).toStdString(), (item->text(SR_HASH_COL)).toStdString(),
(item->text(SR_REALSIZE_COL)).toInt(), (item->text(SR_REALSIZE_COL)).toInt(),
"", RS_FILE_HINTS_NETWORK_WIDE, srcIds); "", RS_FILE_HINTS_NETWORK_WIDE, srcIds))
attemptDownloadLocal = true ;
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=" ; else
for(std::list<std::string>::const_iterator it(srcIds.begin());it!=srcIds.end();++it) {
std::cout << *it << "-" << std::endl ; 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=" ;
} else { for(std::list<std::string>::const_iterator it(srcIds.begin());it!=srcIds.end();++it)
// we have a folder std::cout << *it << "-" << std::endl ;
downloadDirectory(item, tr("")); }
} }
} else // we have a folder
else downloadDirectory(item, tr(""));
{ }
attemptDownloadLocal = true;
}
}
if (attemptDownloadLocal) if (attemptDownloadLocal)
{
QMessageBox::information(0, tr("Download Notice"), tr("Skipping Local Files")); QMessageBox::information(0, tr("Download Notice"), tr("Skipping Local Files"));
}
} }
void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base) void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString &base)