From 38725628b0e28b022c92c4461188864f5fae0a6e Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 23 Jan 2023 20:23:18 +0100 Subject: [PATCH] fixed advanced search not using browsable/distant/own files --- .../src/gui/FileTransfer/SearchDialog.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp index c421e67e0..94e4229cc 100644 --- a/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp +++ b/retroshare-gui/src/gui/FileTransfer/SearchDialog.cpp @@ -805,28 +805,29 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression) { advSearchDialog->hide(); - /* call to core */ - std::list results; - // send a turtle search request RsRegularExpression::LinearizedExpression e ; expression->linearize(e) ; - TurtleRequestId req_id = rsFiles->turtleSearch(e) ; + TurtleRequestId req_id ; - // This will act before turtle results come to the interface, thanks to the signals scheduling policy. - initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ; + if(ui._anonF2Fsearch_CB->isChecked()) + req_id = rsFiles->turtleSearch(e) ; + else + req_id = RSRandom::random_u32() ; // generate a random 32 bits request id - rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE); + initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ; + + std::list results; + + FileSearchFlags flags(0); + if(ui._ownFiles_CB->isChecked()) flags |= RS_FILE_HINTS_LOCAL; + if(ui._friendListsearch_SB->isChecked()) flags |= RS_FILE_HINTS_REMOTE; + + rsFiles -> SearchBoolExp(expression, results, flags); /* abstraction to allow reusee of tree rendering code */ - resultsToTree(advSearchDialog->getSearchAsString(),req_id, results); - -// // debug stuff -// Expression *expression2 = LinearizedExpression::toExpr(e) ; -// results.clear() ; -// rsFiles -> SearchBoolExp(expression2, results, DIR_FLAGS_REMOTE | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE); -// resultsToTree((advSearchDialog->getSearchAsString()).toStdString(),req_id+1, results); + resultsToTree(advSearchDialog->getSearchAsString(),req_id, results); } void SearchDialog::searchKeywords() @@ -1455,7 +1456,6 @@ void SearchDialog::copyResultLink() { /* should also be able to handle multi-selection */ QList itemsForCopy = ui.searchResultWidget->selectedItems(); - QTreeWidgetItem * item; std::set already_seen_hashes; QList urls ;