- 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:
thunder2 2013-07-15 01:03:39 +00:00
parent 621c8037bc
commit 6ac95b28cd
9 changed files with 466 additions and 1083 deletions

View File

@ -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
}
}
}

View File

@ -24,37 +24,33 @@
#ifndef MRK_CIRCLE_DIALOG_H
#define MRK_CIRCLE_DIALOG_H
#include "retroshare-gui/mainpage.h"
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "util/TokenQueue.h"
#include "ui_CirclesDialog.h"
//#include <retroshare/rscircles.h>
class UIStateHelper;
#include "util/TokenQueue.h"
#include <map>
class CirclesDialog : public MainPage, public TokenResponse
class CirclesDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
{
Q_OBJECT
Q_OBJECT
public:
CirclesDialog(QWidget *parent = 0);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected:
virtual void updateDisplay(bool initialFill);
private slots:
void todo();
void createExternalCircle();
void createPersonalCircle();
void editExistingCircle();
void createExternalCircle();
void createPersonalCircle();
void editExistingCircle();
void checkUpdate();
void reloadAll();
void circle_selected();
void friend_selected();
void category_selected();
void circle_selected();
void friend_selected();
void category_selected();
#if 0
void OpenOrShowAddPageDialog();
@ -72,29 +68,27 @@ void category_selected();
#endif
private:
void reloadAll();
#if 0
void clearWikiPage();
void clearGroupTree();
voidclearWikiPage();
void clearGroupTree();
void updateWikiPage(const RsWikiSnapshot &page);
bool getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId);
std::string getSelectedPage();
std::string getSelectedGroup();
void updateWikiPage(const RsWikiSnapshot &page);
bool getSelectedPage(std::string &groupId, std::string &pageId, std::string &origPageId);
std::string getSelectedPage();
std::string getSelectedGroup();
#endif
void requestGroupMeta();
void loadGroupMeta(const uint32_t &token);
void requestGroupMeta();
void loadGroupMeta(const uint32_t &token);
TokenQueue *mCircleQueue;
UIStateHelper *mStateHelper;
/* UI - from Designer */
Ui::CirclesDialog ui;
};
#endif

View File

@ -15,49 +15,60 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="pushButton_localCircle">
<property name="text">
<string>Create Personal Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create External Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_refresh">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>378</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<widget class="QFrame" name="titleBarFrame">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_localCircle">
<property name="text">
<string>Create Personal Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create External Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="todoPushButton">
<property name="text">
<string>Todo</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>378</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
@ -201,8 +212,6 @@
</item>
</layout>
</widget>
<resources>
<include location="Circles_images.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@ -1,16 +0,0 @@
<RCC>
<qresource prefix="/" >
<file>images/arrow-left.png</file>
<file>images/arrow-right.png</file>
<file>images/resource-group-new.png</file>
<file>images/appointment-new.png</file>
<file>images/book2_32.png</file>
<file>images/story-editor.png</file>
<file>images/story-editor_48.png</file>
<file>images/republish.png</file>
<file>images/resource-group-new_48.png</file>
<file>images/wikibook_32.png</file>
<file>images/resource-group_64.png</file>
<file>images/appointment-new_64.png</file>
</qresource>
</RCC>

View File

