revert GUI part of svn commit 7042

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7043 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-01-20 07:29:54 +00:00
parent f3afc128ee
commit 46518ebf51
7 changed files with 170 additions and 231 deletions

View File

@ -86,8 +86,8 @@ PostedListDialog::PostedListDialog(QWidget *parent)
/* create posted tree */ /* create posted tree */
yourTopics = ui.groupTreeWidget->addCategoryItem(tr("My Topics"), QIcon(IMAGE_FOLDER), true); yourTopics = ui.groupTreeWidget->addCategoryItem(tr("My Topics"), QIcon(IMAGE_FOLDER), true);
subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true); subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true);
allTopics = ui.groupTreeWidget->addCategoryItem(tr("All Topics"), QIcon(IMAGE_FOLDERGREEN), false); popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false);
//otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false); otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
ui.hotSortButton->setChecked(true); ui.hotSortButton->setChecked(true);
@ -181,8 +181,6 @@ void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/)
action->setEnabled(!isSubscribed); action->setEnabled(!isSubscribed);
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Unsubscribe"), this, SLOT(unsubscribeTopic())); action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Unsubscribe"), this, SLOT(unsubscribeTopic()));
action->setEnabled(isSubscribed); action->setEnabled(isSubscribed);
action = contextMnu.addAction(QIcon(IMAGE_FOLDERGREEN), tr("New Child-Group"), this, SLOT(newSubTopic()));
action->setEnabled(isSubscribed);
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
@ -363,23 +361,6 @@ void PostedListDialog::newTopic()
PostedGroupDialog cf (mPostedQueue, this); PostedGroupDialog cf (mPostedQueue, this);
cf.exec (); cf.exec ();
} }
void PostedListDialog::newSubTopic()
{
std::cerr << "mCurrTopicId: " << mCurrTopicId << std::endl;
PostedGroupDialog cf (mPostedQueue, this);
cf.setParentLabel(mCurrTopicId.c_str());
cf.exec ();
/*
if (mCurrTopicId.empty()) {
return;
}
RsPostedGroup grp;
grp.mMeta.mParentGroupId = mCurrTopicId;
PostedGroupDialog cf (grp, this);
GxsForumGroupDialog cf(grp, GxsGroupDialog::MODE_SHOW, this);
cf.exec ();*/
}
void PostedListDialog::showGroupDetails() void PostedListDialog::showGroupDetails()
{ {
@ -942,16 +923,17 @@ void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
groupItemInfo.popularity = groupInfo.mPop; groupItemInfo.popularity = groupInfo.mPop;
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost); groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags; groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
groupItemInfo.parentId = QString::fromStdString(groupInfo.mParentGrpId);
} }
void PostedListDialog::insertGroupData( std::list<RsGroupMetaData> &groupList) void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupList)
{ {
std::list<RsGroupMetaData>::const_iterator it; std::list<RsGroupMetaData>::const_iterator it;
QList<GroupItemInfo> adminList; QList<GroupItemInfo> adminList;
QList<GroupItemInfo> subList; QList<GroupItemInfo> subList;
QList<GroupItemInfo> completeList; QList<GroupItemInfo> popList;
QList<GroupItemInfo> otherList;
std::multimap<uint32_t, GroupItemInfo> popMap;
for (it = groupList.begin(); it != groupList.end(); it++) for (it = groupList.begin(); it != groupList.end(); it++)
{ {
@ -961,8 +943,6 @@ void PostedListDialog::insertGroupData( std::list<RsGroupMetaData> &groupList)
GroupItemInfo groupItemInfo; GroupItemInfo groupItemInfo;
groupInfoToGroupItemInfo(*it, groupItemInfo); groupInfoToGroupItemInfo(*it, groupItemInfo);
completeList.push_back(groupItemInfo);
if (IS_GROUP_SUBSCRIBED(flags)) if (IS_GROUP_SUBSCRIBED(flags))
{ {
if (IS_GROUP_ADMIN(flags) || IS_GROUP_PUBLISHER(flags)) if (IS_GROUP_ADMIN(flags) || IS_GROUP_PUBLISHER(flags))
@ -974,12 +954,40 @@ void PostedListDialog::insertGroupData( std::list<RsGroupMetaData> &groupList)
subList.push_back(groupItemInfo); subList.push_back(groupItemInfo);
} }
} }
else
{
popMap.insert(std::make_pair(it->mPop, groupItemInfo));
}
}
/* iterate backwards through popMap - take the top 5 or 10% of list */
uint32_t popCount = 5;
if (popCount < popMap.size() / 10)
{
popCount = popMap.size() / 10;
}
uint32_t i = 0;
uint32_t popLimit = 0;
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
if (rit != popMap.rend()) {
popLimit = rit->first;
}
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
if (rit->second.popularity < (int) popLimit) {
otherList.append(rit->second);
} else {
popList.append(rit->second);
}
} }
/* now we can add them in as a tree! */ /* now we can add them in as a tree! */
ui.groupTreeWidget->fillGroupItems(yourTopics, adminList); ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList); ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
ui.groupTreeWidget->fillGroupItems(allTopics, completeList); ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
} }
/**************************************************************************************/ /**************************************************************************************/

