mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 22:40:36 -04:00
Merge pull request #2618 from csoler/v0.6-BugFixing_19
fixed copy RS link in search dialog when clicking on a file with multiple names
This commit is contained in:
commit
83b7c21f5f
1 changed files with 28 additions and 21 deletions
|
@ -1455,32 +1455,39 @@ void SearchDialog::copyResultLink()
|
||||||
{
|
{
|
||||||
/* should also be able to handle multi-selection */
|
/* should also be able to handle multi-selection */
|
||||||
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
|
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
|
||||||
int numdls = itemsForCopy.size();
|
|
||||||
QTreeWidgetItem * item;
|
QTreeWidgetItem * item;
|
||||||
|
|
||||||
QList<RetroShareLink> urls ;
|
std::map<RsFileHash,RetroShareLink> url_map;
|
||||||
|
|
||||||
for (int i = 0; i < numdls; ++i)
|
for (auto item:itemsForCopy)
|
||||||
{
|
{
|
||||||
item = itemsForCopy.at(i);
|
|
||||||
// call copy
|
// call copy
|
||||||
|
|
||||||
if (!item->childCount())
|
QString fhash = item->text(SR_HASH_COL);
|
||||||
|
RsFileHash hash(fhash.toStdString());
|
||||||
|
|
||||||
|
if(!hash.isNull())
|
||||||
{
|
{
|
||||||
std::cerr << "SearchDialog::copyResultLink() Calling set retroshare link";
|
std::cerr << "SearchDialog::copyResultLink() Calling set retroshare link";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
QString fhash = item->text(SR_HASH_COL);
|
|
||||||
qulonglong fsize = item->text(SR_SIZE_COL).toULongLong();
|
qulonglong fsize = item->text(SR_SIZE_COL).toULongLong();
|
||||||
QString fname = item->text(SR_NAME_COL);
|
QString fname = item->text(SR_NAME_COL);
|
||||||
|
|
||||||
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
|
RetroShareLink link = RetroShareLink::createFile(fname, fsize, fhash);
|
||||||
if (link.valid()) {
|
|
||||||
std::cerr << "new link added to clipboard: " << link.toString().toStdString() << std::endl ;
|
if (link.valid())
|
||||||
urls.push_back(link) ;
|
url_map[hash] = link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QList<RetroShareLink> urls ;
|
||||||
|
|
||||||
|
for(auto link:url_map)
|
||||||
|
{
|
||||||
|
std::cerr << "new link added to clipboard: " << link.second.toString().toStdString() << std::endl ;
|
||||||
|
urls.push_back(link.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSLinkClipboard::copyLinks(urls) ;
|
RSLinkClipboard::copyLinks(urls) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue