mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 05:22:31 -04:00
made retrieval of group data manual instead of automatic
This commit is contained in:
parent
59c51a250b
commit
0e37de3e11
6 changed files with 56 additions and 10 deletions
|
@ -430,6 +430,23 @@ QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, ui
|
|||
return item;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if (item == NULL)
|
||||
return false;
|
||||
|
||||
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);
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
void setUnreadCount(QTreeWidgetItem *item, int unreadCount);
|
||||
|
||||
bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id);
|
||||
bool isSearchRequestResult(QPoint &point, QString &group_id, uint32_t& search_req_id);
|
||||
|
||||
QTreeWidgetItem *getItemFromId(const QString &id);
|
||||
QTreeWidgetItem *activateId(const QString &id, bool focus);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#define IMAGE_SHARE ":/images/share-icon-16.png"
|
||||
#define IMAGE_TABNEW ":/images/tab-new.png"
|
||||
#define IMAGE_DELETE ":/images/delete.png"
|
||||
#define IMAGE_RETRIEVE ":/images/edit_add24.png"
|
||||
#define IMAGE_COMMENT ""
|
||||
|
||||
#define TOKEN_TYPE_GROUP_SUMMARY 1
|
||||
|
@ -345,6 +346,19 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
|
|||
return ;
|
||||
}
|
||||
|
||||
// Then check whether we have a searched item, or a normal group
|
||||
|
||||
QString group_id_s ;
|
||||
|
||||
if(ui->groupTreeWidget->isSearchRequestResult(point,group_id_s,search_request_id))
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_RETRIEVE), tr("Request data"), this, SLOT(distantRequestGroupData()))->setData(group_id_s);
|
||||
contextMnu.exec(QCursor::pos());
|
||||
return ;
|
||||
}
|
||||
|
||||
QString id = ui->groupTreeWidget->itemIdAt(point);
|
||||
if (id.isEmpty()) return;
|
||||
|
||||
|
@ -763,11 +777,6 @@ void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId)
|
|||
return;
|
||||
}
|
||||
|
||||
// send a request for the group, if it has been distant-searched.
|
||||
|
||||
if(mCachedGroupMetas.find(mGroupId) == mCachedGroupMetas.end())
|
||||
checkRequestGroup(mGroupId) ;
|
||||
|
||||
/* search exisiting tab */
|
||||
GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, true);
|
||||
|
||||
|
@ -1198,3 +1207,21 @@ void GxsGroupFrameDialog::searchNetwork(const QString& search_string)
|
|||
mSearchGroupsItems[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH)));
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::distantRequestGroupData()
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(sender()) ;
|
||||
|
||||
if(!action)
|
||||
return ;
|
||||
|
||||
RsGxsGroupId group_id(action->data().toString().toStdString());
|
||||
|
||||
if(group_id.isNull())
|
||||
{
|
||||
std::cerr << "Cannot retrieve group! Group id is null!" << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << "Explicit request for group " << group_id << std::endl;
|
||||
checkRequestGroup(group_id) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ private slots:
|
|||
|
||||
void restoreGroupKeys();
|
||||
void newGroup();
|
||||
void distantRequestGroupData();
|
||||
|
||||
void changedCurrentGroup(const QString &groupId);
|
||||
void groupTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue