From 4d872d5778d8db4670ee0da75ebc14bec414e657 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 3 Jul 2020 22:48:33 +0200 Subject: [PATCH] added missing cleaning of distant search results in GUI --- retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp | 10 +++++++++- retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h | 1 + .../src/gui/gxschannels/GxsChannelDialog.cpp | 5 +++++ retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 49b91866d..069b682ce 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -359,13 +359,21 @@ void GxsGroupFrameDialog::removeCurrentSearch() mSearchGroupsItems.erase(it); mKnownGroups.erase(search_request_id); + + clearDistantSearchResults(search_request_id); } void GxsGroupFrameDialog::removeAllSearches() { for(auto it(mSearchGroupsItems.begin());it!=mSearchGroupsItems.end();++it) - ui->groupTreeWidget->removeSearchItem(it->second) ; + { + TurtleRequestId search_request_id = 0 ; + if(ui->groupTreeWidget->isSearchRequestItem(point,search_request_id)) + clearDistantSearchResults(search_request_id); + + ui->groupTreeWidget->removeSearchItem(it->second) ; + } mSearchGroupsItems.clear(); mKnownGroups.clear(); } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h index 05b311b04..006f593a4 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.h @@ -162,6 +162,7 @@ private: virtual RsGxsCommentService *getCommentService() { return NULL; } virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; } virtual bool getDistantSearchResults(TurtleRequestId /* id */, std::map& /* group_infos */){ return false ;} + virtual void clearDistantSearchResults(TurtleRequestId /* id */) {} virtual RsGxsGenericGroupData *getDistantSearchResultGroupData(const RsGxsGroupId& group_id){ return nullptr ;} void initUi(); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 8cbeccfbc..5e1c40fe4 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -396,6 +396,11 @@ void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *gro groupItemInfo.description = QString::fromUtf8(channelGroupData->mDescription.c_str()); } +void GxsChannelDialog::clearDistantSearchResults(TurtleRequestId id) +{ + rsGxsChannels->clearDistantSearchResults(id); +} + TurtleRequestId GxsChannelDialog::distantSearch(const QString& search_string) { return rsGxsChannels->turtleSearchRequest(search_string.toStdString()) ; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h index 7902b7361..63b6ba38a 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h @@ -48,6 +48,7 @@ protected: virtual TurtleRequestId distantSearch(const QString& search_string) override; virtual void checkRequestGroup(const RsGxsGroupId& grpId) override ; + virtual void clearDistantSearchResults(TurtleRequestId id) override; // Implementation of some abstract methods in GxsGroupFrameDialog