From ecee1e645cc86e0ab8102b6b44f1b9321e1b5b96 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Fri, 15 Sep 2017 17:09:34 +0300 Subject: [PATCH 1/2] allow multiple filenames display for a single hash in search --- .../src/gui/FileTransfer/SearchDialog.cpp | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index 4607a2541..aa1ea27f2 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -1166,6 +1166,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s // 1 - look in result window whether the file already exists. // bool found = false ; + bool altname = false ; int sources; int friendSource = 0; int anonymousSource = 0; @@ -1193,7 +1194,11 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s (*it)->setText(SR_SOURCES_COL,modifiedResult); (*it)->setData(SR_SOURCES_COL, ROLE_SORT, fltRes); QTreeWidgetItem *item = (*it); + found = true ; + + if(QString::compare((*it)->text(SR_NAME_COL), QString::fromUtf8(file.name.c_str()), Qt::CaseInsensitive)!=0) + altname = true; if (!item->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) { @@ -1233,9 +1238,20 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s item->setForeground(i, brush); } } - break ; - } + if(altname) + { + QTreeWidgetItem *item = new RSTreeWidgetItem(compareResultRole); + item->setText(SR_NAME_COL, QString::fromUtf8(file.name.c_str())); + item->setText(SR_HASH_COL, QString::fromStdString(file.hash.toStdString())); + setIconAndType(item, QString::fromUtf8(file.name.c_str())); + item->setText(SR_SIZE_COL, QString::number(file.size)); + setIconAndType(item, QString::fromUtf8(file.name.c_str())); + (*it)->addChild(item); + } + + } + if(!found) { ++nb_results[searchId] ; From 7144b72c31463490eedd8725e9ce378c5aa4bd09 Mon Sep 17 00:00:00 2001 From: Pooh Date: Fri, 15 Sep 2017 17:27:44 +0300 Subject: [PATCH 2/2] Update SearchDialog.cpp --- retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index aa1ea27f2..389564d05 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -1197,7 +1197,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s found = true ; - if(QString::compare((*it)->text(SR_NAME_COL), QString::fromUtf8(file.name.c_str()), Qt::CaseInsensitive)!=0) + if(QString::compare((*it)->text(SR_NAME_COL), QString::fromUtf8(file.name.c_str()), Qt::CaseSensitive)!=0) altname = true; if (!item->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) {