From 6ac95b28cd288f8852f20453ee2229f94a3ccf7d Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 15 Jul 2013 01:03:39 +0000 Subject: [PATCH] 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 --- .../src/gui/Circles/CirclesDialog.cpp | 322 +++++----- .../src/gui/Circles/CirclesDialog.h | 58 +- .../src/gui/Circles/CirclesDialog.ui | 101 +-- .../src/gui/Circles/Circles_images.qrc | 16 - .../src/gui/Circles/CreateCircleDialog.cpp | 580 ++---------------- .../src/gui/Circles/CreateCircleDialog.h | 46 -- .../src/gui/Circles/CreateCircleDialog.ui | 306 +++++---- .../gui/gxsforums/GxsForumThreadWidget.cpp | 4 +- retroshare-gui/src/lang/retroshare_en.ts | 116 ++-- 9 files changed, 466 insertions(+), 1083 deletions(-) delete mode 100644 retroshare-gui/src/gui/Circles/Circles_images.qrc diff --git a/retroshare-gui/src/gui/Circles/CirclesDialog.cpp b/retroshare-gui/src/gui/Circles/CirclesDialog.cpp index 816a8e82c..f973514c8 100644 --- a/retroshare-gui/src/gui/Circles/CirclesDialog.cpp +++ b/retroshare-gui/src/gui/Circles/CirclesDialog.cpp @@ -21,107 +21,111 @@ * */ -#include -#include +#include #include "gui/Circles/CirclesDialog.h" #include "gui/Circles/CreateCircleDialog.h" +#include "gui/common/UIStateHelper.h" #include #include -#include -#include - -#include - /****** * #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", + "Open points:
    " + "
  • Improve create dialog" + "
  • Edit circles" + "
  • Categories" + "
  • Don't refill complete trees" + "