View File

@ -66,7 +66,6 @@ private slots:
void changedTopic(const QString &id); void changedTopic(const QString &id);
void newTopic(); void newTopic();
void newSubTopic();
void showGroupDetails(); void showGroupDetails();
void newPost(); void newPost();
@ -127,7 +126,7 @@ private:
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds); void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
void updateCurrentDisplayComplete(const uint32_t& token); void updateCurrentDisplayComplete(const uint32_t& token);
void insertGroupData(std::list<RsGroupMetaData> &groupList); void insertGroupData(const std::list<RsGroupMetaData> &groupList);
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
@ -135,7 +134,8 @@ private:
private: private:
QTreeWidgetItem *yourTopics; QTreeWidgetItem *yourTopics;
QTreeWidgetItem *subscribedTopics; QTreeWidgetItem *subscribedTopics;
QTreeWidgetItem *allTopics; QTreeWidgetItem *popularTopics;
QTreeWidgetItem *otherTopics;
int mSortMethod; int mSortMethod;
int mLastSortMethod; int mLastSortMethod;

View File

@ -21,8 +21,6 @@
#include <QMenu> #include <QMenu>
#include <QToolButton> #include <QToolButton>
#include <QMutableListIterator>
#include <QDebug>
#include "GroupTreeWidget.h" #include "GroupTreeWidget.h"
#include "ui_GroupTreeWidget.h" #include "ui_GroupTreeWidget.h"
@ -33,7 +31,6 @@
#include "RSTreeWidgetItem.h" #include "RSTreeWidgetItem.h"
#include <stdint.h> #include <stdint.h>
#include <iostream>
#define COLUMN_NAME 0 #define COLUMN_NAME 0
#define COLUMN_POPULARITY 1 #define COLUMN_POPULARITY 1
@ -48,7 +45,6 @@
#define ROLE_SEARCH_SCORE Qt::UserRole + 5 #define ROLE_SEARCH_SCORE Qt::UserRole + 5
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 6 #define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 6
#define ROLE_COLOR Qt::UserRole + 7 #define ROLE_COLOR Qt::UserRole + 7
#define ROLE_PARENT_ID Qt::UserRole + 8
#define FILTER_NAME_INDEX 0 #define FILTER_NAME_INDEX 0
#define FILTER_DESC_INDEX 1 #define FILTER_DESC_INDEX 1
@ -303,38 +299,6 @@ QString GroupTreeWidget::itemId(QTreeWidgetItem *item)
return item->data(COLUMN_DATA, ROLE_ID).toString(); return item->data(COLUMN_DATA, ROLE_ID).toString();
} }
QTreeWidgetItem* GroupTreeWidget::recursiveIdSearch(QTreeWidgetItem *currentItem, const QString &id){
int childCount = currentItem->childCount();
for (int child = 0; child < childCount; child++) {
QTreeWidgetItem *childItem = currentItem->child(child);
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == id) {
/* Found child */
return childItem;
}
QTreeWidgetItem* recur = recursiveIdSearch(childItem, id);
if(recur) return recur;
}
return NULL;
}
void GroupTreeWidget::checkOrphans(QList<QTreeWidgetItem *> &orphanList, QTreeWidgetItem *justInserted){
if(orphanList.length()==0)return;
QString newID = justInserted->data(COLUMN_DATA, ROLE_ID).toString();
QList<QTreeWidgetItem *> oList = orphanList;
QMutableListIterator<QTreeWidgetItem *> i(oList);
while (i.hasNext()) {
QTreeWidgetItem *orphan = i.next();
QString parentID = orphan->data(COLUMN_DATA, ROLE_PARENT_ID).toString();
if (parentID.compare(newID)==0){
justInserted->addChild(orphan);
i.remove();
checkOrphans(orphanList,orphan);
}
}
}
void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList) void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList)
{ {
if (categoryItem == NULL) { if (categoryItem == NULL) {
@ -343,32 +307,28 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
QString filterText = ui->filterLineEdit->text(); QString filterText = ui->filterLineEdit->text();
QList<QTreeWidgetItem *> orphans;
/* Iterate all items */ /* Iterate all items */
QList<GroupItemInfo>::const_iterator it; QList<GroupItemInfo>::const_iterator it;
for (it = itemList.begin(); it != itemList.end(); it++) { for (it = itemList.begin(); it != itemList.end(); it++) {
const GroupItemInfo &itemInfo = *it; const GroupItemInfo &itemInfo = *it;
QTreeWidgetItem *item = recursiveIdSearch(categoryItem, itemInfo.id); QTreeWidgetItem *item = NULL;
/* Search exisiting item */
int childCount = categoryItem->childCount();
for (int child = 0; child < childCount; child++) {
QTreeWidgetItem *childItem = categoryItem->child(child);
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == itemInfo.id) {
/* Found child */
item = childItem;
break;
}
}
if (item == NULL) { if (item == NULL) {
item = new RSTreeWidgetItem(compareRole); item = new RSTreeWidgetItem(compareRole);
item->setData(COLUMN_DATA, ROLE_ID, itemInfo.id); item->setData(COLUMN_DATA, ROLE_ID, itemInfo.id);
item->setData(COLUMN_DATA, ROLE_PARENT_ID, itemInfo.parentId);
if(itemInfo.parentId.length()<10){
categoryItem->addChild(item); categoryItem->addChild(item);
checkOrphans(orphans,item);
}else{
QTreeWidgetItem *parentItem = recursiveIdSearch(categoryItem, itemInfo.parentId);
if(parentItem){
parentItem->addChild(item);
checkOrphans(orphans,item);
}else{
orphans.append(item);
}
}
} }
item->setText(COLUMN_NAME, itemInfo.name); item->setText(COLUMN_NAME, itemInfo.name);
@ -411,16 +371,6 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
calculateScore(item, filterText); calculateScore(item, filterText);
} }
/* Add remaning topics whose parents are unknown */
QMutableListIterator<QTreeWidgetItem *> i(orphans);
while (i.hasNext()) {
QTreeWidgetItem *orphan = i.next();
categoryItem->addChild(orphan);
std::cerr << "adding orphan\n"<< orphan->data(COLUMN_DATA, ROLE_PARENT_ID).toString().toStdString() <<"\n";
std::cerr << orphan->data(COLUMN_DATA, ROLE_ID).toString().toStdString() <<"\n";
std::cerr << "\n";
}
/* Remove all items not in list */ /* Remove all items not in list */
int child = 0; int child = 0;
int childCount = categoryItem->childCount(); int childCount = categoryItem->childCount();
@ -441,7 +391,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
} }
} }
resort(categoryItem, NULL); resort(categoryItem);
} }
void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount) void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount)
@ -516,20 +466,14 @@ int GroupTreeWidget::subscribeFlags(const QString &id)
return item->data(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS).toInt(); return item->data(COLUMN_DATA, ROLE_SUBSCRIBE_FLAGS).toInt();
} }
int GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filterText) void GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filterText)
{ {
if (item) {
int score = 0;
if (!item) return score;
/* Calculate one item */ /* Calculate one item */
int score;
if (filterText.isEmpty()) { if (filterText.isEmpty()) {
score = 0; score = 0;
item->setHidden(false); item->setHidden(false);
int count = item->childCount();
for (int nIndex = 0; nIndex < count; ++nIndex) {
calculateScore(item->child(nIndex), filterText);
}
} else { } else {
QString scoreString; QString scoreString;
@ -544,11 +488,6 @@ int GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filter
score = scoreString.count(filterText, Qt::CaseInsensitive); score = scoreString.count(filterText, Qt::CaseInsensitive);
int count = item->childCount();
for (int nIndex = 0; nIndex < count; ++nIndex) {
score += calculateScore(item->child(nIndex), filterText);
}
if (score) { if (score) {
item->setHidden(false); item->setHidden(false);
} else { } else {
@ -558,38 +497,34 @@ int GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filter
item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, -score); // negative for correct sorting item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, -score); // negative for correct sorting
return score; return;
} }
void GroupTreeWidget::calculateScores(const QString &filterText)
{
/* Find out which has given word in it */ /* Find out which has given word in it */
QTreeWidgetItemIterator itemIterator(ui->treeWidget); QTreeWidgetItemIterator itemIterator(ui->treeWidget);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
int count = ui->treeWidget->topLevelItemCount(); if (item->data(COLUMN_DATA, ROLE_ID).toString().isEmpty()) {
for (int child = 0; child < count; child++) { continue;
QTreeWidgetItem *catitem = ui->treeWidget->topLevelItem(child);
int icount = catitem->childCount();
for (int nIndex = 0; nIndex < icount; ++nIndex) {
calculateScore(catitem->child(nIndex), filterText);
} }
calculateScore(item, filterText);
} }
} }
void GroupTreeWidget::filterChanged() void GroupTreeWidget::filterChanged()
{ {
/* Recalculate score */ /* Recalculate score */
calculateScores(ui->filterLineEdit->text()); calculateScore(NULL, ui->filterLineEdit->text());
sort(); resort(NULL);
} }
void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem, Qt::SortOrder *order) void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem)
{ {
if(order == NULL){ Qt::SortOrder order = (actionSortAscending == NULL || actionSortAscending->isChecked()) ? Qt::AscendingOrder : Qt::DescendingOrder;
Qt::SortOrder so = (actionSortAscending == NULL || actionSortAscending->isChecked()) ? Qt::AscendingOrder : Qt::DescendingOrder;
order = &so;
if (ui->filterLineEdit->text().isEmpty() == false) { if (ui->filterLineEdit->text().isEmpty() == false) {
compareRole->setRole(COLUMN_DATA, ROLE_SEARCH_SCORE); compareRole->setRole(COLUMN_DATA, ROLE_SEARCH_SCORE);
@ -601,19 +536,18 @@ void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem, Qt::SortOrder *order
} else if (actionSortByLastPost && actionSortByLastPost->isChecked()) { } else if (actionSortByLastPost && actionSortByLastPost->isChecked()) {
compareRole->setRole(COLUMN_DATA, ROLE_LASTPOST); compareRole->setRole(COLUMN_DATA, ROLE_LASTPOST);
} }
}
categoryItem->sortChildren(COLUMN_DATA, *order); if (categoryItem) {
int count = categoryItem->childCount(); categoryItem->sortChildren(COLUMN_DATA, order);
} else {
int count = ui->treeWidget->topLevelItemCount();
for (int child = 0; child < count; child++) { for (int child = 0; child < count; child++) {
resort(categoryItem->child(child), order); ui->treeWidget->topLevelItem(child)->sortChildren(COLUMN_DATA, order);
}
} }
} }
void GroupTreeWidget::sort() void GroupTreeWidget::sort()
{ {
int count = ui->treeWidget->topLevelItemCount(); resort(NULL);
for (int child = 0; child < count; child++) {
resort(ui->treeWidget->topLevelItem(child), NULL);
}
} }

