Improved GxsGroupDialog for Show / Edit of Groups.

- Added Show/Edit Menu Options for all services.
 - Fixed up BUTTONBOX_OK bugs.
 - Tested name changes for all services.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7102 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-02-09 10:43:59 +00:00
parent d9e483c48a
commit d65bdca1ec
15 changed files with 408 additions and 109 deletions

View file

@ -91,6 +91,9 @@ CreateCircleDialog::~CreateCircleDialog()
void CreateCircleDialog::editExistingId(std::string circleId) void CreateCircleDialog::editExistingId(std::string circleId)
{ {
std::cerr << "CreateCircleDialog::editExistingId() : " << circleId;
std::cerr << std::endl;
/* load this circle */ /* load this circle */
mIsExistingCircle = true; mIsExistingCircle = true;
requestCircle(circleId); requestCircle(circleId);
@ -340,6 +343,10 @@ void CreateCircleDialog::createCircle()
circle.mMeta.mCircleId = ""; circle.mMeta.mCircleId = "";
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL; circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
} }
std::cerr << "CreateCircleDialog::createCircle() : mCircleType: " << circle.mMeta.mCircleType;
std::cerr << std::endl;
std::cerr << "CreateCircleDialog::createCircle() : mCircleId: " << circle.mMeta.mCircleId;
std::cerr << std::endl;
std::cerr << "CreateCircleDialog::createCircle() Checks and Balances Okay - calling service proper.."; std::cerr << "CreateCircleDialog::createCircle() Checks and Balances Okay - calling service proper..";
std::cerr << std::endl; std::cerr << std::endl;
@ -358,16 +365,31 @@ void CreateCircleDialog::updateCircleGUI()
ui.circleName->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str())); ui.circleName->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str()));
bool isExternal = true; bool isExternal = true;
std::cerr << "CreateCircleDialog::updateCircleGUI() : CIRCLETYPE: " << mCircleGroup.mMeta.mCircleType;
std::cerr << std::endl;
switch(mCircleGroup.mMeta.mCircleType) switch(mCircleGroup.mMeta.mCircleType)
{ {
case GXS_CIRCLE_TYPE_LOCAL: case GXS_CIRCLE_TYPE_LOCAL:
std::cerr << "CreateCircleDialog::updateCircleGUI() : LOCAL CIRCLETYPE";
std::cerr << std::endl;
isExternal = false; isExternal = false;
break; break;
case GXS_CIRCLE_TYPE_PUBLIC: case GXS_CIRCLE_TYPE_PUBLIC:
std::cerr << "CreateCircleDialog::updateCircleGUI() : PUBLIC CIRCLETYPE";
std::cerr << std::endl;
ui.radioButton_Public->setChecked(true); ui.radioButton_Public->setChecked(true);
break; break;
case GXS_CIRCLE_TYPE_EXT_SELF: case GXS_CIRCLE_TYPE_EXT_SELF:
std::cerr << "CreateCircleDialog::updateCircleGUI() : EXT_SELF CIRCLE (fallthrough)";
std::cerr << std::endl;
case GXS_CIRCLE_TYPE_EXTERNAL: case GXS_CIRCLE_TYPE_EXTERNAL:
std::cerr << "CreateCircleDialog::updateCircleGUI() : EXTERNAL CIRCLETYPE";
std::cerr << std::endl;
if (mCircleGroup.mMeta.mCircleId == mCircleGroup.mMeta.mGroupId) if (mCircleGroup.mMeta.mCircleId == mCircleGroup.mMeta.mGroupId)
{ {
ui.radioButton_Self->setChecked(true); ui.radioButton_Self->setChecked(true);
@ -443,7 +465,7 @@ void CreateCircleDialog::loadCircle(uint32_t token)
return; return;
} }
std::cerr << "CreateCircleDialog::loadCircle() Unfinished Loading"; std::cerr << "CreateCircleDialog::loadCircle() LoadedGroup.meta: " << mCircleGroup.mMeta;
std::cerr << std::endl; std::cerr << std::endl;
mCircleGroup = groups[0]; mCircleGroup = groups[0];

View file

@ -73,18 +73,19 @@ void PostedGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Topic"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic")); setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic"));
break; break;
case MODE_EDIT: case MODE_EDIT:
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Topic")); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Topic"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Topic"));
break; break;
} }
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Topic Admins")); setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Topic Admins"));
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Topic Admins")); setUiText(UITYPE_CONTACTS_DOCK, tr("Select Topic Admins"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Topic"));
} }
QPixmap PostedGroupDialog::serviceImage() QPixmap PostedGroupDialog::serviceImage()
@ -106,8 +107,46 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
return true; return true;
} }
bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) bool PostedGroupDialog::service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta)
{ {
return false; RsPostedGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
std::cerr << "PostedGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl;
rsPosted->updateGroup(token, updateMeta, grp);
return true;
}
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{
std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsPostedGroup> groups;
if (!rsPosted->getGroupData(token, groups))
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
return true;
} }

