Added Generalised GxsGroupDialog

- First pass, still much to do.
	- Handles Create / Edit and View Group Info.
	- Created ForumV2GroupDialog / WikiGroupDialog / PostedGroupDialog examples overloading it.

Various Improvements to PostedListDialog.
	- Handle Hot/New/Top options.
	- Send Period back to libretroshare too.
	- Named buttons in GUI.

Added GxsGroupDialog to Wiki / Posted & ForumsV2.

Discovered nasty bug in p3Posted. If there are no posts, its hangs at a Mutex, 
but I've no idea why. (It happens prior to this code). TODO.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5360 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-07-30 23:55:21 +00:00
parent 363374947f
commit d27eea84da
16 changed files with 2117 additions and 49 deletions

View file

@ -0,0 +1,100 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "ForumV2GroupDialog.h"
#include <retroshare/rsforumsV2.h>
#include <iostream>
ForumV2GroupDialog::ForumV2GroupDialog(QWidget *parent)
:GxsGroupDialog(rsForumsV2, parent)
{
// 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_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);
}
bool ForumV2GroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
// Specific Function.
RsForumV2Group grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
rsForumsV2->createGroup(token, grp, true);
return true;
}
void ForumV2GroupDialog::service_loadExistingGroup(const uint32_t &token)
{
std::cerr << "ForumV2GroupDialog::service_loadExistingGroup()";
std::cerr << std::endl;
RsForumV2Group group;
if (!rsForumsV2->getGroupData(token, group))
{
std::cerr << "ForumV2GroupDialog::service_loadExistingGroup() ERROR Getting Group";
std::cerr << std::endl;
return;
}
/* must call metadata loader */
loadExistingGroupMetaData(group.mMeta);
/* now load any extra data we feel like */
}

View file

@ -0,0 +1,44 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _FORUMV2_GROUP_DIALOG_H
#define _FORUMV2_GROUP_DIALOG_H
#include "GxsGroupDialog.h"
class ForumV2GroupDialog : public GxsGroupDialog
{
Q_OBJECT
public:
ForumV2GroupDialog(QWidget *parent);
protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
// virtual bool service_CompleteCreateGroup(const RsGroupMetaData &meta);
virtual void service_loadExistingGroup(const uint32_t &token);
};
#endif

View file

