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