View file

@ -39,7 +39,10 @@ protected:
virtual void initUi(); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta); virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta);
private: private:
RsPostedGroup mTopic; RsPostedGroup mTopic;

View file

@ -38,12 +38,14 @@
*/ */
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_MESSAGE ":/images/folder-draft.png" #define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_SUBSCRIBE ":/images/edit_add24.png" #define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
#define IMAGE_UNSUBSCRIBE ":/images/cancel.png" #define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
#define IMAGE_SHOW ":/images/info16.png"
#define IMAGE_EDIT ":/images/settings16.png"
/* Images for TreeWidget */ /* Images for TreeWidget */
#define IMAGE_FOLDER ":/images/folder16.png" #define IMAGE_FOLDER ":/images/folder16.png"
#define IMAGE_FOLDERGREEN ":/images/folder_green.png" #define IMAGE_FOLDERGREEN ":/images/folder_green.png"
#define IMAGE_FOLDERRED ":/images/folder_red.png" #define IMAGE_FOLDERRED ":/images/folder_red.png"
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png" #define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
@ -51,7 +53,7 @@
// token types to deal with // token types to deal with
#define POSTED_DEFAULT_LISTING_LENGTH 10 #define POSTED_DEFAULT_LISTING_LENGTH 10
#define POSTED_MAX_INDEX 10000 #define POSTED_MAX_INDEX 10000
/** Constructor */ /** Constructor */
PostedListDialog::PostedListDialog(QWidget *parent) PostedListDialog::PostedListDialog(QWidget *parent)
@ -186,6 +188,14 @@ void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/)
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeTopic())); action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe"), this, SLOT(unsubscribeTopic()));
action->setEnabled(isSubscribed); action->setEnabled(isSubscribed);
contextMnu.addSeparator();
action = contextMnu.addAction(QIcon(IMAGE_SHOW), tr("Show Topic Details"), this, SLOT(showTopic()));
action->setEnabled (!mCurrTopicId.empty());
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Topic Details"), this, SLOT(editTopic()));
action->setEnabled (!mCurrTopicId.empty() && IS_GROUP_ADMIN(subscribeFlags));
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
@ -366,6 +376,26 @@ void PostedListDialog::newTopic()
cf.exec (); cf.exec ();
} }
void PostedListDialog::showTopic()
{
if (mCurrTopicId.empty()) {
return;
}
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_SHOW, mCurrTopicId, this);
cf.exec ();
}
void PostedListDialog::editTopic()
{
if (mCurrTopicId.empty()) {
return;
}
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_EDIT, mCurrTopicId, this);
cf.exec ();
}
void PostedListDialog::showGroupDetails() void PostedListDialog::showGroupDetails()
{ {
if (mCurrTopicId.empty()) if (mCurrTopicId.empty())

View file

@ -66,6 +66,9 @@ private slots:
void changedTopic(const QString &id); void changedTopic(const QString &id);
void newTopic(); void newTopic();
void showTopic();
void editTopic();
void showGroupDetails(); void showGroupDetails();
void newPost(); void newPost();

View file

@ -192,6 +192,9 @@ void WikiDialog::showGroupDetails()
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_SHOW, groupId, this);
cf.exec ();
} }
void WikiDialog::editGroupDetails() void WikiDialog::editGroupDetails()
@ -204,11 +207,8 @@ void WikiDialog::editGroupDetails()
return; return;
} }
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_EDIT, groupId, this);
//WikiGroupDialog cf (this); cf.exec ();
//cf.existingGroup(groupId, GXS_GROUP_DIALOG_EDIT_MODE);
//cf.exec ();
} }
@ -630,7 +630,12 @@ void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Group"), this, SLOT(unsubscribeToGroup())); action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Group"), this, SLOT(unsubscribeToGroup()));
action->setEnabled (!mGroupId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags)); action->setEnabled (!mGroupId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags));
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Group"), this, SLOT(editGroupDetails())); contextMnu.addSeparator();
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Wiki Group"), this, SLOT(showGroupDetails()));
action->setEnabled (!mGroupId.empty ());
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Wiki Group"), this, SLOT(editGroupDetails()));
action->setEnabled (!mGroupId.empty() && IS_GROUP_ADMIN(subscribeFlags)); action->setEnabled (!mGroupId.empty() && IS_GROUP_ADMIN(subscribeFlags));
/************** NOT ENABLED YET *****************/ /************** NOT ENABLED YET *****************/
@ -642,16 +647,6 @@ void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
// } // }
//} //}
//contextMnu.addSeparator();
//contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
//action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
//action->setEnabled (!mForumId.empty ());
//action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
//action->setEnabled (!mForumId.empty () && IS_GROUP_ADMIN(subscribeFlags));
//QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu); //QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
//connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) ); //connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
//shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags)); //shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags));