@ -0,0 +1,638 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QMessageBox>
#include "util/misc.h"
#include "GxsGroupDialog.h"
#include "gui/common/PeerDefs.h"
#include <algorithm>
#include <retroshare/rspeers.h>
#include <iostream>
#define GXSGROUP_NEWGROUPID 1
#define GXSGROUP_LOADGROUP 2
/** Constructor */
GxsGroupDialog::GxsGroupDialog(RsTokenService *service, QWidget *parent)
: QDialog(parent), mRsService(service)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
mTokenQueue = new TokenQueue(service, this);
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelDialog( ) ) );
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( submitGroup( ) ) );
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
connect( ui.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
if (!ui.pubKeyShare_cb->isChecked()) {
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
/* initialize key share list */
ui.keyShareList->setHeaderText(tr("Contacts:"));
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui.keyShareList->start();
/* Setup Reasonable Defaults */
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 );
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);
}
void GxsGroupDialog::setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultsFlags)
{
mEnabledFlags = enabledFlags;
mReadonlyFlags = readonlyFlags;
mDefaultsFlags = defaultsFlags;
}
void GxsGroupDialog::setMode(uint32_t mode)
{
mMode = mode;
/* switch depending on mode */
switch(mMode)
{
case GXS_GROUP_DIALOG_CREATE_MODE:
{
ui.createButton->setText(tr("Create Group"));
}
break;
default:
case GXS_GROUP_DIALOG_SHOW_MODE:
{
ui.cancelButton->setVisible(false);
ui.createButton->setText(tr("Close"));
}
break;
case GXS_GROUP_DIALOG_EDIT_MODE:
{
ui.createButton->setText(tr("Submit Changes"));
}
break;
}
}
void GxsGroupDialog::clearForm()
{
ui.groupName->clear();
ui.groupDesc->clear();
ui.groupName->setFocus();
}
void GxsGroupDialog::setupDefaults()
{
/* Enable / Show Parts based on Flags */
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_MASK)
{
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC)
{
ui.typePublic->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_GROUP)
{
ui.typeGroup->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_LOCAL)
{
ui.typeLocal->setChecked(true);
}
else
{
// default
ui.typePublic->setChecked(true);
}
}
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_MASK)
{
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED)
{
ui.publish_encrypt->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED)
{
ui.publish_required->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PUBLISH_THREADS)
{
ui.publish_threads->setChecked(true);
}
else
{
// default
ui.publish_open->setChecked(true);
}
}
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_MASK)
{
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_PGP)
{
ui.personal_pgp->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED)
{
ui.personal_required->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB)
{
ui.personal_ifnopub->setChecked(true);
}
else
{
// default
ui.personal_ifnopub->setChecked(true);
}
}
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_MASK)
{
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_YES)
{
ui.comments_allowed->setChecked(true);
}
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_NO)
{
ui.comments_no->setChecked(true);
}
else
{
// default
ui.comments_no->setChecked(true);
}
}
}
void GxsGroupDialog::setupVisibility()
{
{
ui.groupLogo->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
}
{
ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.groupDescLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
}
{
ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION);
}
{
ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN);
}
{
ui.pubKeyShare_cb->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS);
}
{
ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
}
{
ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
}
{
ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
}
}
void GxsGroupDialog::newGroup()
{
setupDefaults();
setupVisibility();
clearForm();
setMode(GXS_GROUP_DIALOG_CREATE_MODE);
service_NewGroup();
}
void GxsGroupDialog::existingGroup(std::string groupId, uint32_t mode)
{
setupDefaults();
setupVisibility();
clearForm();
setMode(mode);
service_ExistingGroup();
/* request data */
{
RsTokReqOptions opts;
std::list<std::string> grpIds;
grpIds.push_back(groupId);
std::cerr << "GxsGroupDialog::existingGroup() Requesting Data.";
std::cerr << std::endl;
uint32_t token;
mTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, GXSGROUP_LOADGROUP);
}
}
bool GxsGroupDialog::loadExistingGroupMetaData(const RsGroupMetaData &meta)
{
/* should set stuff - according to parameters */
setGroupSignFlags(meta.mSignFlags);
ui.groupName->setText(QString::fromUtf8(meta.mGroupName.c_str()));
return true;
}
bool GxsGroupDialog::service_NewGroup()
{
/* setup any extra bits */
return true;
}
bool GxsGroupDialog::service_ExistingGroup()
{
/* setup any extra bits */
return true;
}
void GxsGroupDialog::submitGroup()
{
std::cerr << "GxsGroupDialog::submitGroup()";
std::cerr << std::endl;
/* switch depending on mode */
switch(mMode)
{
case GXS_GROUP_DIALOG_CREATE_MODE:
{
/* just close if down */
createGroup();
}
break;
default:
case GXS_GROUP_DIALOG_SHOW_MODE:
{
/* just close if down */
cancelDialog();
}
break;
case GXS_GROUP_DIALOG_EDIT_MODE:
{
/* TEMP: just close if down */
cancelDialog();
}
break;
}
}
void GxsGroupDialog::createGroup()
{
QString name = misc::removeNewLine(ui.groupName->text());
QString desc = ui.groupDesc->toPlainText(); //toHtml();
uint32_t flags = 0;
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 (mRsService)
{
uint32_t token;
RsGroupMetaData meta;
// Fill in the MetaData as best we can.
meta.mGroupName = std::string(name.toUtf8());
//meta.mDesc = std::string(desc.toUtf8());
meta.mGroupFlags = flags;
meta.mSignFlags = getGroupSignFlags();
// These ones shouldn't be needed here - but will be used, until we have fully functional backend.
meta.mSubscribeFlags = RSGXS_GROUP_SUBSCRIBE_ADMIN;
meta.mPublishTs = time(NULL);
if (service_CreateGroup(token, meta))
{
// get the Queue to handle response.
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_SUMMARY, GXSGROUP_NEWGROUPID);
}
}
}
uint32_t GxsGroupDialog::getGroupSignFlags()
{
/* grab from the ui options -> */
uint32_t signFlags = 0;
if (ui.publish_encrypt->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED;
} else if (ui.publish_required->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED;
} else if (ui.publish_threads->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD;
} else { // publish_open (default).
signFlags |= RSGXS_GROUP_SIGN_PUBLISH_NONEREQ;
}
// Author Signature.
if (ui.personal_pgp->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_GPG;
} else if (ui.personal_required->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_REQUIRED;
} else if (ui.personal_ifnopub->isChecked()) {
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN;
} else { // shouldn't allow this one.
signFlags |= RSGXS_GROUP_SIGN_AUTHOR_NONE;
}
return signFlags;
}
void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
{
if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED) {
ui.publish_encrypt->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED) {
ui.publish_required->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD) {
ui.publish_threads->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_PUBLISH_NONEREQ) {
ui.publish_open->setChecked(true);
}
if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_GPG) {
ui.personal_pgp->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_REQUIRED) {
ui.personal_required->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN) {
ui.personal_ifnopub->setChecked(true);
} else if (signFlags & RSGXS_GROUP_SIGN_AUTHOR_NONE) {
// Its the same... but not quite.
//ui.personal_noifpub->setChecked();
}
/* guess at comments */
if ((signFlags & RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD)
&& (signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN))
{
ui.comments_allowed->setChecked(true);
}
else
{
ui.comments_no->setChecked(true);
}
}
bool GxsGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
token = 0;
return false;
}
bool GxsGroupDialog::service_CompleteCreateGroup(const RsGroupMetaData &meta)
{
/* dummy function - for overloading */
return true;
}
void GxsGroupDialog::completeCreateGroup(const RsGroupMetaData &newMeta)
{
std::cerr << "GxsGroupDialog::completeCreateGroup() Created Group with MetaData: ";
std::cerr << std::endl;
std::cerr << newMeta;
std::cerr << std::endl;
sendShareList(newMeta.mGroupId);
service_CompleteCreateGroup(newMeta);
std::cerr << "GxsGroupDialog::completeCreateGroup() Should Close!";
std::cerr << std::endl;
close();
}
void GxsGroupDialog::cancelDialog()
{
std::cerr << "GxsGroupDialog::cancelDialog() Should Close!";
std::cerr << std::endl;
close();
}
void GxsGroupDialog::addGroupLogo()
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Group Logo"), 64, 64);
if (img.isNull())
return;
picture = img;
// to show the selected
ui.groupLogo->setIcon(picture);
}
/***********************************************************************************
Share Lists.
***********************************************************************************/
void GxsGroupDialog::sendShareList(std::string groupId)
{
if (!mRsService)
{
std::cerr << "GxsGroupDialog::sendShareList() GXS Service not active";
std::cerr << std::endl;
return;
}
if (ui.pubKeyShare_cb->isChecked())
{
std::list<std::string> shareList;
ui.keyShareList->selectedSslIds(shareList, false);
mRsService->groupShareKeys(groupId, shareList);
}
close();
}
void GxsGroupDialog::setShareList()
{
if (ui.pubKeyShare_cb->isChecked()){
this->resize(this->size().width() + ui.contactsdockWidget->size().width(), this->size().height());
ui.contactsdockWidget->show();
} else { // hide share widget
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
}
/***********************************************************************************
Handle Callbacks for Load / Create.
***********************************************************************************/
void GxsGroupDialog::loadNewGroupId(const uint32_t &token)
{
std::cerr << "GxsGroupDialog::loadNewGroupId()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
mRsService->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
completeCreateGroup(fi);
}
else
{
std::cerr << "GxsGroupDialog::loadNewGroupId() ERROR INVALID Number of Forums Created";
std::cerr << std::endl;
}
}
void GxsGroupDialog::service_loadExistingGroup(const uint32_t &token)
{
std::cerr << "GxsGroupDialog::service_loadExistingGroup() ERROR Must be Overloaded";
std::cerr << std::endl;
#if 0
std::list<RsGroupMetaData> groupInfo;
mRsService->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
completeCreateGroup(fi);
}
else
{
std::cerr << "GxsGroupDialog::loadNewGroupId() ERROR INVALID Number of Forums Created";
std::cerr << std::endl;
}
#endif
}
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue != mTokenQueue)
{
std::cerr << "GxsGroupDialog::loadRequest() Queue ERROR";
std::cerr << std::endl;
return;
}
/* now switch on req */
switch(req.mUserType)
{
case GXSGROUP_NEWGROUPID:
loadNewGroupId(req.mToken);
break;
case GXSGROUP_LOADGROUP:
service_loadExistingGroup(req.mToken);
break;
default:
std::cerr << "GxsGroupDialog::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}

View file

@ -0,0 +1,176 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _GXS_GROUP_DIALOG_H
#define _GXS_GROUP_DIALOG_H
#include "ui_GxsGroupDialog.h"
#include "util/TokenQueue.h"
/********
* Notes:
*
* This is a generic Group Dialog, which is expected to be overloaded to include
* specific data for a specific service.
*
* To acheive this, we have a GxsGroupExtension widget
* - programmatically added to the GUI.
* - called to fill in fields in the Data Structures.
*
* To enable extension, we have a bunch of flags so various options can
* be shown / disabled for each specific service.
* - Enabled.
* - Defaults.
* - ReadOnly
*
* This form will be used for Create/Edit & View of Group Info.
*/
class GxsGroupExtension: public QWidget
{
public:
GxsGroupExtension() : QWidget() { return; }
};
#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_EXTRA 0x00000100
#define GXS_GROUP_DEFAULTS_DISTRIB_MASK 0x0000000f
#define GXS_GROUP_DEFAULTS_PUBLISH_MASK 0x000000f0
#define GXS_GROUP_DEFAULTS_PERSONAL_MASK 0x00000f00
#define GXS_GROUP_DEFAULTS_COMMENTS_MASK 0x0000f000
#define GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC 0x00000001
#define GXS_GROUP_DEFAULTS_DISTRIB_GROUP 0x00000002
#define GXS_GROUP_DEFAULTS_DISTRIB_LOCAL 0x00000004
#define GXS_GROUP_DEFAULTS_PUBLISH_OPEN 0x00000010
#define GXS_GROUP_DEFAULTS_PUBLISH_THREADS 0x00000020
#define GXS_GROUP_DEFAULTS_PUBLISH_REQUIRED 0x00000040
#define GXS_GROUP_DEFAULTS_PUBLISH_ENCRYPTED 0x00000080
#define GXS_GROUP_DEFAULTS_PERSONAL_PGP 0x00000100
#define GXS_GROUP_DEFAULTS_PERSONAL_REQUIRED 0x00000200
#define GXS_GROUP_DEFAULTS_PERSONAL_IFNOPUB 0x00000400
#define GXS_GROUP_DEFAULTS_COMMENTS_YES 0x00001000
#define GXS_GROUP_DEFAULTS_COMMENTS_NO 0x00002000
#define GXS_GROUP_DIALOG_CREATE_MODE 1
#define GXS_GROUP_DIALOG_SHOW_MODE 2
#define GXS_GROUP_DIALOG_EDIT_MODE 3
class GxsGroupDialog : public QDialog, public TokenResponse
{
Q_OBJECT
public:
GxsGroupDialog(RsTokenService *service, QWidget *parent = 0);
void setFlags(uint32_t enabledFlags, uint32_t readonlyFlags, uint32_t defaultFlags);
void setMode(uint32_t mode);
/*** Open Window -> in Correct Mode */
void newGroup();
void existingGroup(std::string groupId, uint32_t mode);
// Callback for all Loads.
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
// Functions that can be overloaded for specific stuff.
protected slots:
void submitGroup();
void addGroupLogo();
protected:
// Functions to be overloaded.
// Group Creation.
virtual bool service_NewGroup();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_CompleteCreateGroup(const RsGroupMetaData &meta);
// Group Edit / Display.
virtual bool service_ExistingGroup(); // Initial Setup.
virtual void service_loadExistingGroup(const uint32_t &token);
bool loadExistingGroupMetaData(const RsGroupMetaData &meta);
private slots:
/* actions to take.... */
void cancelDialog();
// set private forum key share list
void setShareList();
private:
void setGroupSignFlags(uint32_t signFlags);
uint32_t getGroupSignFlags();
void setupDefaults();
void setupVisibility();
void clearForm();
void createGroup();
virtual void completeCreateGroup(const RsGroupMetaData &newForumMeta);
void sendShareList(std::string forumId);
void loadNewGroupId(const uint32_t &token);
std::list<std::string> mShareList;
QPixmap picture;
RsTokenService *mRsService;
TokenQueue *mTokenQueue;
uint32_t mMode;
uint32_t mEnabledFlags;
uint32_t mReadonlyFlags;
uint32_t mDefaultsFlags;
/** Qt Designer generated object */
Ui::GxsGroupDialog ui;
};
#endif

View file

@ -0,0 +1,560 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GxsGroupDialog</class>
<widget class="QDialog" name="GxsGroupDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>695</width>
<height>658</height>
</rect>
</property>
<property name="windowTitle">
<string>Create new Forum</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/rstray3.png</normaloff>:/images/rstray3.png</iconset>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QFrame#frame_2{background-image: url(:/images/connect/connectFriendBanner.png);}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelicon">
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/konversation64.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="textlabelcreatforums">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;&quot;&gt;New Group&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QGroupBox" name="groupBoxLogo">
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QToolButton" name="groupLogo">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">
border: 2px solid white;
border-radius: 10px;
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/channels.png</normaloff>:/images/channels.png</iconset>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="groupName"/>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="addLogoButton">
<property name="text">
<string>Add Icon</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="pubKeyShare_cb">
<property name="toolTip">
<string>Key recipients can publish to restricted-type channels, and can view and publish for private-type channels</string>
</property>
<property name="text">
<string>Share Publish Key</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="3" rowspan="8">
<widget class="QDockWidget" name="contactsdockWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>524287</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>check peers you would like to share private publish key with</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Share Key With</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>4</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="groupDescLabel">
<property name="text">
<string>Description</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="groupDesc"/>
</item>
</layout>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="distribGroupBox">
<property name="title">
<string>Message Distribution</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QRadioButton" name="typePublic">
<property name="text">
<string>Public</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeGroup">
<property name="text">
<string>Restricted to Group</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeLocal">
<property name="text">
<string>Only For Your Friends</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QComboBox" name="groupComboBox">
<item>
<property name="text">
<string>Select Group of Friends</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="editGroupsButton">
<property name="text">
<string>Edit Groups</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="publishGroupBox">
<property name="title">
<string>Publish Signatures</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="publish_open">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_threads">
<property name="text">
<string>New Thread</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_required">
<property name="text">
<string>Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="publish_encrypt">
<property name="text">
<string>Encrypted Msgs</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QGroupBox" name="personalGroupBox">
<property name="title">
<string>Personal Signatures</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="personal_pgp">
<property name="text">
<string>PGP Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_required">
<property name="text">
<string>Signature Required</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="personal_ifnopub">
<property name="text">
<string>If No Publish Signature</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QGroupBox" name="commentGroupBox">
<property name="title">
<string>Comments</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="comments_allowed">
<property name="text">
<string>Allow Comments</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="comments_no">
<property name="text">
<string>No Comments</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QFrame" name="extraFrame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>238</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QPushButton" name="createButton">
<property name="text">
<string>Create</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,100 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "PostedGroupDialog.h"
#include <retroshare/rsposted.h>
#include <iostream>
PostedGroupDialog::PostedGroupDialog(QWidget *parent)
:GxsGroupDialog(rsPosted, parent)
{
// 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_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);
}
bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
// Specific Function.
RsPostedGroup grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
rsPosted->submitGroup(token, grp, true);
return true;
}
void PostedGroupDialog::service_loadExistingGroup(const uint32_t &token)
{
std::cerr << "PostedGroupDialog::service_loadExistingGroup()";
std::cerr << std::endl;
RsPostedGroup group;
if (!rsPosted->getGroup(token, group))
{
std::cerr << "PostedGroupDialog::service_loadExistingGroup() ERROR Getting Group";
std::cerr << std::endl;
return;
}
/* must call metadata loader */
loadExistingGroupMetaData(group.mMeta);
/* now load any extra data we feel like */
}

