diff --git a/retroshare-gui/src/gui/SearchDialog.cpp b/retroshare-gui/src/gui/SearchDialog.cpp index 579957a9d..b5945b15a 100644 --- a/retroshare-gui/src/gui/SearchDialog.cpp +++ b/retroshare-gui/src/gui/SearchDialog.cpp @@ -62,6 +62,9 @@ #define SS_TEXT_COL 0 #define SS_COUNT_COL 1 #define SS_SEARCH_ID_COL 2 +#define SS_DATA_COL SS_TEXT_COL + +#define ROLE_ADVANCED Qt::UserRole #define IMAGE_COPYLINK ":/images/copyrslink.png" @@ -428,10 +431,18 @@ void SearchDialog::searchtableWidget2CostumPopupMenu( QPoint /*point*/ ) QMenu contextMnu(this); + QTreeWidgetItem* ci = ui.searchSummaryWidget->currentItem(); + QAction* action = contextMnu.addAction(tr("Search again"), this, SLOT(searchAgain())); + if (!ci || ci->data(SS_DATA_COL, ROLE_ADVANCED).toBool()) { + action->setDisabled(true); + } contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove"), this, SLOT(searchRemove())); contextMnu.addAction(QIcon(IMAGE_REMOVE), tr("Remove All"), this, SLOT(searchRemoveAll())); contextMnu.addSeparator(); - contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copySearchLink())); + action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copySearchLink())); + if (!ci || ci->data(SS_DATA_COL, ROLE_ADVANCED).toBool()) { + action->setDisabled(true); + } contextMnu.exec(QCursor::pos()); } @@ -554,7 +565,7 @@ void SearchDialog::showAdvSearchDialog(bool show) // Creates a new entry in the search summary, not to leave it blank whatever happens. // -void SearchDialog::initSearchResult(const std::string& txt,qulonglong searchId) +void SearchDialog::initSearchResult(const std::string& txt,qulonglong searchId, bool advanced) { QString sid_hexa = QString::number(searchId,16) ; @@ -563,6 +574,8 @@ void SearchDialog::initSearchResult(const std::string& txt,qulonglong searchId) item2->setText(SS_COUNT_COL, QString::number(0)); item2->setText(SS_SEARCH_ID_COL, sid_hexa); + item2->setData(SS_DATA_COL, ROLE_ADVANCED, advanced); + ui.searchSummaryWidget->addTopLevelItem(item2); ui.searchSummaryWidget->setCurrentItem(item2); } @@ -582,7 +595,7 @@ void SearchDialog::advancedSearch(Expression* expression) // This will act before turtle results come to the interface, thanks to the signals scheduling policy. // The text "bool exp" should be replaced by an appropriate text describing the actual search. - initSearchResult(std::string("bool exp"),req_id) ; + initSearchResult(std::string("bool exp"),req_id, true) ; rsFiles -> SearchBoolExp(expression, results, DIR_FLAGS_REMOTE | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE); @@ -601,6 +614,19 @@ void SearchDialog::searchKeywords() searchKeywords(ui.lineEdit->text()); } +void SearchDialog::searchAgain() +{ + /* get the current search text from the summary window */ + QTreeWidgetItem* ci = ui.searchSummaryWidget->currentItem(); + if (!ci || ci->data(SS_DATA_COL, ROLE_ADVANCED).toBool()) + return; + + /* get the search text */ + QString txt = ci->text(SS_TEXT_COL); + searchRemove(); + searchKeywords(txt); +} + void SearchDialog::searchKeywords(const QString& keywords) { std::string txt = keywords.toUtf8().constData(); @@ -637,7 +663,7 @@ void SearchDialog::searchKeywords(const QString& keywords) else req_id = ((((uint32_t)rand()) << 16)^0x1e2fd5e4) + (((uint32_t)rand())^0x1b19acfe) ; // generate a random 32 bits request id - initSearchResult(txt,req_id) ; // this will act before turtle results come to the interface, thanks to the signals scheduling policy. + initSearchResult(txt,req_id, false) ; // this will act before turtle results come to the interface, thanks to the signals scheduling policy. if(ui._friendListsearch_SB->isChecked() || ui._ownFiles_CB->isChecked()) { diff --git a/retroshare-gui/src/gui/SearchDialog.h b/retroshare-gui/src/gui/SearchDialog.h index 6e42acb0b..8daa984c7 100644 --- a/retroshare-gui/src/gui/SearchDialog.h +++ b/retroshare-gui/src/gui/SearchDialog.h @@ -64,6 +64,7 @@ private slots: void copyResultLink(); void copySearchLink(); + void searchAgain(); void searchRemove(); void searchRemoveAll(); void searchKeywords(); @@ -96,7 +97,7 @@ private slots: private: /** render the results to the tree widget display */ - void initSearchResult(const std::string& txt,qulonglong searchId) ; + void initSearchResult(const std::string& txt,qulonglong searchId, bool advanced) ; void resultsToTree(std::string,qulonglong searchId, const std::list&); void insertFile(const std::string& txt,qulonglong searchId, const FileDetail& file, int searchType = ANONYMOUS_SEARCH) ; void insertDirectory(const std::string &txt, qulonglong searchId, const DirDetails &dir, QTreeWidgetItem *item); diff --git a/retroshare-gui/src/lang/retroshare_de.qm b/retroshare-gui/src/lang/retroshare_de.qm index fe2c2fb48..75d554c8c 100644 Binary files a/retroshare-gui/src/lang/retroshare_de.qm and b/retroshare-gui/src/lang/retroshare_de.qm differ diff --git a/retroshare-gui/src/lang/retroshare_de.ts b/retroshare-gui/src/lang/retroshare_de.ts index fc0589bbe..5508d8078 100644 --- a/retroshare-gui/src/lang/retroshare_de.ts +++ b/retroshare-gui/src/lang/retroshare_de.ts @@ -9829,7 +9829,7 @@ Lockdatei: Der Empfänger der Nachricht ist unbekannt. - + Add file Datei hinzufügen @@ -10590,17 +10590,17 @@ p, li { white-space: pre-wrap; } RsCollectionFile - + Cannot open file %1 Kann Datei %1 nicht öffnen - + Error parsing xml file Fehler beim Parsen des XML - + Open collection file Öffne Kollektion @@ -10749,7 +10749,7 @@ p, li { white-space: pre-wrap; } - + Download Herunterladen @@ -10760,17 +10760,22 @@ p, li { white-space: pre-wrap; } - + Copy RetroShare Link Kopiere RetroShare Link - + Send RetroShare Link Sende RetroShare Link - + + Search again + Erneut suchen + + + Remove Entfernen @@ -10780,7 +10785,7 @@ p, li { white-space: pre-wrap; } Alle entfernen - + Folder Ordner @@ -10841,7 +10846,7 @@ p, li { white-space: pre-wrap; } Such ID - + Download Notice Download @@ -12707,12 +12712,12 @@ p, li { white-space: pre-wrap; } Du kannst diesen Text kopieren und an deinen Freund per Email senden oder über einen anderen Weg zukommen lassen - + RetroShare - + Text certificate Text-Zertifikat @@ -12737,12 +12742,12 @@ p, li { white-space: pre-wrap; } Das Zertifikat konnte nicht geladen werden - + Your Cert is copied to Clipboard, paste and send it to your friend via email or some other way Dein Zertiifkat ist in in die Zwischenablage kopiert worden - + RetroShare Invite RetroShare Einladung