View file

@ -346,6 +346,7 @@ void GxsGroupDialog::setupReadonly()
{ {
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN)); ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
} }
{ {
@ -385,7 +386,6 @@ void GxsGroupDialog::updateFromExistingMeta()
/* setup name */ /* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str())); ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
bool isExternal = true;
switch(mGrpMeta.mCircleType) switch(mGrpMeta.mCircleType)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUREYESONLY:
@ -407,7 +407,6 @@ void GxsGroupDialog::updateFromExistingMeta()
} }
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId); ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
updateCircleOptions(); updateCircleOptions();
} }
@ -445,33 +444,165 @@ void GxsGroupDialog::submitGroup()
void GxsGroupDialog::editGroup() void GxsGroupDialog::editGroup()
{ {
std::cerr << "GxsGroupDialog::editGroup()" << std::endl; std::cerr << "GxsGroupDialog::editGroup()" << std::endl;
QString name = misc::removeNewLine(ui.groupName->text()); RsGroupMetaData newMeta;
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC; newMeta.mGroupId = mGrpMeta.mGroupId;
if(name.isEmpty()) if(!prepareGroupMetaData(newMeta))
{ {
/* error message */ /* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!! return; //Don't add a empty name!!
} }
std::cerr << "GxsGroupDialog::editGroup() Unfinished" << std::endl; RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId);
#if 0 if (!buildUpdateMeta(mGrpMeta, newMeta, updateMeta))
uint32_t token; {
RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId); /* error message */
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME, std::string(name.toUtf8())); QMessageBox::warning(this, "RetroShare", tr("Failed to Build UpdateMeta - Attempted to change field that is not allowed"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
if (service_EditGroup(token, updateMeta)) std::cerr << "GxsGroupDialog::editGroup() calling service_EditGroup";
{ std::cerr << std::endl;
// get the Queue to handle response.
if(mExternalTokenQueue != NULL)
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
}
#endif
close(); uint32_t token;
if (service_EditGroup(token, updateMeta, newMeta))
{
// get the Queue to handle response.
if(mExternalTokenQueue != NULL)
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
}
else
{
std::cerr << "GxsGroupDialog::editGroup() ERROR";
std::cerr << std::endl;
}
close();
}
bool GxsGroupDialog::buildUpdateMeta(
const RsGroupMetaData &origMeta,
const RsGroupMetaData &newMeta,
RsGxsGroupUpdateMeta &updateMeta)
{
/* check through the fields, and note which have changed */
if (origMeta.mGroupId != newMeta.mGroupId)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " GroupId Mismatch";
std::cerr << std::endl;
return false;
}
if (origMeta.mGroupName != newMeta.mGroupName)
{
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME,
newMeta.mGroupName);
}
// These are not allowed to be changed yet!
bool metaOk = true;
if (origMeta.mGroupFlags != newMeta.mGroupFlags)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " GroupFlags Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mSignFlags != newMeta.mSignFlags)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " SignFlags Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mAuthorId != newMeta.mAuthorId)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " AuthorId Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mAuthenFlags != newMeta.mAuthenFlags)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " AuthenFlags Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mParentGrpId != newMeta.mParentGrpId)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " ParentGrpId Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mCircleType != newMeta.mCircleType)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " CircleType Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mCircleId != newMeta.mCircleId)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " CircleId Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
if (origMeta.mInternalCircle != newMeta.mInternalCircle)
{
std::cerr << "GxsGroupDialog::buildUpdateMeta()";
std::cerr << " InternalCircle Differences - Not Allowed";
std::cerr << std::endl;
metaOk = false;
}
return metaOk;
}
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
{
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << std::endl;
QString name = misc::removeNewLine(ui.groupName->text());
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
if(name.isEmpty())
{
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Invalid GroupName";
std::cerr << std::endl;
return false;
}
// Fill in the MetaData as best we can.
meta.mGroupName = std::string(name.toUtf8());
meta.mGroupFlags = flags;
meta.mSignFlags = getGroupSignFlags();
if (!setCircleParameters(meta))
{
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
std::cerr << " Invalid Circles";
std::cerr << std::endl;
return false;
}
std::cerr << "void GxsGroupDialog::prepareGroupMetaData() meta.mCircleType: ";
std::cerr << meta.mCircleType << " Internal: " << meta.mInternalCircle;
std::cerr << " External: " << meta.mCircleId;
std::cerr << std::endl;
ui.idChooser->getChosenId(meta.mAuthorId);
return true;
} }
void GxsGroupDialog::createGroup() void GxsGroupDialog::createGroup()
@ -480,7 +611,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());
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
if(name.isEmpty()) if(name.isEmpty())
{ {
@ -491,27 +621,13 @@ void GxsGroupDialog::createGroup()
uint32_t token; uint32_t token;
RsGroupMetaData meta; RsGroupMetaData meta;
if (!prepareGroupMetaData(meta))
// Fill in the MetaData as best we can.
meta.mGroupName = std::string(name.toUtf8());
meta.mGroupFlags = flags;
meta.mSignFlags = getGroupSignFlags();
if (!setCircleParameters(meta))
{ {
/* error message */ /* error message */
QMessageBox::warning(this, "RetroShare", tr("Invalid Circle Selection - Personal disabled for now"), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add with invalid circle. return; //Don't add with invalid circle.
} }
std::cerr << "void GxsGroupDialog::createGroup() meta.mCircleType: ";
std::cerr << meta.mCircleType << " Internal: " << meta.mInternalCircle;
std::cerr << " External: " << meta.mCircleId;
std::cerr << std::endl;
ui.idChooser->getChosenId(meta.mAuthorId);
if (service_CreateGroup(token, meta)) if (service_CreateGroup(token, meta))
{ {
// get the Queue to handle response. // get the Queue to handle response.
@ -694,6 +810,7 @@ QString GxsGroupDialog::getDescription()
void GxsGroupDialog::sendShareList(std::string groupId) void GxsGroupDialog::sendShareList(std::string groupId)
{ {
(void) groupId;
close(); close();
} }
@ -743,6 +860,9 @@ void GxsGroupDialog::loadGroup(uint32_t token)
bool GxsGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData) bool GxsGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{ {
(void) mode;
(void) groupMetaData;
std::cerr << "GxsGroupDialog::service_loadGroup(" << token << ") NOT IMPLEMENTED"; std::cerr << "GxsGroupDialog::service_loadGroup(" << token << ") NOT IMPLEMENTED";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;

View file

@ -180,7 +180,9 @@ protected:
* @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_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) = 0; virtual bool service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta) = 0;
// To be overloaded by users. // To be overloaded by users.
// use Token to retrieve from service, fill in metaData. // use Token to retrieve from service, fill in metaData.
@ -230,6 +232,13 @@ private:
void loadGroup(uint32_t token); void loadGroup(uint32_t token);
void updateFromExistingMeta(); void updateFromExistingMeta();
bool prepareGroupMetaData(RsGroupMetaData &meta);
bool buildUpdateMeta(
const RsGroupMetaData &origMeta,
const RsGroupMetaData &newMeta,
RsGxsGroupUpdateMeta &updateMeta);
std::list<std::string> mShareList; std::list<std::string> mShareList;
QPixmap picture; QPixmap picture;
RsTokenService *mTokenService; RsTokenService *mTokenService;

View file

@ -73,18 +73,19 @@ void WikiGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Wiki Group")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Wiki Group"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Group"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Wiki Group")); setUiText(UITYPE_SERVICE_HEADER, tr("Wiki Group"));
break; break;
case MODE_EDIT: case MODE_EDIT:
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Wiki Group")); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Wiki Group"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Group"));
break; break;
} }
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Wiki Moderators")); setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Wiki Moderators"));
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wiki Moderators")); setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wiki Moderators"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Group"));
} }
QPixmap WikiGroupDialog::serviceImage() QPixmap WikiGroupDialog::serviceImage()
@ -106,12 +107,45 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
return true; return true;
} }
bool WikiGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) bool WikiGroupDialog::service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta)
{ {
std::cerr << "WikiGroupDialog::service_EditGroup() UNFINISHED"; RsWikiCollection grp;
grp.mMeta = editedMeta;
std::cerr << "WikiGroupDialog::service_EditGroup() submitting changes.";
std::cerr << std::endl; std::cerr << std::endl;
return false; rsWiki->updateCollection(token, updateMeta, grp);
return true;
} }
bool WikiGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{
std::cerr << "WikiGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsWikiCollection> groups;
if (!rsWiki->getCollections(token, groups))
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "WikisGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
return true;
}