"); } -#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 + /* grab all ids */ std::list friend_pgpIds; std::list all_pgpIds; std::list::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 &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 &names, void update_mark_children(QTreeWidgetItem *item, const std::set &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 &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 &names) @@ -300,7 +293,7 @@ void mark_circle_item(QTreeWidgetItem *item, const std::set &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 &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 &names) void mark_circle_children(QTreeWidgetItem *item, const std::set &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 &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 members; - std::map >::iterator it; + std::map >::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 } } } - - - - - - diff --git a/retroshare-gui/src/gui/Circles/CirclesDialog.h b/retroshare-gui/src/gui/Circles/CirclesDialog.h index b7cadab53..bdf2110e0 100644 --- a/retroshare-gui/src/gui/Circles/CirclesDialog.h +++ b/retroshare-gui/src/gui/Circles/CirclesDialog.h @@ -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 +class UIStateHelper; -#include "util/TokenQueue.h" - -#include - -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 - diff --git a/retroshare-gui/src/gui/Circles/CirclesDialog.ui b/retroshare-gui/src/gui/Circles/CirclesDialog.ui index f28f02c03..a829b7f57 100644 --- a/retroshare-gui/src/gui/Circles/CirclesDialog.ui +++ b/retroshare-gui/src/gui/Circles/CirclesDialog.ui @@ -15,49 +15,60 @@ - - - - - Create Personal Circle - - - - - - - Create External Circle - - - - - - - Edit Circle - - - - - - - Refresh - - - - - - - Qt::Horizontal - - - - 378 - 20 - - - - - + + + QFrame::Box + + + QFrame::Sunken + + + + 2 + + + + + Create Personal Circle + + + + + + + Create External Circle + + + + + + + Edit Circle + + + + + + + Todo + + + + + + + Qt::Horizontal + + + + 378 + 20 + + + + + + @@ -201,8 +212,6 @@ - - - + diff --git a/retroshare-gui/src/gui/Circles/Circles_images.qrc b/retroshare-gui/src/gui/Circles/Circles_images.qrc deleted file mode 100644 index 1ea8313ef..000000000 --- a/retroshare-gui/src/gui/Circles/Circles_images.qrc +++ /dev/null @@ -1,16 +0,0 @@ - - - images/arrow-left.png - images/arrow-right.png - images/resource-group-new.png - images/appointment-new.png - images/book2_32.png - images/story-editor.png - images/story-editor_48.png - images/republish.png - images/resource-group-new_48.png - images/wikibook_32.png - images/resource-group_64.png - images/appointment-new_64.png - - diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp index a5ce34577..5c0908b49 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp @@ -21,47 +21,26 @@ * */ -#include "gui/Circles/CreateCircleDialog.h" - -#include #include -#include -#include -#include -#include + +#include "gui/Circles/CreateCircleDialog.h" #include #include -#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 -#include -#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)), this, SLOT(fileHashingFinished(QList))); - // 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)), this, SLOT(fileHashingFinished(QList))); - - // 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 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 &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(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 hashedFiles) -{ - std::cerr << "CreateCircleDialog::fileHashingFinished() started." << std::endl; - - QString mesgString; - - QList::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() + "
"; - } - } - -#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 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 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 ids; std::list::iterator it; - RsGxsIdGroup data; std::vector 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; - } } } diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h index f55dd96d7..f40ae3826 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h @@ -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 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(); diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui index 983d139d6..189c9a549 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui @@ -13,8 +13,8 @@ - - + + Circle Details @@ -127,178 +127,158 @@ - - - - Circle Membership - - - - - - - Name - - - - - IDs - - - - - - - - - + + - - - Qt::Vertical + + + Circle Membership - - - 20 - 188 - - - - - - - - << Add - - - - - - - >> Remove - - - - - - - Qt::Vertical - - - - 20 - 178 - - - - - - - - - - Known Identities - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - - - All PGP IDs - - - - - - - Known PGP IDs - - - - - - - - + - - - Filter + + + + Name + + + + + IDs + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 188 + + + + + + + + << Add + + + + + + + >> Remove + + + + + + + Qt::Vertical + + + + 20 + 178 + + + + + + + + + + Known Identities + + + + + + QFrame::StyledPanel + + QFrame::Raised + + + + 0 + + + 0 + + + + + All PGP IDs + + + + + + + Known PGP IDs + + + + - + + + + + Filter + + + + + + + + + + + + + Nickname + + + + + ID + + + + + Type + + + - - - - - - Nickname - - - - - ID - - - - - Type - - - - - - - - - - - - - Qt::Horizontal - - - - 418 - 20 - - - - - - - - Cancel - - - - - - - Create Group - + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + @@ -313,8 +293,6 @@
gui/gxs/GxsCircleChooser.h
- - - + diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 8edbe7dff..3e84c23cc 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -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); diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts index 7b516df0c..792490aea 100644 --- a/retroshare-gui/src/lang/retroshare_en.ts +++ b/retroshare-gui/src/lang/retroshare_en.ts @@ -1821,10 +1821,6 @@ Double click lobbies to enter and chat. CirclesDialog - - Refresh - - Showing details: @@ -1901,6 +1897,26 @@ Double click lobbies to enter and chat. Edit Circle + + Todo + + + + Friends Of Friends + + + + External Circles (Admin) + + + + External Circles (Subscribed) + + + + External Circles (Other) + + ConfCertDialog @@ -3191,66 +3207,10 @@ p, li { white-space: pre-wrap; } Type - - Cancel - - - - Create Group - - - - Start New Thread - - - - Post Forum Message - - - - Paste RetroShare Link - - - - Paste full RetroShare Link - - - - Paste my certificate link - - - - No Forum - - - - Loading - - - - In Reply to - - RetroShare - - Please set a Forum Subject and Forum Message - - - - Please choose Signing Id - - - - Please choose Signing Id, it is required - - - - Add Extra File - - Please set a name for your Circle @@ -3604,10 +3564,6 @@ p, li { white-space: pre-wrap; } No Forum - - Loading - - In Reply to @@ -6675,10 +6631,6 @@ before you can comment Next unread - - Refresh - - Search Title @@ -6787,6 +6739,14 @@ before you can comment Forum Description + + Forum: + + + + Thread: + + GxsForumsDialog @@ -6894,6 +6854,10 @@ before you can comment On %1, %2 wrote: + + Todo + + GxsForumsFillThread @@ -10745,14 +10709,6 @@ Reported error is: %2 Tunnel is pending... - - Secured tunnel established! - - - - Secured tunnel is working - - Messaging link is expired @@ -10769,6 +10725,14 @@ Reported error is: %2 Chat connection is not possible + + Secured tunnel established. Waiting for ACK... + + + + Secured tunnel is working. You can talk! + + QuickStartWizard