@ -21,47 +21,26 @@
*
*/
#include "gui/Circles/CreateCircleDialog.h"
#include <QMenu>
#include <QMessageBox>
#include <QFile>
#include <QDesktopWidget>
#include <QDropEvent>
#include <QPushButton>
#include "gui/Circles/CreateCircleDialog.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#if 0
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
#include "gui/common/Emoticons.h"
#include "util/HandleRichText.h"
#include "util/misc.h"
#include <sys/stat.h>
#include <iostream>
#endif
#define CREATECIRCLEDIALOG_CIRCLEINFO 2
#define CREATECIRCLEDIALOG_IDINFO 3
#define CREATECIRCLEDIALOG_CIRCLEINFO 2
#define CREATECIRCLEDIALOG_IDINFO 3
#define RSCIRCLEID_COL_NICKNAME 0
#define RSCIRCLEID_COL_KEYID 1
#define RSCIRCLEID_COL_IDTYPE 2
/** Constructor */
CreateCircleDialog::CreateCircleDialog()
: QDialog(NULL)
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
/* Setup Queue */
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
@ -71,22 +50,15 @@ CreateCircleDialog::CreateCircleDialog()
//setWindowTitle(text);
//Settings->loadWidgetInformation(this);
//connect(ui.forumMessage, SIGNAL( customContextMenuRequested(QPoint)), this, SLOT(forumMessageCostumPopupMenu(QPoint)));
//connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
connect(ui.addButton, SIGNAL(clicked()), this, SLOT(addMember()));
connect(ui.removeButton, SIGNAL(clicked()), this, SLOT(removeMember()));
connect(ui.pushButton_create, SIGNAL(clicked()), this, SLOT(createCircle()));
connect(ui.pushButton_cancel, SIGNAL(clicked()), this, SLOT(cancelDialog()));
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createCircle()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
//connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
//connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
//connect(ui.pastersButton, SIGNAL(clicked()), this, SLOT(pasteLink()));
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*)));
connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*)));
ui.removeButton->setEnabled(false);
ui.addButton->setEnabled(false);
@ -99,8 +71,6 @@ CreateCircleDialog::CreateCircleDialog()
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL);
}
CreateCircleDialog::~CreateCircleDialog()
{
delete(mCircleQueue);
@ -125,8 +95,6 @@ void CreateCircleDialog::editExistingId(std::string circleId)
}
/* lock stuff they cannot edit */
}
void CreateCircleDialog::editNewId(bool isExternal)
@ -161,8 +129,6 @@ void CreateCircleDialog::setupForPersonalCircle()
getPgpIdentities();
}
void CreateCircleDialog::setupForExternalCircle()
{
mIsExternalCircle = true;
@ -177,450 +143,29 @@ void CreateCircleDialog::setupForExternalCircle()
requestGxsIdentities();
}
void CreateCircleDialog::cancelDialog()
{
close();
}
void CreateCircleDialog::selectedId(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
Q_UNUSED(previous);
Q_UNUSED(previous);
ui.addButton->setEnabled(current != NULL);
}
void CreateCircleDialog::selectedMember(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
Q_UNUSED(previous);
Q_UNUSED(previous);
ui.removeButton->setEnabled(current != NULL);
}
#if 0
#define CREATEGXSFORUMMSG_FORUMINFO 1
#define CREATEGXSFORUMMSG_PARENTMSG 2
/** Constructor */
CreateCircleDialog::CreateCircleDialog(const std::string &fId, const std::string &pId)
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
void CreateCircleDialog::addMember()
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
/* Setup Queue */
mForumQueue = new TokenQueue(rsGxsForums->getTokenService(), this);
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
setWindowTitle(text);
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
ui.headerFrame->setHeaderText(text);
Settings->loadWidgetInformation(this);
connect(ui.forumMessage, SIGNAL( customContextMenuRequested(QPoint)), this, SLOT(forumMessageCostumPopupMenu(QPoint)));
connect(ui.hashBox, SIGNAL(fileHashingFinished(QList<HashedFile>)), this, SLOT(fileHashingFinished(QList<HashedFile>)));
// connect up the buttons.
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(createMsg()));
connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidgetForums()));
connect(ui.attachFileButton, SIGNAL(clicked()), this, SLOT(addFile()));
connect(ui.pastersButton, SIGNAL(clicked()), this, SLOT(pasteLink()));
setAcceptDrops(true);
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(false);
mParentMsgLoaded = false;
mForumMetaLoaded = false;
newMsg();
}
CreateCircleDialog::~CreateCircleDialog()
{
delete(mForumQueue);
}
void CreateCircleDialog::forumMessageCostumPopupMenu(QPoint point)
{
QMenu *contextMnu = ui.forumMessage->createStandardContextMenu(point);
contextMnu->addSeparator();
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste my certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
pasteLinkFullAct->setDisabled (true);
}
contextMnu->exec(QCursor::pos());
delete(contextMnu);
}
void CreateCircleDialog::newMsg()
{
/* clear all */
mParentMsgLoaded = false;
mForumMetaLoaded = false;
/* fill in the available OwnIds for signing */
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
/* lock gui */
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui.innerFrame->setEnabled(false);
if (mForumId.empty()) {
ui.forumName->setText(tr("No Forum"));
return;
}
ui.forumName->setText(tr("Loading"));
/* request Data */
{
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
std::list<std::string> groupIds;
groupIds.push_back(mForumId);
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
std::cerr << std::endl;
uint32_t token;
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
}
if (mParentId.empty())
{
mParentMsgLoaded = true;
}
else
{
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
GxsMsgReq msgIds;
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
vect.push_back(mParentId);
std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
std::cerr << std::endl;
uint32_t token;
mForumQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEGXSFORUMMSG_PARENTMSG);
}
}
void CreateCircleDialog::saveForumInfo(const RsGroupMetaData &meta)
{
mForumMeta = meta;
mForumMetaLoaded = true;
loadFormInformation();
}
void CreateCircleDialog::saveParentMsg(const RsGxsForumMsg &msg)
{
mParentMsg = msg;
mParentMsgLoaded = true;
loadFormInformation();
}
void CreateCircleDialog::loadFormInformation()
{
if ((!mParentMsgLoaded) && (!mParentId.empty()))
{
std::cerr << "CreateCircleDialog::loadMsgInformation() ParentMsg not Loaded Yet";
std::cerr << std::endl;
return;
}
if (!mForumMetaLoaded)
{
std::cerr << "CreateCircleDialog::loadMsgInformation() ForumMeta not Loaded Yet";
std::cerr << std::endl;
return;
}
ui.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui.innerFrame->setEnabled(true);
std::cerr << "CreateCircleDialog::loadMsgInformation() Data Available!";
std::cerr << std::endl;
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
QString subj;
if (!mParentId.empty())
{
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
name += " " + tr("In Reply to") + ": ";
name += title;
QString text = title;
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
subj = title;
}
else
{
subj = "Re: " + title;
}
}
ui.forumName->setText(misc::removeNewLine(name));
ui.forumSubject->setText(misc::removeNewLine(subj));
if (ui.forumSubject->text().isEmpty())
{
ui.forumSubject->setFocus();
}
else
{
ui.forumMessage->setFocus();
}
#ifdef TOGXS
if (mForumMeta.mGroupFlags & RS_DISTRIB_AUTHEN_REQ)
#else
if (1)
#endif
{
ui.signBox->setChecked(true);
ui.signBox->setEnabled(false);
}
else
{
/* Uncheck sign box by default for anonymous forums */
ui.signBox->setChecked(false);
ui.signBox->setEnabled(true);
}
ui.forumMessage->setText("");
}
void CreateCircleDialog::createMsg()
{
QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc;
RsHtml::optimizeHtml(ui.forumMessage, desc);
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),
QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Subject!!
}
RsGxsForumMsg msg;
msg.mMeta.mGroupId = mForumId;
msg.mMeta.mParentId = mParentId;
msg.mMeta.mMsgId = "";
if (mParentMsgLoaded)
{
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
}
msg.mMeta.mMsgName = std::string(name.toUtf8());
msg.mMsg = std::string(desc.toUtf8());
#ifdef TOGXS
msg.mMeta.mMsgFlags = RS_DISTRIB_AUTHEN_REQ;
#endif
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
return; /* do nothing */
if (ui.signBox->isChecked())
{
RsGxsId authorId;
if (ui.idChooser->getChosenId(authorId))
{
msg.mMeta.mAuthorId = authorId;
std::cerr << "CreateCircleDialog::createMsg() AuthorId: " << authorId;
std::cerr << std::endl;
}
else
{
std::cerr << "CreateCircleDialog::createMsg() ERROR GETTING AuthorId!";
std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
}
else
{
std::cerr << "CreateCircleDialog::createMsg() No Signature (for now :)";
std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("Please choose Signing Id, it is required"),
QMessageBox::Ok, QMessageBox::Ok);
return;
}
uint32_t token;
rsGxsForums->createMsg(token, msg);
close();
}
void CreateCircleDialog::closeEvent (QCloseEvent * /*event*/)
{
Settings->saveWidgetInformation(this);
}
void CreateCircleDialog::smileyWidgetForums()
{
Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false);
}
void CreateCircleDialog::addSmileys()
{
ui.forumMessage->textCursor().insertText(qobject_cast<QPushButton*>(sender())->toolTip().split("|").first());
}
void CreateCircleDialog::addFile()
{
QStringList files;
if (misc::getOpenFileNames(this, RshareSettings::LASTDIR_EXTRAFILE, tr("Add Extra File"), "", files)) {
ui.hashBox->addAttachments(files,RS_FILE_REQ_ANONYMOUS_ROUTING);
}
}
void CreateCircleDialog::fileHashingFinished(QList<HashedFile> hashedFiles)
{
std::cerr << "CreateCircleDialog::fileHashingFinished() started." << std::endl;
QString mesgString;
QList<HashedFile>::iterator it;
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
HashedFile& hashedFile = *it;
RetroShareLink link;
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
mesgString += link.toHtmlSize() + "<br>";
}
}
#ifdef CHAT_DEBUG
std::cerr << "CreateCircleDialog::anchorClicked mesgString : " << mesgString.toStdString() << std::endl;
#endif
if (!mesgString.isEmpty()) {
ui.forumMessage->textCursor().insertHtml(mesgString);
}
ui.forumMessage->setFocus( Qt::OtherFocusReason );
}
void CreateCircleDialog::pasteLink()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtml()) ;
}
void CreateCircleDialog::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}
void CreateCircleDialog::pasteOwnCertificateLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui.forumMessage->insertHtml(link.toHtml() + " ");
}
}
void CreateCircleDialog::loadForumInfo(const uint32_t &token)
{
std::cerr << "CreateCircleDialog::loadForumInfo()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsGxsForums->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
saveForumInfo(fi);
}
else
{
std::cerr << "CreateCircleDialog::loadForumInfo() ERROR INVALID Number of Forums";
std::cerr << std::endl;
}
}
void CreateCircleDialog::loadParentMsg(const uint32_t &token)
{
std::cerr << "CreateCircleDialog::loadParentMsg()";
std::cerr << std::endl;
// Only grab one.... ignore more (shouldn't be any).
std::vector<RsGxsForumMsg> msgs;
if (rsGxsForums->getMsgData(token, msgs))
{
if (msgs.size() != 1)
{
/* error */
std::cerr << "CreateCircleDialog::loadParentMsg() ERROR wrong number of msgs";
std::cerr << std::endl;
}
saveParentMsg(msgs[0]);
}
}
void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "CreateCircleDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue == mForumQueue)
{
/* now switch on req */
switch(req.mUserType)
{
case CREATEGXSFORUMMSG_FORUMINFO:
loadForumInfo(req.mToken);
break;
case CREATEGXSFORUMMSG_PARENTMSG:
loadParentMsg(req.mToken);
break;
default:
std::cerr << "CreateCircleDialog::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}
}
#endif
void CreateCircleDialog::addMember()
{
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
if (!item)
{
return;
}
/* check that its not there already */
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
QTreeWidget *tree = ui.treeWidget_membership;
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
QTreeWidget *tree = ui.treeWidget_membership;
int count = tree->topLevelItemCount();
for(int i = 0; i < count; i++)
@ -634,10 +179,10 @@ void CreateCircleDialog::addMember()
}
}
QTreeWidgetItem *member = new QTreeWidgetItem();
member->setText(RSCIRCLEID_COL_NICKNAME, item->text(RSCIRCLEID_COL_NICKNAME));
member->setText(RSCIRCLEID_COL_KEYID, item->text(RSCIRCLEID_COL_KEYID));
member->setText(RSCIRCLEID_COL_IDTYPE, item->text(RSCIRCLEID_COL_IDTYPE));
QTreeWidgetItem *member = new QTreeWidgetItem();
member->setText(RSCIRCLEID_COL_NICKNAME, item->text(RSCIRCLEID_COL_NICKNAME));
member->setText(RSCIRCLEID_COL_KEYID, item->text(RSCIRCLEID_COL_KEYID));
member->setText(RSCIRCLEID_COL_IDTYPE, item->text(RSCIRCLEID_COL_IDTYPE));
tree->addTopLevelItem(member);
}
@ -645,7 +190,7 @@ void CreateCircleDialog::addMember()
void CreateCircleDialog::removeMember()
{
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
if (!item)
{
return;
@ -655,9 +200,7 @@ void CreateCircleDialog::removeMember()
delete(item);
}
void CreateCircleDialog::createCircle()
void CreateCircleDialog::createCircle()
{
std::cerr << "CreateCircleDialog::createCircle()";
std::cerr << std::endl;
@ -667,8 +210,7 @@ void CreateCircleDialog::createCircle()
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a name for your Circle"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a name for your Circle"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty Subject!!
}
@ -692,12 +234,12 @@ void CreateCircleDialog::createCircle()
/* copy Ids from GUI */
QTreeWidget *tree = ui.treeWidget_membership;
QTreeWidget *tree = ui.treeWidget_membership;
int count = tree->topLevelItemCount();
for(int i = 0; i < count; i++)
{
QTreeWidgetItem *item = tree->topLevelItem(i);
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
/* insert into circle */
if (mIsExternalCircle)
@ -721,8 +263,7 @@ void CreateCircleDialog::createCircle()
std::cerr << std::endl;
// cannot edit these yet.
QMessageBox::warning(this, tr("RetroShare"),tr("Cannot Edit Existing Circles Yet"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, tr("RetroShare"),tr("Cannot Edit Existing Circles Yet"), QMessageBox::Ok, QMessageBox::Ok);
return;
}
@ -768,15 +309,13 @@ void CreateCircleDialog::createCircle()
std::cerr << "CreateCircleDialog::createCircle() Error no Id Chosen";
std::cerr << std::endl;
QMessageBox::warning(this, tr("RetroShare"),tr("No Restriction Circle Selected"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, tr("RetroShare"),tr("No Restriction Circle Selected"), QMessageBox::Ok, QMessageBox::Ok);
return;
}
}
else
{
QMessageBox::warning(this, tr("RetroShare"),tr("No Circle Limitations Selected"),
QMessageBox::Ok, QMessageBox::Ok);
QMessageBox::warning(this, tr("RetroShare"),tr("No Circle Limitations Selected"), QMessageBox::Ok, QMessageBox::Ok);
return;
}
}
@ -798,8 +337,6 @@ void CreateCircleDialog::createCircle()
close();
}
void CreateCircleDialog::requestCircle(const RsGxsGroupId &groupId)
{
RsTokReqOptions opts;
@ -827,7 +364,6 @@ void CreateCircleDialog::loadCircle(uint32_t token)
std::list<std::string> ids;
std::list<std::string>::iterator it;
RsGxsIdGroup data;
std::vector<RsGxsCircleGroup> groups;
if (!rsGxsCircles->getGroupData(token, groups))
{
@ -849,7 +385,6 @@ void CreateCircleDialog::loadCircle(uint32_t token)
//mCircleGroup = groups[0];
}
void CreateCircleDialog::getPgpIdentities()
{
std::cerr << "CreateCircleDialog::getPgpIdentities()";
@ -866,14 +401,14 @@ void CreateCircleDialog::getPgpIdentities()
rsPeers->getGPGAcceptedList(ids);
for(it = ids.begin(); it != ids.end(); it++)
{
QTreeWidgetItem *item = new QTreeWidgetItem();
RsPeerDetails details;
QTreeWidgetItem *item = new QTreeWidgetItem();
RsPeerDetails details;
rsPeers->getGPGDetails(*it, details);
rsPeers->getGPGDetails(*it, details);
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Identity");
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromStdString(details.name));
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(details.gpg_id));
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Identity");
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromUtf8(details.name.c_str()));
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(details.gpg_id));
tree->addTopLevelItem(item);
}
@ -892,10 +427,6 @@ void CreateCircleDialog::requestGxsIdentities()
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, CREATECIRCLEDIALOG_IDINFO);
}
void CreateCircleDialog::loadIdentities(uint32_t token)
{
std::cerr << "CreateCircleDialog::loadIdentities(" << token << ")";
@ -946,33 +477,30 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
continue;
}
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromStdString(data.mMeta.mGroupName));
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId));
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (data.mPgpKnown)
{
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
item->setText(RSCIRCLEID_COL_IDTYPE, QString::fromStdString(details.name));
}
else
{
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Linked Id");
}
}
else
{
item->setText(RSCIRCLEID_COL_IDTYPE, "Anon Id");
}
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()));
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId));
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
{
if (data.mPgpKnown)
{
RsPeerDetails details;
rsPeers->getGPGDetails(data.mPgpId, details);
item->setText(RSCIRCLEID_COL_IDTYPE, QString::fromUtf8(details.name.c_str()));
}
else
{
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Linked Id");
}
}
else
{
item->setText(RSCIRCLEID_COL_IDTYPE, "Anon Id");
}
tree->addTopLevelItem(item);
}
}
void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "CreateCircleDialog::loadRequest() UserType: " << req.mUserType;
@ -989,7 +517,6 @@ void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest
default:
std::cerr << "CreateCircleDialog::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}
@ -1004,7 +531,6 @@ void CreateCircleDialog::loadRequest(const TokenQueue *queue, const TokenRequest
default:
std::cerr << "CreateCircleDialog::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}
}