View file

@ -40,7 +40,10 @@ protected:
virtual void initUi(); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta); virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData& groupMetaData);
private: private:

View file

@ -244,18 +244,16 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
contextMnu.addAction( subscribechannelAct ); contextMnu.addAction( subscribechannelAct );
} }
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu);
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
contextMnu.addAction( channeldetailsAct );
if (isAdmin) if (isAdmin)
{ {
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu); QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) ); connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
contextMnu.addAction( editChannelDetailAct); contextMnu.addAction( editChannelDetailAct);
} }
else
{
QAction *channeldetailsAct = new QAction(QIcon(":/images/info16.png"), tr( "Show Channel Details" ), &contextMnu);
connect( channeldetailsAct , SIGNAL( triggered() ), this, SLOT( showChannelDetails() ) );
contextMnu.addAction( channeldetailsAct );
}
if (isPublisher) if (isPublisher)
{ {
@ -372,10 +370,12 @@ void GxsChannelDialog::openChat(std::string /*peerId*/)
void GxsChannelDialog::editChannelDetail() void GxsChannelDialog::editChannelDetail()
{ {
#if 0 if (mChannelId.empty()) {
EditChanDetails editUi(this, mChannelId); return;
editUi.exec(); }
#endif
GxsChannelGroupDialog cf(mChannelQueue, rsGxsChannels->getTokenService(), GxsGroupDialog::MODE_EDIT, mChannelId, this);
cf.exec ();
} }
void GxsChannelDialog::shareKey() void GxsChannelDialog::shareKey()
@ -799,22 +799,15 @@ void GxsChannelDialog::subscribeChannel()
void GxsChannelDialog::showChannelDetails() void GxsChannelDialog::showChannelDetails()
{ {
#if 0 if (mChannelId.empty()) {
if (mChannelId.empty()) { return;
return; }
}
if (!rsChannels) { GxsChannelGroupDialog cf(mChannelQueue, rsGxsChannels->getTokenService(), GxsGroupDialog::MODE_SHOW, mChannelId, this);
return; cf.exec ();
}
ChannelDetails channelui (this);
channelui.showDetails(mChannelId);
channelui.exec();
#endif
} }
void GxsChannelDialog::setAllAsReadClicked() void GxsChannelDialog::setAllAsReadClicked()
{ {
#if 0 #if 0

View file

@ -62,7 +62,7 @@ GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *pa
{ {
} }
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent) GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, parent) :GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, parent)
{ {
} }
@ -73,18 +73,19 @@ void GxsChannelGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Channel")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Channel"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Channel"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Channel")); setUiText(UITYPE_SERVICE_HEADER, tr("Channel"));
break; break;
case MODE_EDIT: case MODE_EDIT:
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Channel")); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Channel"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Channel"));
break; break;
} }
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Channel Admins")); setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Channel Admins"));
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Channel Admins")); setUiText(UITYPE_CONTACTS_DOCK, tr("Select Channel Admins"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Channel"));
} }
QPixmap GxsChannelGroupDialog::serviceImage() QPixmap GxsChannelGroupDialog::serviceImage()
@ -104,12 +105,46 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
} }
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token,
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta)
{ {
std::cerr << "GxsChannelGroupDialog::service_EditGroup() UNFINISHED"; RsGxsChannelGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl; std::cerr << std::endl;
return false; rsGxsChannels->updateGroup(token, updateMeta, grp);
return true;
}
bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsGxsChannelGroup> groups;
if (!rsGxsChannels->getGroupData(token, groups))
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
return true;
} }

