mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Merge pull request #2029 from csoler/v0.6-BugFixing
added missing cleaning of distant search results in GUI
This commit is contained in:
commit
d10854f1b5
@ -397,6 +397,19 @@ bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestResultItem(QTreeWidgetItem *item,QString& group_id,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
if(parent == NULL)
|
||||
return false ;
|
||||
|
||||
search_req_id = parent->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt();
|
||||
group_id = itemId(item) ;
|
||||
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
|
@ -97,6 +97,7 @@ public:
|
||||
|
||||
bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id);
|
||||
bool isSearchRequestResult(QPoint &point, QString &group_id, uint32_t& search_req_id);
|
||||
bool isSearchRequestResultItem(QTreeWidgetItem *item,QString& group_id,uint32_t& search_req_id);
|
||||
|
||||
QTreeWidgetItem *getItemFromId(const QString &id);
|
||||
QTreeWidgetItem *activateId(const QString &id, bool focus);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/gxs/GxsGroupShareKey.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
#include "gui/common/RSTreeWidget.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
@ -359,13 +360,22 @@ 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) ;
|
||||
{
|
||||
QString group_id;
|
||||
TurtleRequestId search_request_id;
|
||||
|
||||
if(ui->groupTreeWidget->isSearchRequestResultItem(it->second,group_id,search_request_id))
|
||||
clearDistantSearchResults(search_request_id);
|
||||
|
||||
ui->groupTreeWidget->removeSearchItem(it->second) ;
|
||||
}
|
||||
mSearchGroupsItems.clear();
|
||||
mKnownGroups.clear();
|
||||
}
|
||||
|
@ -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<RsGxsGroupId,RsGxsGroupSearchResults>& /* group_infos */){ return false ;}
|
||||
virtual void clearDistantSearchResults(TurtleRequestId /* id */) {}
|
||||
virtual RsGxsGenericGroupData *getDistantSearchResultGroupData(const RsGxsGroupId& group_id){ return nullptr ;}
|
||||
|
||||
void initUi();
|
||||
|
@ -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()) ;
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user