View File

@ -55,7 +55,6 @@ public:
QString id; QString id;
QString name; QString name;
QString description; QString description;
QString parentId;
int popularity; int popularity;
QDateTime lastpost; QDateTime lastpost;
QIcon icon; QIcon icon;
@ -86,8 +85,6 @@ public:
QString itemId(QTreeWidgetItem *item); QString itemId(QTreeWidgetItem *item);
// Fill items of a group // Fill items of a group
void fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList); void fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList);
QTreeWidgetItem *recursiveIdSearch(QTreeWidgetItem *currentItem, const QString &id);
void checkOrphans(QList<QTreeWidgetItem *> &orphanList, QTreeWidgetItem *justInserted);
// Set the unread count of an item // Set the unread count of an item
void setUnreadCount(QTreeWidgetItem *item, int unreadCount); void setUnreadCount(QTreeWidgetItem *item, int unreadCount);
@ -123,9 +120,8 @@ private slots:
private: private:
// Initialize the display menu for sorting // Initialize the display menu for sorting
void initDisplayMenu(QToolButton *toolButton); void initDisplayMenu(QToolButton *toolButton);
int calculateScore(QTreeWidgetItem *item, const QString &filterText); void calculateScore(QTreeWidgetItem *item, const QString &filterText);
void calculateScores(const QString &filterText); void resort(QTreeWidgetItem *categoryItem);
void resort(QTreeWidgetItem *categoryItem, Qt::SortOrder *order);
void updateColors(); void updateColors();
private: private:

View File

@ -94,8 +94,6 @@ void GxsGroupDialog::init()
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height()); this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
} }
ui.parentGroupBox->setVisible(false);
/* initialize key share list */ /* initialize key share list */
ui.keyShareList->setHeaderText(tr("Contacts:")); ui.keyShareList->setHeaderText(tr("Contacts:"));
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK); ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
@ -151,12 +149,12 @@ void GxsGroupDialog::initMode()
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close); ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
} }
break; break;
//TODO case MODE_EDIT:
// case MODE_EDIT: {
// { ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
// ui.createButton->setText(tr("Submit Changes")); ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
// } }
// break; break;
} }
} }
@ -323,16 +321,39 @@ void GxsGroupDialog::submitGroup()
case MODE_EDIT: case MODE_EDIT:
{ {
/* TEMP: just close if down */
cancelDialog(); editGroup();
} }
break; break;
} }
} }
void GxsGroupDialog::setParentLabel(QString parentId){ void GxsGroupDialog::editGroup()
ui.parentGroupBox->setVisible(true); {
ui.parentLabel->setText(parentId); std::cerr << "GxsGroupDialog::editGroup()" << std::endl;
QString name = misc::removeNewLine(ui.groupName->text());
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
if(name.isEmpty())
{
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
uint32_t token;
RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId);
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME, std::string(name.toUtf8()));
if (service_EditGroup(token, updateMeta))
{
// get the Queue to handle response.
if(mTokenQueue != NULL)
mTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
}
close();
} }
void GxsGroupDialog::createGroup() void GxsGroupDialog::createGroup()
@ -341,7 +362,6 @@ void GxsGroupDialog::createGroup()
std::cerr << std::endl; std::cerr << std::endl;
QString name = misc::removeNewLine(ui.groupName->text()); QString name = misc::removeNewLine(ui.groupName->text());
QString parentGroupId = misc::removeNewLine(ui.parentLabel->text());
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC; uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
if(name.isEmpty()) if(name.isEmpty())
@ -356,8 +376,6 @@ void GxsGroupDialog::createGroup()
// Fill in the MetaData as best we can. // Fill in the MetaData as best we can.
meta.mGroupName = std::string(name.toUtf8()); meta.mGroupName = std::string(name.toUtf8());
if(parentGroupId.length()>10)
meta.mParentGrpId = parentGroupId.toStdString();
meta.mGroupFlags = flags; meta.mGroupFlags = flags;
meta.mSignFlags = getGroupSignFlags(); meta.mSignFlags = getGroupSignFlags();

View File

@ -143,7 +143,6 @@ public:
uint32_t mode() { return mMode; } uint32_t mode() { return mMode; }
void setParentLabel(QString parentId);
private: private:
void newGroup(); void newGroup();
void init(); void init();
@ -156,8 +155,6 @@ protected slots:
void addGroupLogo(); void addGroupLogo();
protected: protected:
/** Qt Designer generated object */
Ui::GxsGroupDialog ui;
virtual void showEvent(QShowEvent*); virtual void showEvent(QShowEvent*);
virtual void initUi() = 0; virtual void initUi() = 0;
@ -166,13 +163,21 @@ protected:
void setUiText(UiType uiType, const QString &text); void setUiText(UiType uiType, const QString &text);
/*! /*!
* Main purpose is to help tansfer meta data to service * It is up to the service to do the actual group creation
* * Service can also modify initial meta going into group
* @param token This should be set to the token retrieved * @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value * @param meta The deriving GXS service should set their grp meta to this value
*/ */
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0; virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0;
/*!
* It is up to the service to do the actual group editing
* TODO: make pure virtual
* @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value
*/
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) {}
/*! /*!
* This returns a group logo from the ui \n * This returns a group logo from the ui \n
* Should be calleld by deriving service * Should be calleld by deriving service
@ -205,6 +210,7 @@ private:
void setupVisibility(); void setupVisibility();
void clearForm(); void clearForm();
void createGroup(); void createGroup();
void editGroup();
void sendShareList(std::string forumId); void sendShareList(std::string forumId);
void loadNewGroupId(const uint32_t &token); void loadNewGroupId(const uint32_t &token);
@ -218,7 +224,10 @@ private:
uint32_t mReadonlyFlags; uint32_t mReadonlyFlags;
uint32_t mDefaultsFlags; uint32_t mDefaultsFlags;
protected:
/** Qt Designer generated object */
Ui::GxsGroupDialog ui;
}; };
#endif #endif

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>695</width> <width>695</width>
<height>518</height> <height>448</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -156,7 +156,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="0" column="1" rowspan="7"> <item row="0" column="1" rowspan="6">
<widget class="QDockWidget" name="contactsdockWidget"> <widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -257,7 +257,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="distribGroupBox"> <widget class="QGroupBox" name="distribGroupBox">
<property name="title"> <property name="title">
<string>Message Distribution</string> <string>Message Distribution</string>
@ -323,7 +323,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<widget class="QGroupBox" name="publishGroupBox"> <widget class="QGroupBox" name="publishGroupBox">
<property name="title"> <property name="title">
<string>Publish Signatures</string> <string>Publish Signatures</string>
@ -366,7 +366,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="4" column="0">
<widget class="QGroupBox" name="personalGroupBox"> <widget class="QGroupBox" name="personalGroupBox">
<property name="title"> <property name="title">
<string>Personal Signatures</string> <string>Personal Signatures</string>
@ -402,7 +402,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="0"> <item row="5" column="0">
<widget class="QGroupBox" name="commentGroupBox"> <widget class="QGroupBox" name="commentGroupBox">
<property name="title"> <property name="title">
<string>Comments</string> <string>Comments</string>
@ -431,7 +431,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QFrame" name="extraFrame"> <widget class="QFrame" name="extraFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
@ -441,40 +441,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0" colspan="2"> <item row="7" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QGroupBox" name="parentGroupBox">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QLabel" name="prLabel">
<property name="text">
<string>Parent: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="parentLabel">
<property name="text">
<string>None</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -506,6 +479,7 @@
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>