mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 02:55:18 -04:00
Circles:
- cleaned source code - added auto refresh - added todo button - fixed utf8 issues - added new strings to translation Updated english translation git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6504 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
621c8037bc
commit
6ac95b28cd
9 changed files with 466 additions and 1083 deletions
|
@ -21,107 +21,111 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "gui/Circles/CirclesDialog.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
|
||||
#include <retroshare/rsgxscircles.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
/******
|
||||
* #define CIRCLE_DEBUG 1
|
||||
*****/
|
||||
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPNAME 0
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPID 1
|
||||
|
||||
#define CIRCLEGROUP_FRIEND_COL_NAME 0
|
||||
#define CIRCLEGROUP_FRIEND_COL_ID 1
|
||||
|
||||
#define CLEAR_BACKGROUND 0
|
||||
#define GREEN_BACKGROUND 1
|
||||
#define BLUE_BACKGROUND 2
|
||||
#define RED_BACKGROUND 3
|
||||
#define GRAY_BACKGROUND 4
|
||||
|
||||
#define CIRCLESDIALOG_GROUPMETA 1
|
||||
|
||||
/** Constructor */
|
||||
CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
: MainPage(parent)
|
||||
: RsGxsUpdateBroadcastPage(rsGxsCircles, parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.pushButton_refresh, SIGNAL(clicked()), this, SLOT(reloadAll()));
|
||||
connect( ui.pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||
connect( ui.pushButton_localCircle, SIGNAL(clicked()), this, SLOT(createPersonalCircle()));
|
||||
connect( ui.pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle()));
|
||||
/* Setup UI helper */
|
||||
mStateHelper = new UIStateHelper(this);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.pushButton_extCircle);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.pushButton_localCircle);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.pushButton_editCircle);
|
||||
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
|
||||
timer->start(1000);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_membership, UISTATE_ACTIVE_ENABLED);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_friends, UISTATE_ACTIVE_ENABLED);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_category, UISTATE_ACTIVE_ENABLED);
|
||||
|
||||
/* setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, false); // not implemented
|
||||
|
||||
connect( ui.treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
connect( ui.treeWidget_friends, SIGNAL(itemSelectionChanged()), this, SLOT(friend_selected()));
|
||||
connect( ui.treeWidget_category, SIGNAL(itemSelectionChanged()), this, SLOT(category_selected()));
|
||||
/* Connect signals */
|
||||
connect(ui.pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||
connect(ui.pushButton_localCircle, SIGNAL(clicked()), this, SLOT(createPersonalCircle()));
|
||||
connect(ui.pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle()));
|
||||
connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));
|
||||
|
||||
connect(ui.treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
connect(ui.treeWidget_friends, SIGNAL(itemSelectionChanged()), this, SLOT(friend_selected()));
|
||||
connect(ui.treeWidget_category, SIGNAL(itemSelectionChanged()), this, SLOT(category_selected()));
|
||||
|
||||
/* Setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::checkUpdate()
|
||||
void CirclesDialog::todo()
|
||||
{
|
||||
|
||||
/* update */
|
||||
if (!rsGxsCircles)
|
||||
return;
|
||||
|
||||
if (rsGxsCircles->updated())
|
||||
{
|
||||
reloadAll();
|
||||
}
|
||||
|
||||
return;
|
||||
QMessageBox::information(this, "Todo",
|
||||
"<b>Open points:</b><ul>"
|
||||
"<li>Improve create dialog"
|
||||
"<li>Edit circles"
|
||||
"<li>Categories"
|
||||
"<li>Don't refill complete trees"
|
||||
"</ul>");
|
||||
}
|
||||
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPNAME 0
|
||||
#define CIRCLEGROUP_CIRCLE_COL_GROUPID 1
|
||||
|
||||
#define CIRCLEGROUP_FRIEND_COL_NAME 0
|
||||
#define CIRCLEGROUP_FRIEND_COL_ID 1
|
||||
void CirclesDialog::updateDisplay(bool /*initialFill*/)
|
||||
{
|
||||
reloadAll();
|
||||
}
|
||||
|
||||
void CirclesDialog::createExternalCircle()
|
||||
{
|
||||
CreateCircleDialog *createDialog = new CreateCircleDialog();
|
||||
createDialog->editNewId(true);
|
||||
createDialog->show();
|
||||
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editNewId(true);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::createPersonalCircle()
|
||||
{
|
||||
CreateCircleDialog *createDialog = new CreateCircleDialog();
|
||||
createDialog->editNewId(false);
|
||||
createDialog->show();
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editNewId(false);
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::editExistingCircle()
|
||||
{
|
||||
#if 0
|
||||
std::string id;
|
||||
CreateCircleDialog *createDialog = new CreateCircleDialog();
|
||||
createDialog->editExistingId(id);
|
||||
createDialog->show();
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editExistingId(id);
|
||||
dlg.exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::reloadAll()
|
||||
{
|
||||
requestGroupMeta();
|
||||
/* grab all ids */
|
||||
//std::list<std::string>
|
||||
|
||||
/* grab all ids */
|
||||
std::list<std::string> friend_pgpIds;
|
||||
std::list<std::string> all_pgpIds;
|
||||
std::list<std::string>::iterator it;
|
||||
|
@ -136,11 +140,11 @@ void CirclesDialog::reloadAll()
|
|||
|
||||
/* add the top level item */
|
||||
QTreeWidgetItem *friendsItem = new QTreeWidgetItem();
|
||||
friendsItem->setText(0, "Friends");
|
||||
friendsItem->setText(0, tr("Friends"));
|
||||
ui.treeWidget_friends->addTopLevelItem(friendsItem);
|
||||
|
||||
QTreeWidgetItem *fofItem = new QTreeWidgetItem();
|
||||
fofItem->setText(0, "Friends Of Friends");
|
||||
fofItem->setText(0, tr("Friends Of Friends"));
|
||||
ui.treeWidget_friends->addTopLevelItem(fofItem);
|
||||
|
||||
for(it = friend_pgpIds.begin(); it != friend_pgpIds.end(); it++)
|
||||
|
@ -151,12 +155,11 @@ void CirclesDialog::reloadAll()
|
|||
friend_set.insert(*it);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromStdString(details.name));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromUtf8(details.name.c_str()));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString(*it));
|
||||
friendsItem->addChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(it = all_pgpIds.begin(); it != all_pgpIds.end(); it++)
|
||||
{
|
||||
|
@ -171,18 +174,12 @@ void CirclesDialog::reloadAll()
|
|||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromStdString(details.name));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_NAME, QString::fromUtf8(details.name.c_str()));
|
||||
item->setText(CIRCLEGROUP_FRIEND_COL_ID, QString::fromStdString(*it));
|
||||
fofItem->addChild(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#define CLEAR_BACKGROUND 0
|
||||
#define GREEN_BACKGROUND 1
|
||||
#define BLUE_BACKGROUND 2
|
||||
#define RED_BACKGROUND 3
|
||||
#define GRAY_BACKGROUND 4
|
||||
|
||||
|
||||
void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
||||
{
|
||||
|
@ -211,44 +208,42 @@ void set_item_background(QTreeWidgetItem *item, uint32_t type)
|
|||
|
||||
void update_children_background(QTreeWidgetItem *item, uint32_t type)
|
||||
{
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
update_children_background(child, type);
|
||||
}
|
||||
set_item_background(child, type);
|
||||
}
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
update_children_background(child, type);
|
||||
}
|
||||
set_item_background(child, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_tree_background(QTreeWidget *tree, uint32_t type)
|
||||
{
|
||||
std::cerr << "CirclesDialog set_tree_background()";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "CirclesDialog set_tree_background()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* grab all toplevel */
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
/* resursively clear child backgrounds */
|
||||
update_children_background(item, type);
|
||||
set_item_background(item, type);
|
||||
}
|
||||
update_children_background(item, type);
|
||||
set_item_background(item, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void check_mark_item(QTreeWidgetItem *item, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
QString coltext = item->text(col);
|
||||
std::string colstr = coltext.toStdString();
|
||||
if (names.end() != names.find(colstr))
|
||||
{
|
||||
set_item_background(item, type);
|
||||
set_item_background(item, type);
|
||||
std::cerr << "CirclesDialog check_mark_item: found match: " << colstr;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
@ -256,37 +251,35 @@ void check_mark_item(QTreeWidgetItem *item, const std::set<std::string> &names,
|
|||
|
||||
void update_mark_children(QTreeWidgetItem *item, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
update_mark_children(child, names, col, type);
|
||||
}
|
||||
check_mark_item(child, names, col, type);
|
||||
}
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
update_mark_children(child, names, col, type);
|
||||
}
|
||||
check_mark_item(child, names, col, type);
|
||||
}
|
||||
}
|
||||
|
||||
void mark_matching_tree(QTreeWidget *tree, const std::set<std::string> &names, uint32_t col, uint32_t type)
|
||||
{
|
||||
std::cerr << "CirclesDialog mark_matching_tree()";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "CirclesDialog mark_matching_tree()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* grab all toplevel */
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
/* resursively clear child backgrounds */
|
||||
update_mark_children(item, names, col, type);
|
||||
check_mark_item(item, names, col, type);
|
||||
}
|
||||
update_mark_children(item, names, col, type);
|
||||
check_mark_item(item, names, col, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** Circles checks - v expensive ***/
|
||||
|
||||
void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
||||
|
@ -300,7 +293,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
|||
{
|
||||
if (details.mAllowedPeers.end() != details.mAllowedPeers.find(*it))
|
||||
{
|
||||
set_item_background(item, GREEN_BACKGROUND);
|
||||
set_item_background(item, GREEN_BACKGROUND);
|
||||
std::cerr << "CirclesDialog mark_circle_item: found match: " << id;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
@ -308,7 +301,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
|||
}
|
||||
else
|
||||
{
|
||||
set_item_background(item, GRAY_BACKGROUND);
|
||||
set_item_background(item, GRAY_BACKGROUND);
|
||||
std::cerr << "CirclesDialog mark_circle_item: no details: " << id;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
@ -316,36 +309,33 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set<std::string> &names)
|
|||
|
||||
void mark_circle_children(QTreeWidgetItem *item, const std::set<std::string> &names)
|
||||
{
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
int count = item->childCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *child = item->child(i);
|
||||
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
mark_circle_children(child, names);
|
||||
}
|
||||
mark_circle_item(child, names);
|
||||
}
|
||||
if (child->childCount() > 0)
|
||||
{
|
||||
mark_circle_children(child, names);
|
||||
}
|
||||
mark_circle_item(child, names);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void mark_circle_tree(QTreeWidget *tree, const std::set<std::string> &names)
|
||||
{
|
||||
std::cerr << "CirclesDialog mark_circle_tree()";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "CirclesDialog mark_circle_tree()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* grab all toplevel */
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
mark_circle_children(item, names);
|
||||
}
|
||||
int count = tree->topLevelItemCount();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QTreeWidgetItem *item = tree->topLevelItem(i);
|
||||
mark_circle_children(item, names);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CirclesDialog::circle_selected()
|
||||
{
|
||||
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
|
||||
|
@ -373,7 +363,7 @@ void CirclesDialog::circle_selected()
|
|||
{
|
||||
/* now mark all the members */
|
||||
std::set<std::string> members;
|
||||
std::map<RsPgpId, std::list<RsGxsId> >::iterator it;
|
||||
std::map<RsPgpId, std::list<RsGxsId> >::iterator it;
|
||||
for(it = details.mAllowedPeers.begin(); it != details.mAllowedPeers.end(); it++)
|
||||
{
|
||||
members.insert(it->first);
|
||||
|
@ -381,17 +371,14 @@ void CirclesDialog::circle_selected()
|
|||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
mark_matching_tree(ui.treeWidget_friends, members,
|
||||
CIRCLEGROUP_FRIEND_COL_ID, GREEN_BACKGROUND);
|
||||
mark_matching_tree(ui.treeWidget_friends, members, CIRCLEGROUP_FRIEND_COL_ID, GREEN_BACKGROUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_tree_background(ui.treeWidget_friends, GRAY_BACKGROUND);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::friend_selected()
|
||||
{
|
||||
/* update circle lists */
|
||||
|
@ -402,7 +389,6 @@ void CirclesDialog::friend_selected()
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
set_tree_background(ui.treeWidget_membership, CLEAR_BACKGROUND);
|
||||
set_tree_background(ui.treeWidget_friends, CLEAR_BACKGROUND);
|
||||
set_tree_background(ui.treeWidget_category, CLEAR_BACKGROUND);
|
||||
|
@ -419,14 +405,8 @@ void CirclesDialog::friend_selected()
|
|||
|
||||
void CirclesDialog::category_selected()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
void CirclesDialog::groupTreeChanged()
|
||||
{
|
||||
|
@ -448,8 +428,8 @@ void CirclesDialog::groupTreeChanged()
|
|||
return;
|
||||
}
|
||||
|
||||
RsGxsGrpMsgIdPair origPagePair = std::make_pair(groupId, origPageId);
|
||||
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
|
||||
RsGxsGrpMsgIdPair origPagePair = std::make_pair(groupId, origPageId);
|
||||
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
|
||||
requestWikiPage(pagepair);
|
||||
}
|
||||
|
||||
|
@ -480,12 +460,11 @@ void CirclesDialog::clearWikiPage()
|
|||
}
|
||||
|
||||
|
||||
void CirclesDialog::clearGroupTree()
|
||||
void CirclesDialog::clearGroupTree()
|
||||
{
|
||||
ui.treeWidget_Pages->clear();
|
||||
}
|
||||
|
||||
|
||||
#define WIKI_GROUP_COL_GROUPNAME 0
|
||||
#define WIKI_GROUP_COL_GROUPID 1
|
||||
|
||||
|
@ -493,7 +472,6 @@ void CirclesDialog::clearGroupTree()
|
|||
#define WIKI_GROUP_COL_PAGEID 1
|
||||
#define WIKI_GROUP_COL_ORIGPAGEID 2
|
||||
|
||||
|
||||
bool CirclesDialog::getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId)
|
||||
{
|
||||
#ifdef WIKI_DEBUG
|
||||
|
@ -522,7 +500,6 @@ bool CirclesDialog::getSelectedPage(std::string &groupId, std::string &pageId, s
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* check if it has changed */
|
||||
groupId = parent->text(WIKI_GROUP_COL_GROUPID).toStdString();
|
||||
pageId = item->text(WIKI_GROUP_COL_PAGEID).toStdString();
|
||||
|
@ -534,7 +511,6 @@ bool CirclesDialog::getSelectedPage(std::string &groupId, std::string &pageId, s
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
std::string CirclesDialog::getSelectedGroup()
|
||||
{
|
||||
std::string groupId;
|
||||
|
@ -572,7 +548,6 @@ std::string CirclesDialog::getSelectedGroup()
|
|||
#endif
|
||||
return groupId;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/************************** Request / Response *************************/
|
||||
|
@ -580,9 +555,13 @@ std::string CirclesDialog::getSelectedGroup()
|
|||
|
||||
void CirclesDialog::requestGroupMeta()
|
||||
{
|
||||
mStateHelper->setLoading(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
std::cerr << "CirclesDialog::requestGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mCircleQueue->cancelActiveRequestTokens(CIRCLESDIALOG_GROUPMETA);
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
|
||||
|
@ -590,9 +569,10 @@ void CirclesDialog::requestGroupMeta()
|
|||
mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, CIRCLESDIALOG_GROUPMETA);
|
||||
}
|
||||
|
||||
|
||||
void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
||||
{
|
||||
mStateHelper->setLoading(CIRCLESDIALOG_GROUPMETA, false);
|
||||
|
||||
std::cerr << "CirclesDialog::loadGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
@ -603,37 +583,40 @@ void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
|||
|
||||
if (!rsGxsCircles->getGroupSummary(token,groupInfo))
|
||||
{
|
||||
std::cerr << "CirclesDialog::loadGroupMeta() Error getting GroupMeta";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
std::cerr << "CirclesDialog::loadGroupMeta() Error getting GroupMeta";
|
||||
std::cerr << std::endl;
|
||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, false);
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
/* add the top level item */
|
||||
QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem();
|
||||
personalCirclesItem->setText(0, "Personal Circles");
|
||||
personalCirclesItem->setText(0, tr("Personal Circles"));
|
||||
ui.treeWidget_membership->addTopLevelItem(personalCirclesItem);
|
||||
|
||||
QTreeWidgetItem *externalAdminCirclesItem = new QTreeWidgetItem();
|
||||
externalAdminCirclesItem->setText(0, "External Circles (Admin)");
|
||||
externalAdminCirclesItem->setText(0, tr("External Circles (Admin)"));
|
||||
ui.treeWidget_membership->addTopLevelItem(externalAdminCirclesItem);
|
||||
|
||||
QTreeWidgetItem *externalSubCirclesItem = new QTreeWidgetItem();
|
||||
externalSubCirclesItem->setText(0, "External Circles (Subscribed)");
|
||||
externalSubCirclesItem->setText(0, tr("External Circles (Subscribed)"));
|
||||
ui.treeWidget_membership->addTopLevelItem(externalSubCirclesItem);
|
||||
|
||||
QTreeWidgetItem *externalOtherCirclesItem = new QTreeWidgetItem();
|
||||
externalOtherCirclesItem->setText(0, "External Circles (Other)");
|
||||
externalOtherCirclesItem->setText(0, tr("External Circles (Other)"));
|
||||
ui.treeWidget_membership->addTopLevelItem(externalOtherCirclesItem);
|
||||
|
||||
for(vit = groupInfo.begin(); vit != groupInfo.end(); vit++)
|
||||
{
|
||||
for(vit = groupInfo.begin(); vit != groupInfo.end(); vit++)
|
||||
{
|
||||
/* Add Widget, and request Pages */
|
||||
std::cerr << "CirclesDialog::loadGroupMeta() GroupId: " << vit->mGroupId;
|
||||
std::cerr << " Group: " << vit->mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
||||
QTreeWidgetItem *groupItem = new QTreeWidgetItem();
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromStdString(vit->mGroupName));
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str()));
|
||||
groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, QString::fromStdString(vit->mGroupId));
|
||||
|
||||
if (vit->mCircleType == GXS_CIRCLE_TYPE_LOCAL)
|
||||
|
@ -655,14 +638,11 @@ void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
|||
externalOtherCirclesItem->addChild(groupItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CirclesDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
|
||||
std::cerr << "CirclesDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
@ -682,9 +662,3 @@ void CirclesDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue