mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Improvements to enable Edit/Show of GxsGroups.
NB: The actual update doesn't happen yet - mainly just the display of info. - Fixed up Constructor, and loading of MetaData via TokenService. - Fixed up Enabled / ReadOnly for Show. - Updated children to match new functionality. - Fixed up Show in Circles Dialog too. - removed a few compile errors. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@7062 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb0d02f3dc
commit
3b71e8e140
@ -65,7 +65,7 @@ CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_friends, UISTATE_ACTIVE_ENABLED);
|
||||
mStateHelper->addWidget(CIRCLESDIALOG_GROUPMETA, ui.treeWidget_category, UISTATE_ACTIVE_ENABLED);
|
||||
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, false); // not implemented
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, false);
|
||||
|
||||
/* Connect signals */
|
||||
connect(ui.pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||
@ -113,12 +113,18 @@ void CirclesDialog::createPersonalCircle()
|
||||
|
||||
void CirclesDialog::editExistingCircle()
|
||||
{
|
||||
#if 0
|
||||
std::string id;
|
||||
QTreeWidgetItem *item = ui.treeWidget_membership->currentItem();
|
||||
if ((!item) || (!item->parent()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString coltext = item->text(CIRCLEGROUP_CIRCLE_COL_GROUPID);
|
||||
std::string id = coltext.toStdString();
|
||||
|
||||
CreateCircleDialog dlg;
|
||||
dlg.editExistingId(id);
|
||||
dlg.exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
void CirclesDialog::reloadAll()
|
||||
@ -349,6 +355,7 @@ void CirclesDialog::circle_selected()
|
||||
|
||||
if ((!item) || (!item->parent()))
|
||||
{
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -377,6 +384,7 @@ void CirclesDialog::circle_selected()
|
||||
{
|
||||
set_tree_background(ui.treeWidget_friends, GRAY_BACKGROUND);
|
||||
}
|
||||
mStateHelper->setWidgetEnabled(ui.pushButton_editCircle, true);
|
||||
}
|
||||
|
||||
void CirclesDialog::friend_selected()
|
||||
|
@ -68,7 +68,7 @@ CreateCircleDialog::CreateCircleDialog()
|
||||
mIsExternalCircle = true;
|
||||
|
||||
ui.idChooser->loadIds(0,"");
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL);
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, "");
|
||||
}
|
||||
|
||||
CreateCircleDialog::~CreateCircleDialog()
|
||||
@ -81,22 +81,10 @@ void CreateCircleDialog::editExistingId(std::string circleId)
|
||||
{
|
||||
/* load this circle */
|
||||
mIsExistingCircle = true;
|
||||
|
||||
/* setup personal or external circle */
|
||||
|
||||
bool isExternal = false;
|
||||
if (isExternal)
|
||||
{
|
||||
setupForExternalCircle();
|
||||
}
|
||||
else
|
||||
{
|
||||
setupForPersonalCircle();
|
||||
}
|
||||
|
||||
/* lock stuff they cannot edit */
|
||||
requestCircle(circleId);
|
||||
}
|
||||
|
||||
|
||||
void CreateCircleDialog::editNewId(bool isExternal)
|
||||
{
|
||||
/* load this circle */
|
||||
@ -164,7 +152,15 @@ void CreateCircleDialog::addMember()
|
||||
}
|
||||
|
||||
/* check that its not there already */
|
||||
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
|
||||
QString keyId = item->text(RSCIRCLEID_COL_KEYID);
|
||||
QString idtype = item->text(RSCIRCLEID_COL_IDTYPE);
|
||||
QString nickname = item->text(RSCIRCLEID_COL_NICKNAME);
|
||||
|
||||
addMember(keyId, idtype, nickname);
|
||||
}
|
||||
|
||||
void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, const QString& nickname )
|
||||
{
|
||||
QTreeWidget *tree = ui.treeWidget_membership;
|
||||
|
||||
int count = tree->topLevelItemCount();
|
||||
@ -180,9 +176,9 @@ void CreateCircleDialog::addMember()
|
||||
}
|
||||
|
||||
QTreeWidgetItem *member = new QTreeWidgetItem();
|
||||
member->setText(RSCIRCLEID_COL_NICKNAME, item->text(RSCIRCLEID_COL_NICKNAME));
|
||||
member->setText(RSCIRCLEID_COL_KEYID, item->text(RSCIRCLEID_COL_KEYID));
|
||||
member->setText(RSCIRCLEID_COL_IDTYPE, item->text(RSCIRCLEID_COL_IDTYPE));
|
||||
member->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||
member->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||
member->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||
|
||||
tree->addTopLevelItem(member);
|
||||
}
|
||||
@ -337,6 +333,58 @@ void CreateCircleDialog::createCircle()
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
void CreateCircleDialog::updateCircleGUI()
|
||||
{
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
ui.circleName->setText(QString::fromUtf8(mCircleGroup.mMeta.mGroupName.c_str()));
|
||||
|
||||
bool isExternal = true;
|
||||
switch(mCircleGroup.mMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_LOCAL:
|
||||
isExternal = false;
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_PUBLIC:
|
||||
ui.radioButton_Public->setChecked(true);
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_EXT_SELF:
|
||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
||||
if (mCircleGroup.mMeta.mCircleId == mCircleGroup.mMeta.mGroupId)
|
||||
{
|
||||
ui.radioButton_Self->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.radioButton_Restricted->setChecked(true);
|
||||
}
|
||||
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mCircleGroup.mMeta.mCircleId);
|
||||
|
||||
break;
|
||||
default:
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
// set preferredId.
|
||||
ui.idChooser->loadIds(0,mCircleGroup.mMeta.mAuthorId);
|
||||
|
||||
/* setup personal or external circle */
|
||||
if (isExternal)
|
||||
{
|
||||
setupForExternalCircle();
|
||||
}
|
||||
else
|
||||
{
|
||||
setupForPersonalCircle();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CreateCircleDialog::requestCircle(const RsGxsGroupId &groupId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
@ -382,7 +430,8 @@ void CreateCircleDialog::loadCircle(uint32_t token)
|
||||
std::cerr << "CreateCircleDialog::loadCircle() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
//mCircleGroup = groups[0];
|
||||
mCircleGroup = groups[0];
|
||||
updateCircleGUI();
|
||||
}
|
||||
|
||||
void CreateCircleDialog::getPgpIdentities()
|
||||
@ -393,24 +442,38 @@ void CreateCircleDialog::getPgpIdentities()
|
||||
QTreeWidget *tree = ui.treeWidget_IdList;
|
||||
|
||||
tree->clear();
|
||||
|
||||
std::list<std::string> ids;
|
||||
std::list<std::string>::iterator it;
|
||||
|
||||
|
||||
rsPeers->getGPGAcceptedList(ids);
|
||||
for(it = ids.begin(); it != ids.end(); it++)
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
RsPeerDetails details;
|
||||
|
||||
rsPeers->getGPGDetails(*it, details);
|
||||
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Identity");
|
||||
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromUtf8(details.name.c_str()));
|
||||
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(details.gpg_id));
|
||||
QString keyId = QString::fromStdString(details.gpg_id);
|
||||
QString nickname = QString::fromUtf8(details.name.c_str());
|
||||
QString idtype = tr("PGP Identity");
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||
item->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||
tree->addTopLevelItem(item);
|
||||
|
||||
// Local Circle.
|
||||
if (mIsExistingCircle)
|
||||
{
|
||||
// check if its in the circle.
|
||||
std::list<RsPgpId>::const_iterator it;
|
||||
it = std::find(mCircleGroup.mLocalFriends.begin(), mCircleGroup.mLocalFriends.end(), details.gpg_id);
|
||||
if (it != mCircleGroup.mLocalFriends.end())
|
||||
{
|
||||
/* found it */
|
||||
addMember(keyId, idtype, nickname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -477,27 +540,44 @@ void CreateCircleDialog::loadIdentities(uint32_t token)
|
||||
continue;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(RSCIRCLEID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()));
|
||||
item->setText(RSCIRCLEID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId));
|
||||
QString keyId = QString::fromStdString(data.mMeta.mGroupId);
|
||||
QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str());
|
||||
QString idtype = tr("Anon Id");
|
||||
|
||||
if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID)
|
||||
{
|
||||
if (data.mPgpKnown)
|
||||
{
|
||||
RsPeerDetails details;
|
||||
rsPeers->getGPGDetails(data.mPgpId, details);
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, QString::fromUtf8(details.name.c_str()));
|
||||
idtype = QString::fromUtf8(details.name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, "PGP Linked Id");
|
||||
idtype = tr("PGP Linked Id");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, "Anon Id");
|
||||
}
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(RSCIRCLEID_COL_NICKNAME, nickname);
|
||||
item->setText(RSCIRCLEID_COL_KEYID, keyId);
|
||||
item->setText(RSCIRCLEID_COL_IDTYPE, idtype);
|
||||
tree->addTopLevelItem(item);
|
||||
|
||||
// External Circle.
|
||||
if (mIsExistingCircle)
|
||||
{
|
||||
// check if its in the circle.
|
||||
std::list<RsGxsId>::const_iterator it;
|
||||
it = std::find(mCircleGroup.mInvitedMembers.begin(),
|
||||
mCircleGroup.mInvitedMembers.end(), data.mMeta.mGroupId);
|
||||
|
||||
if (it != mCircleGroup.mInvitedMembers.end())
|
||||
{
|
||||
/* found it */
|
||||
addMember(keyId, idtype, nickname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,10 @@ private slots:
|
||||
void createCircle();
|
||||
|
||||
private:
|
||||
|
||||
void updateCircleGUI();
|
||||
void addMember(const QString& keyId, const QString& idtype, const QString& nickname );
|
||||
|
||||
void setupForPersonalCircle();
|
||||
void setupForExternalCircle();
|
||||
|
||||
@ -70,6 +74,8 @@ private:
|
||||
TokenQueue *mCircleQueue;
|
||||
TokenQueue *mIdQueue;
|
||||
|
||||
RsGxsCircleGroup mCircleGroup; // for editting existing Circles.
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::CreateCircleDialog ui;
|
||||
};
|
||||
|
@ -26,7 +26,9 @@
|
||||
#include <retroshare/rswiki.h>
|
||||
#include <iostream>
|
||||
|
||||
const uint32_t PostedCreateEnabledFlags = ( // GXS_GROUP_FLAGS_ICON |
|
||||
const uint32_t PostedCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
// GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
@ -52,13 +54,16 @@ uint32_t PostedCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
uint32_t PostedEditEnabledFlags = PostedCreateEnabledFlags;
|
||||
uint32_t PostedEditDefaultsFlags = PostedCreateDefaultsFlags;
|
||||
|
||||
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, PostedCreateEnabledFlags, PostedCreateDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
PostedGroupDialog::PostedGroupDialog(const RsPostedGroup &group, QWidget *parent)
|
||||
:GxsGroupDialog(group.mMeta, MODE_SHOW, parent)
|
||||
PostedGroupDialog::PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, PostedEditEnabledFlags, PostedEditDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -99,3 +104,9 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -33,12 +33,13 @@ class PostedGroupDialog : public GxsGroupDialog
|
||||
|
||||
public:
|
||||
PostedGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
PostedGroupDialog(const RsPostedGroup &topic, QWidget *parent);
|
||||
PostedGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
RsPostedGroup mTopic;
|
||||
|
@ -368,8 +368,8 @@ void PostedListDialog::showGroupDetails()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PostedGroupDialog cf(mGroups[mCurrTopicId], this);
|
||||
|
||||
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_SHOW, mCurrTopicId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ void ChatLobbyDialog::updateParticipantsList()
|
||||
std::list<ChatLobbyInfo>::const_iterator it(lInfos.begin());
|
||||
|
||||
// Set it to the current ChatLobby
|
||||
for (; it!=lInfos.end() && (*it).lobby_id != lobbyId; ++it);
|
||||
for (; it!=lInfos.end() && (*it).lobby_id != lobbyId; ++it) ;
|
||||
|
||||
if (it != lInfos.end()) {
|
||||
ChatLobbyInfo cliInfo=(*it);
|
||||
@ -482,7 +482,7 @@ bool ChatLobbyDialog::isNicknameInLobby(const QString &nickname) {
|
||||
std::list<ChatLobbyInfo>::const_iterator it(linfos.begin());
|
||||
|
||||
// Set it to the current ChatLobby
|
||||
for (; it!=linfos.end() && (*it).lobby_id != lobbyId; ++it);
|
||||
for (; it!=linfos.end() && (*it).lobby_id != lobbyId; ++it) ;
|
||||
|
||||
if (it != linfos.end()) {
|
||||
for (std::map<std::string,time_t>::const_iterator it2((*it).nick_names.begin()); it2 != (*it).nick_names.end(); ++it2) {
|
||||
|
@ -36,9 +36,10 @@ GxsCircleChooser::GxsCircleChooser(QWidget *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
void GxsCircleChooser::loadCircles(uint32_t chooserFlags)
|
||||
void GxsCircleChooser::loadCircles(uint32_t chooserFlags, const RsGxsCircleId &defaultId)
|
||||
{
|
||||
mFlags = chooserFlags;
|
||||
mDefaultCircleId = defaultId;
|
||||
loadGxsCircles();
|
||||
}
|
||||
|
||||
@ -84,7 +85,9 @@ void GxsCircleChooser::loadGxsCircles()
|
||||
}
|
||||
|
||||
std::list<RsGxsCircleId>::iterator it;
|
||||
for(it = ids.begin(); it != ids.end(); it++)
|
||||
int i = 0;
|
||||
int def = -1;
|
||||
for(it = ids.begin(); it != ids.end(); it++, i++)
|
||||
{
|
||||
/* add to Chooser */
|
||||
QString str;
|
||||
@ -97,6 +100,16 @@ void GxsCircleChooser::loadGxsCircles()
|
||||
QString id = QString::fromStdString(*it);
|
||||
|
||||
addItem(str, id);
|
||||
|
||||
if (mDefaultCircleId == *it)
|
||||
{
|
||||
def = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (def >= 0)
|
||||
{
|
||||
setCurrentIndex(def);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,14 @@ class GxsCircleChooser : public QComboBox
|
||||
public:
|
||||
GxsCircleChooser(QWidget *parent = NULL);
|
||||
|
||||
void loadCircles(uint32_t chooserFlags);
|
||||
void loadCircles(uint32_t chooserFlags, const RsGxsCircleId &defaultId);
|
||||
bool getChosenCircle(RsGxsCircleId &id);
|
||||
|
||||
private:
|
||||
void loadGxsCircles();
|
||||
uint32_t mFlags;
|
||||
|
||||
RsGxsCircleId mDefaultCircleId;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -51,23 +51,30 @@
|
||||
|
||||
#define GXSGROUP_NEWGROUPID 1
|
||||
#define GXSGROUP_LOADGROUP 2
|
||||
#define GXSGROUP_INTERNAL_LOADGROUP 3
|
||||
|
||||
/** Constructor */
|
||||
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenQueue(tokenQueue), mMode(MODE_CREATE), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenService(NULL), mExternalTokenQueue(tokenExternalQueue), mInternalTokenQueue(NULL), mGrpMeta(), mMode(MODE_CREATE), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mInternalTokenQueue = NULL;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
GxsGroupDialog::GxsGroupDialog(const RsGroupMetaData &grpMeta, Mode mode, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenQueue(NULL), mGrpMeta(grpMeta), mMode(mode), mEnabledFlags(0), mReadonlyFlags(0), mDefaultsFlags(0)
|
||||
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenService(NULL), mExternalTokenQueue(tokenExternalQueue), mInternalTokenQueue(NULL), mGrpMeta(), mMode(mode), mEnabledFlags(enableFlags), mReadonlyFlags(0), mDefaultsFlags(defaultFlags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
mTokenService = tokenService;
|
||||
mInternalTokenQueue = new TokenQueue(tokenService, this);
|
||||
mGrpMeta.mGroupId = groupId;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@ -102,8 +109,8 @@ void GxsGroupDialog::init()
|
||||
/* Setup Reasonable Defaults */
|
||||
|
||||
ui.idChooser->loadIds(0,"");
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL);
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL);
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL,"");
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL,"");
|
||||
|
||||
initMode();
|
||||
}
|
||||
@ -134,6 +141,7 @@ void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
|
||||
|
||||
void GxsGroupDialog::initMode()
|
||||
{
|
||||
setAllReadonly();
|
||||
switch (mode())
|
||||
{
|
||||
case MODE_CREATE:
|
||||
@ -146,15 +154,18 @@ void GxsGroupDialog::initMode()
|
||||
|
||||
case MODE_SHOW:
|
||||
{
|
||||
mReadonlyFlags = 0xffffffff; // Force all to readonly.
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
requestGroup(mGrpMeta.mGroupId);
|
||||
}
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case MODE_EDIT:
|
||||
{
|
||||
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Submit Group Changes"));
|
||||
requestGroup(mGrpMeta.mGroupId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,6 +264,9 @@ void GxsGroupDialog::setupDefaults()
|
||||
|
||||
void GxsGroupDialog::setupVisibility()
|
||||
{
|
||||
{
|
||||
ui.groupName->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_NAME);
|
||||
}
|
||||
{
|
||||
ui.groupLogo->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
|
||||
ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
|
||||
@ -289,14 +303,112 @@ void GxsGroupDialog::setupVisibility()
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::setAllReadonly()
|
||||
{
|
||||
uint32_t origReadonlyFlags = mReadonlyFlags;
|
||||
mReadonlyFlags = 0xffffffff;
|
||||
|
||||
setupReadonly();
|
||||
|
||||
mReadonlyFlags = origReadonlyFlags;
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::setupReadonly()
|
||||
{
|
||||
{
|
||||
ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
|
||||
}
|
||||
{
|
||||
ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||
ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
|
||||
}
|
||||
|
||||
{
|
||||
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
|
||||
ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
|
||||
}
|
||||
|
||||
{
|
||||
ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
|
||||
}
|
||||
|
||||
{
|
||||
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
|
||||
}
|
||||
|
||||
{
|
||||
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
|
||||
}
|
||||
|
||||
{
|
||||
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
|
||||
}
|
||||
|
||||
{
|
||||
ui.commentGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS));
|
||||
}
|
||||
|
||||
{
|
||||
ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::newGroup()
|
||||
{
|
||||
setupDefaults();
|
||||
setupVisibility();
|
||||
setupReadonly();
|
||||
clearForm();
|
||||
|
||||
}
|
||||
|
||||
void GxsGroupDialog::updateFromExistingMeta()
|
||||
{
|
||||
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
|
||||
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
|
||||
std::cerr << " External: " << mGrpMeta.mCircleId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
setupDefaults();
|
||||
setupVisibility();
|
||||
setupReadonly();
|
||||
clearForm();
|
||||
|
||||
/* setup name */
|
||||
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||
|
||||
bool isExternal = true;
|
||||
switch(mGrpMeta.mCircleType)
|
||||
{
|
||||
case GXS_CIRCLE_TYPE_YOUREYESONLY:
|
||||
ui.typeLocal->setChecked(true);
|
||||
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_PUBLIC:
|
||||
ui.typePublic->setChecked(true);
|
||||
break;
|
||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
||||
ui.typeGroup->setChecked(true);
|
||||
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
|
||||
|
||||
break;
|
||||
default:
|
||||
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
|
||||
|
||||
|
||||
updateCircleOptions();
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::submitGroup()
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::submitGroup()";
|
||||
@ -320,9 +432,9 @@ void GxsGroupDialog::submitGroup()
|
||||
break;
|
||||
|
||||
case MODE_EDIT:
|
||||
{
|
||||
{
|
||||
|
||||
editGroup();
|
||||
editGroup();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -337,21 +449,24 @@ void GxsGroupDialog::editGroup()
|
||||
|
||||
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!!
|
||||
/* error message */
|
||||
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), 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()));
|
||||
|
||||
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);
|
||||
// get the Queue to handle response.
|
||||
if(mExternalTokenQueue != NULL)
|
||||
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
}
|
||||
#endif
|
||||
|
||||
close();
|
||||
}
|
||||
@ -387,14 +502,18 @@ void GxsGroupDialog::createGroup()
|
||||
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.
|
||||
if(mTokenQueue != NULL)
|
||||
mTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
if(mExternalTokenQueue != NULL)
|
||||
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
|
||||
}
|
||||
|
||||
close();
|
||||
@ -473,7 +592,7 @@ void GxsGroupDialog::updateCircleOptions()
|
||||
{
|
||||
if (ui.typeGroup->isChecked())
|
||||
{
|
||||
ui.circleComboBox->setEnabled(true);
|
||||
ui.circleComboBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
|
||||
ui.circleComboBox->setVisible(true);
|
||||
}
|
||||
else
|
||||
@ -484,7 +603,7 @@ void GxsGroupDialog::updateCircleOptions()
|
||||
|
||||
if (ui.typeLocal->isChecked())
|
||||
{
|
||||
ui.localComboBox->setEnabled(true);
|
||||
ui.circleComboBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
|
||||
ui.localComboBox->setVisible(true);
|
||||
}
|
||||
else
|
||||
@ -585,3 +704,69 @@ void GxsGroupDialog::setShareList()
|
||||
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************
|
||||
Loading Group.
|
||||
***********************************************************************************/
|
||||
|
||||
void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
|
||||
std::list<RsGxsGroupId> groupIds;
|
||||
groupIds.push_back(groupId);
|
||||
|
||||
std::cerr << "GxsGroupDialog::requestGroup() Requesting Group Summary(" << groupId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP);
|
||||
}
|
||||
|
||||
|
||||
void GxsGroupDialog::loadGroup(uint32_t token)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::loadGroup(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (service_loadGroup(token, mMode, mGrpMeta))
|
||||
{
|
||||
updateFromExistingMeta();
|
||||
}
|
||||
}
|
||||
|
||||
bool GxsGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::service_loadGroup(" << token << ") NOT IMPLEMENTED";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mInternalTokenQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case GXSGROUP_INTERNAL_LOADGROUP:
|
||||
loadGroup(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "GxsGroupDialog::loadGroup() UNKNOWN UserType ";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -55,13 +55,14 @@ public:
|
||||
|
||||
/*** Group flags affect what is visually enabled that gets input into the grpMeta ***/
|
||||
|
||||
#define GXS_GROUP_FLAGS_ICON 0x00000001
|
||||
#define GXS_GROUP_FLAGS_DESCRIPTION 0x00000002
|
||||
#define GXS_GROUP_FLAGS_DISTRIBUTION 0x00000004
|
||||
#define GXS_GROUP_FLAGS_PUBLISHSIGN 0x00000008
|
||||
#define GXS_GROUP_FLAGS_SHAREKEYS 0x00000010
|
||||
#define GXS_GROUP_FLAGS_PERSONALSIGN 0x00000020
|
||||
#define GXS_GROUP_FLAGS_COMMENTS 0x00000040
|
||||
#define GXS_GROUP_FLAGS_NAME 0x00000001
|
||||
#define GXS_GROUP_FLAGS_ICON 0x00000002
|
||||
#define GXS_GROUP_FLAGS_DESCRIPTION 0x00000004
|
||||
#define GXS_GROUP_FLAGS_DISTRIBUTION 0x00000008
|
||||
#define GXS_GROUP_FLAGS_PUBLISHSIGN 0x00000010
|
||||
#define GXS_GROUP_FLAGS_SHAREKEYS 0x00000020
|
||||
#define GXS_GROUP_FLAGS_PERSONALSIGN 0x00000040
|
||||
#define GXS_GROUP_FLAGS_COMMENTS 0x00000080
|
||||
|
||||
#define GXS_GROUP_FLAGS_EXTRA 0x00000100
|
||||
|
||||
@ -102,7 +103,7 @@ public:
|
||||
* The long term plan is perhap logic structure (i.e. code) will be moved into each GXS \n
|
||||
* service for better customisation of group creation, or perhaps not!
|
||||
*/
|
||||
class GxsGroupDialog : public QDialog
|
||||
class GxsGroupDialog : public QDialog, public TokenResponse
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -131,7 +132,7 @@ public:
|
||||
* @param parent The parent dialog
|
||||
* @param mode
|
||||
*/
|
||||
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent = NULL);
|
||||
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
|
||||
/*!
|
||||
* Contructs a GxsGroupDialog for display a group or editing
|
||||
@ -139,10 +140,13 @@ public:
|
||||
* @param mode This determines whether the dialog starts in show or edit mode (Edit not supported yet)
|
||||
* @param parent
|
||||
*/
|
||||
GxsGroupDialog(const RsGroupMetaData& grpMeta, Mode mode, QWidget *parent = NULL);
|
||||
GxsGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent = NULL);
|
||||
|
||||
uint32_t mode() { return mMode; }
|
||||
|
||||
// overloaded from TokenResponse
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
private:
|
||||
void newGroup();
|
||||
void init();
|
||||
@ -172,11 +176,14 @@ protected:
|
||||
|
||||
/*!
|
||||
* 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) {}
|
||||
virtual bool service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta) = 0;
|
||||
|
||||
// To be overloaded by users.
|
||||
// use Token to retrieve from service, fill in metaData.
|
||||
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
|
||||
|
||||
/*!
|
||||
* This returns a group logo from the ui \n
|
||||
@ -206,6 +213,9 @@ private:
|
||||
|
||||
void setGroupSignFlags(uint32_t signFlags);
|
||||
uint32_t getGroupSignFlags();
|
||||
|
||||
void setAllReadonly();
|
||||
void setupReadonly();
|
||||
void setupDefaults();
|
||||
void setupVisibility();
|
||||
void clearForm();
|
||||
@ -214,12 +224,19 @@ private:
|
||||
void sendShareList(std::string forumId);
|
||||
void loadNewGroupId(const uint32_t &token);
|
||||
|
||||
// loading existing Groups.
|
||||
void requestGroup(const RsGxsGroupId &groupId);
|
||||
void loadGroup(uint32_t token);
|
||||
void updateFromExistingMeta();
|
||||
|
||||
std::list<std::string> mShareList;
|
||||
QPixmap picture;
|
||||
TokenQueue *mTokenQueue;
|
||||
RsTokenService *mTokenService;
|
||||
TokenQueue *mExternalTokenQueue;
|
||||
TokenQueue *mInternalTokenQueue;
|
||||
RsGroupMetaData mGrpMeta;
|
||||
|
||||
uint32_t mMode;
|
||||
Mode mMode;
|
||||
uint32_t mEnabledFlags;
|
||||
uint32_t mReadonlyFlags;
|
||||
uint32_t mDefaultsFlags;
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
GxsIdChooser(QWidget *parent = NULL);
|
||||
|
||||
void loadIds(uint32_t chooserFlags, RsGxsId defId);
|
||||
bool setChosenId(RsGxsId &id);
|
||||
bool getChosenId(RsGxsId &id);
|
||||
|
||||
private slots:
|
||||
|
@ -26,7 +26,9 @@
|
||||
#include <retroshare/rswiki.h>
|
||||
#include <iostream>
|
||||
|
||||
const uint32_t WikiCreateEnabledFlags = ( // GXS_GROUP_FLAGS_ICON |
|
||||
const uint32_t WikiCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
// GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
@ -52,71 +54,17 @@ uint32_t WikiCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
uint32_t WikiEditDefaultsFlags = WikiCreateDefaultsFlags;
|
||||
uint32_t WikiEditEnabledFlags = WikiCreateEnabledFlags;
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent)
|
||||
{
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
#if 0
|
||||
uint32_t enabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
GXS_GROUP_FLAGS_SHAREKEYS |
|
||||
// GXS_GROUP_FLAGS_PERSONALSIGN |
|
||||
// GXS_GROUP_FLAGS_COMMENTS |
|
||||
0);
|
||||
|
||||
uint32_t readonlyFlags = 0;
|
||||
|
||||
uint32_t defaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_GROUP |
|
||||
//GXS_GROUP_DEFAULTS_DISTRIB_LOCAL |
|
||||
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_THREADS |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_GPG |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
//GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB |
|
||||
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_YES |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
//setFlags(enabledFlags, readonlyFlags, defaultsFlags);
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent)
|
||||
:GxsGroupDialog(collection.mMeta, MODE_SHOW, parent)
|
||||
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, WikiEditEnabledFlags, WikiEditDefaultsFlags, parent)
|
||||
{
|
||||
#if 0
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
uint32_t enabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
GXS_GROUP_FLAGS_SHAREKEYS |
|
||||
0);
|
||||
|
||||
uint32_t readonlyFlags = 0;
|
||||
|
||||
uint32_t defaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
|
||||
GXS_GROUP_DEFAULTS_PUBLISH_OPEN |
|
||||
GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED |
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
setFlags(enabledFlags, defaultsFlags);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void WikiGroupDialog::initUi()
|
||||
@ -156,3 +104,13 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WikiGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
{
|
||||
std::cerr << "WikiGroupDialog::service_EditGroup() UNFINISHED";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,12 +34,13 @@ class WikiGroupDialog : public GxsGroupDialog
|
||||
|
||||
public:
|
||||
WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent);
|
||||
WikiGroupDialog(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);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
const uint32_t ChannelCreateEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
const uint32_t ChannelCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
@ -52,13 +54,16 @@ const uint32_t ChannelCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
|
||||
//GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
const uint32_t ChannelEditEnabledFlags = ChannelCreateEnabledFlags;
|
||||
const uint32_t ChannelEditDefaultsFlags = ChannelCreateDefaultsFlags;
|
||||
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, ChannelCreateEnabledFlags, ChannelCreateDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(const RsGxsChannelGroup &group, Mode mode, QWidget *parent)
|
||||
:GxsGroupDialog(group.mMeta, mode, parent)
|
||||
GxsChannelGroupDialog::GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, QWidget *parent)
|
||||
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ChannelEditEnabledFlags, ChannelEditDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -96,3 +101,14 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
|
||||
rsGxsChannels->createGroup(token, grp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
{
|
||||
std::cerr << "GxsChannelGroupDialog::service_EditGroup() UNFINISHED";
|
||||
std::cerr << std::endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -31,12 +31,14 @@ class GxsChannelGroupDialog : public GxsGroupDialog
|
||||
|
||||
public:
|
||||
GxsChannelGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
GxsChannelGroupDialog(const RsGxsChannelGroup &group, Mode mode, QWidget *parent);
|
||||
GxsChannelGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, uint32_t enableFlags, uint32_t defaultFlags, 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);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
// To start with we only have open forums - with distribution controls.
|
||||
|
||||
const uint32_t ForumCreateEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
const uint32_t ForumCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
@ -52,20 +54,16 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
|
||||
GXS_GROUP_DEFAULTS_COMMENTS_NO |
|
||||
0);
|
||||
|
||||
|
||||
const uint32_t ForumEditEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
0);
|
||||
|
||||
const uint32_t ForumEditDefaultsFlags = 0;
|
||||
const uint32_t ForumEditEnabledFlags = ForumCreateEnabledFlags;
|
||||
const uint32_t ForumEditDefaultsFlags = ForumCreateDefaultsFlags;
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
|
||||
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent)
|
||||
:GxsGroupDialog(group.mMeta, mode, parent)
|
||||
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)
|
||||
:GxsGroupDialog(tokenExternalQueue, tokenService, mode, groupId, ForumEditEnabledFlags, ForumEditDefaultsFlags, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@ -103,9 +101,44 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
|
||||
|
||||
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGxsGroupUpdateMeta &updateMeta)
|
||||
{
|
||||
RsGxsForumGroup grp;
|
||||
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
|
||||
std::cerr << "GxsForumGroupDialog::service_EditGroup() UNFINISHED";
|
||||
std::cerr << std::endl;
|
||||
|
||||
rsGxsForums->updateGroup(token, updateMeta, grp);
|
||||
return true;
|
||||
RsGxsForumGroup grp;
|
||||
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
|
||||
|
||||
rsGxsForums->updateGroup(token, updateMeta, grp);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup(" << token << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsGxsForumGroup> groups;
|
||||
if (!rsGxsForums->getGroupData(token, groups))
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (groups.size() != 1)
|
||||
{
|
||||
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error Group.size() != 1";
|
||||
std::cerr << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "GxsForumsGroupDialog::service_loadGroup() Unfinished Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
groupMetaData = groups[0].mMeta;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -31,13 +31,16 @@ class GxsForumGroupDialog : public GxsGroupDialog
|
||||
|
||||
public:
|
||||
GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent);
|
||||
GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent);
|
||||
GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -546,10 +546,7 @@ void GxsForumsDialog::showForumDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsForumGroup grp;
|
||||
grp.mMeta.mGroupId = mForumId;
|
||||
|
||||
GxsForumGroupDialog cf(grp, GxsGroupDialog::MODE_SHOW, this);
|
||||
GxsForumGroupDialog cf(mForumQueue, rsGxsForums->getTokenService(), GxsGroupDialog::MODE_SHOW, mForumId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
@ -562,7 +559,7 @@ void GxsForumsDialog::editForumDetails()
|
||||
RsGxsForumGroup grp;
|
||||
grp.mMeta.mGroupId = mForumId;
|
||||
|
||||
GxsForumGroupDialog cf(grp, GxsGroupDialog::MODE_EDIT, this);
|
||||
GxsForumGroupDialog cf(mForumQueue, rsGxsForums->getTokenService(), GxsGroupDialog::MODE_EDIT, mForumId, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user