View file

@ -31,13 +31,16 @@ class GxsChannelGroupDialog : public GxsGroupDialog
public: public:
GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent); GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL); GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent = NULL);
protected: protected:
virtual void initUi(); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta); virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta);
}; };

View file

@ -73,6 +73,7 @@ void GxsForumGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Forum"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Forum")); setUiText(UITYPE_SERVICE_HEADER, tr("Forum"));
@ -80,8 +81,12 @@ void GxsForumGroupDialog::initUi()
break; break;
case MODE_EDIT: case MODE_EDIT:
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Forum")); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Forum"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Forum"));
break; break;
} }
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Forum Admins"));
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Forum Admins"));
} }
QPixmap GxsForumGroupDialog::serviceImage() QPixmap GxsForumGroupDialog::serviceImage()
@ -100,14 +105,17 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
return true; return true;
} }
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) bool GxsForumGroupDialog::service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta)
{ {
std::cerr << "GxsForumGroupDialog::service_EditGroup() UNFINISHED";
std::cerr << std::endl;
RsGxsForumGroup grp; RsGxsForumGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8()); grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
std::cerr << "GxsForumGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl;
rsGxsForums->updateGroup(token, updateMeta, grp); rsGxsForums->updateGroup(token, updateMeta, grp);
return true; return true;
} }

View file

@ -37,8 +37,10 @@ protected:
virtual void initUi(); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData); virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGxsGroupUpdateMeta &updateMeta,
RsGroupMetaData &editedMeta);
}; };