View File

@ -42,14 +42,9 @@ public:
void editNewId(bool isExternal);
void editExistingId(std::string circleId);
#if 0
void newMsg(); /* cleanup */
#endif
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots:
void addMember();
void removeMember();
@ -57,49 +52,8 @@ private slots:
void selectedMember(QTreeWidgetItem*, QTreeWidgetItem*);
void createCircle();
void cancelDialog();
#if 0
/** Create the context popup menu and it's submenus */
void forumMessageCostumPopupMenu( QPoint point );
void fileHashingFinished(QList<HashedFile> hashedFiles);
/* actions to take.... */
void createMsg();
void pasteLink();
void pasteLinkFull();
void pasteOwnCertificateLink();
void smileyWidgetForums();
void addSmileys();
void addFile();
#endif
protected:
#if 0
void closeEvent (QCloseEvent * event);
#endif
private:
#if 0
void saveForumInfo(const RsGroupMetaData &meta);
void saveParentMsg(const RsGxsForumMsg &msg);
void loadFormInformation();
void loadForumInfo(const uint32_t &token);
void loadParentMsg(const uint32_t &token);
std::string mForumId;
std::string mParentId;
bool mParentMsgLoaded;
bool mForumMetaLoaded;
RsGxsForumMsg mParentMsg;
RsGroupMetaData mForumMeta;
#endif
void setupForPersonalCircle();
void setupForExternalCircle();