View file

@ -0,0 +1,44 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _POSTED_GROUP_DIALOG_H
#define _POSTED_GROUP_DIALOG_H
#include "GxsGroupDialog.h"
class PostedGroupDialog : public GxsGroupDialog
{
Q_OBJECT
public:
PostedGroupDialog(QWidget *parent);
protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
// virtual bool service_CompleteCreateGroup(const RsGroupMetaData &meta);
virtual void service_loadExistingGroup(const uint32_t &token);
};
#endif

View file

@ -0,0 +1,100 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "WikiGroupDialog.h"
#include <retroshare/rswiki.h>
#include <iostream>
WikiGroupDialog::WikiGroupDialog(QWidget *parent)
:GxsGroupDialog(rsWiki, parent)
{
// 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_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);
}
bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
// Specific Function.
RsWikiGroup grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
rsWiki->createGroup(token, grp, true);
return true;
}
void WikiGroupDialog::service_loadExistingGroup(const uint32_t &token)
{
std::cerr << "WikiGroupDialog::service_loadExistingGroup()";
std::cerr << std::endl;
RsWikiGroup group;
if (!rsWiki->getGroupData(token, group))
{
std::cerr << "WikiGroupDialog::service_loadExistingGroup() ERROR Getting Group";
std::cerr << std::endl;
return;
}
/* must call metadata loader */
loadExistingGroupMetaData(group.mMeta);
/* now load any extra data we feel like */
}

View file

@ -0,0 +1,44 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2008 Robert Fernie
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _WIKI_GROUP_DIALOG_H
#define _WIKI_GROUP_DIALOG_H
#include "GxsGroupDialog.h"
class WikiGroupDialog : public GxsGroupDialog
{
Q_OBJECT
public:
WikiGroupDialog(QWidget *parent);
protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
// virtual bool service_CompleteCreateGroup(const RsGroupMetaData &meta);
virtual void service_loadExistingGroup(const uint32_t &token);
};
#endif