mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-18 05:44:14 -05:00
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:
parent
d9e483c48a
commit
d65bdca1ec
@ -91,6 +91,9 @@ CreateCircleDialog::~CreateCircleDialog()
|
||||
|
||||
void CreateCircleDialog::editExistingId(std::string circleId)
|
||||
{
|
||||
std::cerr << "CreateCircleDialog::editExistingId() : " << circleId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* load this circle */
|
||||
mIsExistingCircle = true;
|
||||
requestCircle(circleId);
|
||||
@ -340,6 +343,10 @@ void CreateCircleDialog::createCircle()
|
||||
circle.mMeta.mCircleId = "";
|
||||
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 << std::endl;
|
||||
@ -358,16 +365,31 @@ void CreateCircleDialog::updateCircleGUI()
|
||||
ui.circleName->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str()));
|
||||
|
||||
bool isExternal = true;
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() : CIRCLETYPE: " << mCircleGroup.mMeta.mCircleType;
|
||||
std::cerr << std::endl;
|
||||
switch(mCircleGroup.mMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_LOCAL:
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() : LOCAL CIRCLETYPE";
|
||||
std::cerr << std::endl;
|
||||
|
||||
isExternal = false;
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_PUBLIC:
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() : PUBLIC CIRCLETYPE";
|
||||
std::cerr << std::endl;
|
||||
|
||||
ui.radioButton_Public->setChecked(true);
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_EXT_SELF:
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() : EXT_SELF CIRCLE (fallthrough)";
|
||||
std::cerr << std::endl;
|
||||
|
||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
||||
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() : EXTERNAL CIRCLETYPE";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mCircleGroup.mMeta.mCircleId == mCircleGroup.mMeta.mGroupId)
|
||||
{
|
||||
ui.radioButton_Self->setChecked(true);
|
||||
@ -443,7 +465,7 @@ void CreateCircleDialog::loadCircle(uint32_t token)
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "CreateCircleDialog::loadCircle() Unfinished Loading";
|
||||
std::cerr << "CreateCircleDialog::loadCircle() LoadedGroup.meta: " << mCircleGroup.mMeta;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mCircleGroup = groups[0];
|
||||
|
@ -73,18 +73,19 @@ void PostedGroupDialog::initUi()
|
||||
{
|
||||
case MODE_CREATE:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Topic"));
|
||||
break;
|
||||
case MODE_SHOW:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic"));
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Topic"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Topic"));
|
||||
break;
|
||||
}
|
||||
|
||||
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Topic Admins"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Topic Admins"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Topic"));
|
||||
}
|
||||
|
||||
QPixmap PostedGroupDialog::serviceImage()
|
||||
@ -106,8 +107,46 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,10 @@ protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
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:
|
||||
RsPostedGroup mTopic;
|
||||
|
@ -38,12 +38,14 @@
|
||||
*/
|
||||
|
||||
/* 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_UNSUBSCRIBE ":/images/cancel.png"
|
||||
#define IMAGE_SHOW ":/images/info16.png"
|
||||
#define IMAGE_EDIT ":/images/settings16.png"
|
||||
|
||||
/* Images for TreeWidget */
|
||||
#define IMAGE_FOLDER ":/images/folder16.png"
|
||||
#define IMAGE_FOLDER ":/images/folder16.png"
|
||||
#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
|
||||
#define IMAGE_FOLDERRED ":/images/folder_red.png"
|
||||
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
|
||||
@ -51,7 +53,7 @@
|
||||
// token types to deal with
|
||||
|
||||
#define POSTED_DEFAULT_LISTING_LENGTH 10
|
||||
#define POSTED_MAX_INDEX 10000
|
||||
#define POSTED_MAX_INDEX 10000
|
||||
|
||||
/** Constructor */
|
||||
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->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());
|
||||
}
|
||||
|
||||
@ -366,6 +376,26 @@ void PostedListDialog::newTopic()
|
||||
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()
|
||||
{
|
||||
if (mCurrTopicId.empty())
|
||||
|
@ -66,6 +66,9 @@ private slots:
|
||||
void changedTopic(const QString &id);
|
||||
|
||||
void newTopic();
|
||||
void showTopic();
|
||||
void editTopic();
|
||||
|
||||
void showGroupDetails();
|
||||
void newPost();
|
||||
|
||||
|
@ -192,6 +192,9 @@ void WikiDialog::showGroupDetails()
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_SHOW, groupId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void WikiDialog::editGroupDetails()
|
||||
@ -204,11 +207,8 @@ void WikiDialog::editGroupDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//WikiGroupDialog cf (this);
|
||||
//cf.existingGroup(groupId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
|
||||
//cf.exec ();
|
||||
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_EDIT, groupId, this);
|
||||
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->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));
|
||||
|
||||
/************** 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);
|
||||
//connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
||||
//shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags));
|
||||
|
@ -346,6 +346,7 @@ void GxsGroupDialog::setupReadonly()
|
||||
|
||||
{
|
||||
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 */
|
||||
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||
|
||||
bool isExternal = true;
|
||||
switch(mGrpMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
@ -407,7 +407,6 @@ void GxsGroupDialog::updateFromExistingMeta()
|
||||
}
|
||||
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
|
||||
|
||||
|
||||
updateCircleOptions();
|
||||
}
|
||||
|
||||
@ -445,42 +444,173 @@ void GxsGroupDialog::submitGroup()
|
||||
|
||||
void GxsGroupDialog::editGroup()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::editGroup()" << std::endl;
|
||||
std::cerr << "GxsGroupDialog::editGroup()" << std::endl;
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
RsGroupMetaData newMeta;
|
||||
newMeta.mGroupId = mGrpMeta.mGroupId;
|
||||
|
||||
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!!
|
||||
}
|
||||
if(!prepareGroupMetaData(newMeta))
|
||||
{
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add a empty name!!
|
||||
}
|
||||
|
||||
std::cerr << "GxsGroupDialog::editGroup() Unfinished" << std::endl;
|
||||
#if 0
|
||||
uint32_t token;
|
||||
RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId);
|
||||
updateMeta.setMetaUpdate(RsGxsGroupUpdateMeta::NAME, std::string(name.toUtf8()));
|
||||
RsGxsGroupUpdateMeta updateMeta(mGrpMeta.mGroupId);
|
||||
if (!buildUpdateMeta(mGrpMeta, newMeta, updateMeta))
|
||||
{
|
||||
/* error message */
|
||||
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))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
if(mExternalTokenQueue != NULL)
|
||||
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
}
|
||||
#endif
|
||||
std::cerr << "GxsGroupDialog::editGroup() calling service_EditGroup";
|
||||
std::cerr << std::endl;
|
||||
|
||||
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()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::createGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QString name = misc::removeNewLine(ui.groupName->text());
|
||||
uint32_t flags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
|
||||
if(name.isEmpty())
|
||||
{
|
||||
@ -491,27 +621,13 @@ void GxsGroupDialog::createGroup()
|
||||
|
||||
uint32_t token;
|
||||
RsGroupMetaData meta;
|
||||
|
||||
// Fill in the MetaData as best we can.
|
||||
meta.mGroupName = std::string(name.toUtf8());
|
||||
|
||||
meta.mGroupFlags = flags;
|
||||
meta.mSignFlags = getGroupSignFlags();
|
||||
|
||||
if (!setCircleParameters(meta))
|
||||
if (!prepareGroupMetaData(meta))
|
||||
{
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Invalid Circle Selection - Personal disabled for now"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return; //Don't add with invalid circle.
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Failed to Prepare Group MetaData - please Review"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
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))
|
||||
{
|
||||
// get the Queue to handle response.
|
||||
@ -694,6 +810,7 @@ QString GxsGroupDialog::getDescription()
|
||||
|
||||
void GxsGroupDialog::sendShareList(std::string groupId)
|
||||
{
|
||||
(void) groupId;
|
||||
close();
|
||||
}
|
||||
|
||||
@ -743,6 +860,9 @@ void GxsGroupDialog::loadGroup(uint32_t token)
|
||||
|
||||
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 << std::endl;
|
||||
return false;
|
||||
|
@ -180,7 +180,9 @@ protected:
|
||||
* @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) = 0;
|
||||
virtual bool service_EditGroup(uint32_t &token,
|
||||
RsGxsGroupUpdateMeta &updateMeta,
|
||||
RsGroupMetaData &editedMeta) = 0;
|
||||
|
||||
// To be overloaded by users.
|
||||
// use Token to retrieve from service, fill in metaData.
|
||||
@ -230,6 +232,13 @@ private:
|
||||
void loadGroup(uint32_t token);
|
||||
void updateFromExistingMeta();
|
||||
|
||||
bool prepareGroupMetaData(RsGroupMetaData &meta);
|
||||
bool buildUpdateMeta(
|
||||
const RsGroupMetaData &origMeta,
|
||||
const RsGroupMetaData &newMeta,
|
||||
RsGxsGroupUpdateMeta &updateMeta);
|
||||
|
||||
|
||||
std::list<std::string> mShareList;
|
||||
QPixmap picture;
|
||||
RsTokenService *mTokenService;
|
||||
|
@ -73,18 +73,19 @@ void WikiGroupDialog::initUi()
|
||||
{
|
||||
case MODE_CREATE:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Wiki Group"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Group"));
|
||||
break;
|
||||
case MODE_SHOW:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Wiki Group"));
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Wiki Group"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Group"));
|
||||
break;
|
||||
}
|
||||
|
||||
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Wiki Moderators"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wiki Moderators"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Group"));
|
||||
}
|
||||
|
||||
QPixmap WikiGroupDialog::serviceImage()
|
||||
@ -106,12 +107,45 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,10 @@ protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
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:
|
||||
|
||||
|
@ -244,18 +244,16 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
||||
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)
|
||||
{
|
||||
QAction *editChannelDetailAct = new QAction(QIcon(":/images/edit_16.png"), tr("Edit Channel Details"), &contextMnu);
|
||||
connect( editChannelDetailAct, SIGNAL( triggered() ), this, SLOT( editChannelDetail() ) );
|
||||
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)
|
||||
{
|
||||
@ -372,10 +370,12 @@ void GxsChannelDialog::openChat(std::string /*peerId*/)
|
||||
|
||||
void GxsChannelDialog::editChannelDetail()
|
||||
{
|
||||
#if 0
|
||||
EditChanDetails editUi(this, mChannelId);
|
||||
editUi.exec();
|
||||
#endif
|
||||
if (mChannelId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GxsChannelGroupDialog cf(mChannelQueue, rsGxsChannels->getTokenService(), GxsGroupDialog::MODE_EDIT, mChannelId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void GxsChannelDialog::shareKey()
|
||||
@ -799,22 +799,15 @@ void GxsChannelDialog::subscribeChannel()
|
||||
|
||||
void GxsChannelDialog::showChannelDetails()
|
||||
{
|
||||
#if 0
|
||||
if (mChannelId.empty()) {
|
||||
return;
|
||||
}
|
||||
if (mChannelId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rsChannels) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChannelDetails channelui (this);
|
||||
|
||||
channelui.showDetails(mChannelId);
|
||||
channelui.exec();
|
||||
#endif
|
||||
GxsChannelGroupDialog cf(mChannelQueue, rsGxsChannels->getTokenService(), GxsGroupDialog::MODE_SHOW, mChannelId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
|
||||
void GxsChannelDialog::setAllAsReadClicked()
|
||||
{
|
||||
#if 0
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
@ -73,18 +73,19 @@ void GxsChannelGroupDialog::initUi()
|
||||
{
|
||||
case MODE_CREATE:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Channel"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Channel"));
|
||||
break;
|
||||
case MODE_SHOW:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Channel"));
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Channel"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Channel"));
|
||||
break;
|
||||
}
|
||||
|
||||
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Channel Admins"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Channel Admins"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Channel"));
|
||||
}
|
||||
|
||||
QPixmap GxsChannelGroupDialog::serviceImage()
|
||||
@ -104,12 +105,46 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token,
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -31,13 +31,16 @@ class GxsChannelGroupDialog : public GxsGroupDialog
|
||||
|
||||
public:
|
||||
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:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
|
@ -73,6 +73,7 @@ void GxsForumGroupDialog::initUi()
|
||||
{
|
||||
case MODE_CREATE:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Forum"));
|
||||
break;
|
||||
case MODE_SHOW:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Forum"));
|
||||
@ -80,8 +81,12 @@ void GxsForumGroupDialog::initUi()
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
setUiText(UITYPE_SERVICE_HEADER, tr("Edit Forum"));
|
||||
setUiText(UITYPE_BUTTONBOX_OK, tr("Update Forum"));
|
||||
break;
|
||||
}
|
||||
|
||||
setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Forum Admins"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Forum Admins"));
|
||||
}
|
||||
|
||||
QPixmap GxsForumGroupDialog::serviceImage()
|
||||
@ -100,14 +105,17 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
|
||||
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;
|
||||
grp.mMeta = editedMeta;
|
||||
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
|
||||
|
||||
std::cerr << "GxsForumGroupDialog::service_EditGroup() submitting changes";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsGxsForums->updateGroup(token, updateMeta, grp);
|
||||
return true;
|
||||
}
|
||||
|
@ -37,8 +37,10 @@ protected:
|
||||
virtual void initUi();
|
||||
virtual QPixmap serviceImage();
|
||||
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);
|
||||
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user