View File

@ -13,8 +13,8 @@
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QGroupBox" name="groupBox_title">
<property name="title">
<string>Circle Details</string>
@ -127,178 +127,158 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Circle Membership</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="treeWidget_membership">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Circle Membership</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>188</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&lt;&lt; Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>&gt;&gt; Remove </string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>178</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="2">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Known Identities</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_PgpTypes">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="radioButton_ListAllPGP">
<property name="text">
<string>All PGP IDs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_ListKnownPGP">
<property name="text">
<string>Known PGP IDs</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Filter</string>
<widget class="QTreeWidget" name="treeWidget_membership">
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>188</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>&lt;&lt; Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>&gt;&gt; Remove </string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>178</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Known Identities</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_PgpTypes">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="radioButton_ListAllPGP">
<property name="text">
<string>All PGP IDs</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_ListKnownPGP">
<property name="text">
<string>Known PGP IDs</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLineEdit" name="IdFilter"/>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="IdFilter"/>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget_IdList">
<column>
<property name="text">
<string>Nickname</string>
</property>
</column>
<column>
<property name="text">
<string>ID</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTreeWidget" name="treeWidget_IdList">
<column>
<property name="text">
<string>Nickname</string>
</property>
</column>
<column>
<property name="text">
<string>ID</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>418</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_create">
<property name="text">
<string>Create Group</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
@ -313,8 +293,6 @@
<header>gui/gxs/GxsCircleChooser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Circles_images.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@ -91,11 +91,11 @@ GxsForumThreadWidget::GxsForumThreadWidget(const std::string &forumId, QWidget *
{
ui->setupUi(this);
setUpdateWhenInvisible(true);
/* Setup UI helper */
mStateHelper = new UIStateHelper(this);
setUpdateWhenInvisible(true);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressBar, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressText, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->newthreadButton);

View File

@ -1821,10 +1821,6 @@ Double click lobbies to enter and chat.</source>
</context>
<context>
<name>CirclesDialog</name>
<message>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Showing details: </source>
<translation type="unfinished"></translation>
@ -1901,6 +1897,26 @@ Double click lobbies to enter and chat.</source>
<source>Edit Circle</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Todo</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Friends Of Friends</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>External Circles (Admin)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>External Circles (Subscribed)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>External Circles (Other)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConfCertDialog</name>
@ -3191,66 +3207,10 @@ p, li { white-space: pre-wrap; }
<source>Type</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Create Group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Start New Thread</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Post Forum Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste full RetroShare Link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Paste my certificate link</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No Forum</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In Reply to</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>RetroShare</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please set a Forum Subject and Forum Message</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please choose Signing Id</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please choose Signing Id, it is required</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Add Extra File</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please set a name for your Circle</source>
<translation type="unfinished"></translation>
@ -3604,10 +3564,6 @@ p, li { white-space: pre-wrap; }
<source>No Forum</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>In Reply to</source>
<translation type="unfinished"></translation>
@ -6675,10 +6631,6 @@ before you can comment</source>
<source>Next unread</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Refresh</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search Title</source>
<translation type="unfinished"></translation>
@ -6787,6 +6739,14 @@ before you can comment</source>
<source>Forum Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Forum:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Thread:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GxsForumsDialog</name>
@ -6894,6 +6854,10 @@ before you can comment</source>
<source>On %1, %2 wrote:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Todo</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GxsForumsFillThread</name>
@ -10745,14 +10709,6 @@ Reported error is: %2</source>
<source>Tunnel is pending...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Secured tunnel established!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Secured tunnel is working</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Messaging link is expired</source>
<translation type="unfinished"></translation>
@ -10769,6 +10725,14 @@ Reported error is: %2</source>
<source>Chat connection is not possible</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Secured tunnel established. Waiting for ACK...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Secured tunnel is working. You can talk!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QuickStartWizard</name>