mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
751a466083
commit
daee15776c
@ -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);
|
item = itemsForDownload.at(i);
|
||||||
// call the download
|
// 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 << "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 ;
|
||||||
|
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=" ;
|
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)
|
for(std::list<std::string>::const_iterator it(srcIds.begin());it!=srcIds.end();++it)
|
||||||
std::cout << *it << "-" << std::endl ;
|
std::cout << *it << "-" << std::endl ;
|
||||||
} else {
|
}
|
||||||
// we have a folder
|
}
|
||||||
|
else // we have a folder
|
||||||
downloadDirectory(item, tr(""));
|
downloadDirectory(item, tr(""));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user