Applied changes from the trunk to the GXS forums.

Cleaned old and unused files.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5868 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-11-21 18:55:52 +00:00
parent ae0e93ac41
commit 55d562238e
44 changed files with 1744 additions and 9594 deletions

View file

@ -1,100 +0,0 @@
/****************************************************************
* 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

@ -1,44 +0,0 @@
/****************************************************************
* 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

@ -55,18 +55,26 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent, "Create New Forum")
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
{
}
GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, QWidget *parent)
:GxsGroupDialog(group.mMeta, GXS_GROUP_DIALOG_SHOW_MODE, parent)
:GxsGroupDialog(group.mMeta, GXS_GROUP_DIALOG_SHOW_MODE, parent)
{
return;
}
QString GxsForumGroupDialog::serviceHeader()
{
return tr("Create New Forum");
}
QPixmap GxsForumGroupDialog::serviceImage()
{
return QPixmap(":/images/konversation64.png");
}
bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
@ -78,5 +86,3 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
rsGxsForums->createGroup(token, grp);
return true;
}

View file

@ -35,7 +35,9 @@ public:
GxsForumGroupDialog(const RsGxsForumGroup &group, QWidget *parent);
protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual QString serviceHeader();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
};
#endif

View file

@ -50,27 +50,20 @@
#define GXSGROUP_LOADGROUP 2
/** Constructor */
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent, const QString &serviceHeader)
: QDialog(parent), mTokenQueue(tokenQueue), mMode(GXS_GROUP_DIALOG_CREATE_MODE), mEnabledFlags(enableFlags), mDefaultsFlags(defaultFlags), mReadonlyFlags(0)
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent)
: QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mTokenQueue(tokenQueue), mMode(GXS_GROUP_DIALOG_CREATE_MODE), mEnabledFlags(enableFlags), mDefaultsFlags(defaultFlags), mReadonlyFlags(0)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(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.buttonBox, SIGNAL(accepted()), this, SLOT(submitGroup()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(cancelDialog()));
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(!serviceHeader.isEmpty())
ui.mServiceHeader->setText(serviceHeader);
setWindowTitle(serviceHeader);
//ui.headerFrame->setHeaderImage(QPixmap(":/WikiPoos/images/resource-group-new_48.png"));
//ui.headerFrame->setHeaderText(tr("Create"));
if (!ui.pubKeyShare_cb->isChecked())
{
ui.contactsdockWidget->hide();
@ -93,13 +86,22 @@ GxsGroupDialog::GxsGroupDialog(const RsGroupMetaData &grpMeta, uint32_t mode, QW
ui.idChooser->loadIds(0,"");
}
void GxsGroupDialog::showEvent(QShowEvent*)
{
QString header = serviceHeader();
ui.headerFrame->setHeaderText(header);
setWindowTitle(header);
ui.headerFrame->setHeaderImage(serviceImage());
}
void GxsGroupDialog::setMode(uint32_t mode)
{
switch(mMode)
{
case GXS_GROUP_DIALOG_CREATE_MODE:
{
ui.createButton->setText(tr("Create Group"));
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Group"));
newGroup();
}
break;
@ -107,8 +109,7 @@ void GxsGroupDialog::setMode(uint32_t mode)
default:
case GXS_GROUP_DIALOG_SHOW_MODE:
{
ui.cancelButton->setVisible(false);
ui.createButton->setText(tr("Close"));
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
}
break;
//TODO
@ -354,7 +355,6 @@ uint32_t GxsGroupDialog::getGroupSignFlags()
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) {
@ -388,7 +388,6 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
}
}
void GxsGroupDialog::cancelDialog()
{
std::cerr << "GxsGroupDialog::cancelDialog() Should Close!";
@ -397,7 +396,6 @@ void GxsGroupDialog::cancelDialog()
close();
}
void GxsGroupDialog::addGroupLogo()
{
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Group Logo"), 64, 64);
@ -408,7 +406,7 @@ void GxsGroupDialog::addGroupLogo()
picture = img;
// to show the selected
ui.groupLogo->setIcon(picture);
ui.groupLogo->setPixmap(picture);
}
QPixmap GxsGroupDialog::getLogo()
@ -441,13 +439,13 @@ void GxsGroupDialog::setShareList()
}
}
void GxsGroupDialog::wikitype()
{
// hide logo Button/Label
ui.groupLogo->hide();
ui.addLogoButton->hide();
ui.headerImage->setPixmap(QPixmap(":/images/resource-group-new_48.png")) ;
ui.pubKeyShare_cb->setText(tr("Add Wiki Moderators"));
ui.contactsdockWidget->setWindowTitle(tr("Select Wiki Moderators"));
}
void GxsGroupDialog::wikitype()
{
// hide logo Button/Label
ui.groupLogo->hide();
ui.addLogoButton->hide();
ui.headerFrame->setHeaderImage(QPixmap(":/images/resource-group-new_48.png")) ;
ui.pubKeyShare_cb->setText(tr("Add Wiki Moderators"));
ui.contactsdockWidget->setWindowTitle(tr("Select Wiki Moderators"));
}

View file

@ -125,7 +125,7 @@ public:
* @param parent The parent dialog
* @param mode
*/
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent = NULL, const QString& serviceHeader = "");
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent = NULL);
/*!
* Contructs a GxsGroupDialog for display a group or editing
@ -134,11 +134,11 @@ public:
* @param parent
*/
GxsGroupDialog(const RsGroupMetaData& grpMeta, uint32_t mode = GXS_GROUP_DIALOG_SHOW_MODE, QWidget *parent = NULL);
void wikitype();
void wikitype();
private:
void newGroup();
void setMode(uint32_t mode);
void setMode(uint32_t mode);
// Functions that can be overloaded for specific stuff.
@ -147,6 +147,10 @@ protected slots:
void addGroupLogo();
protected:
virtual void showEvent(QShowEvent*);
virtual QString serviceHeader() = 0;
virtual QPixmap serviceImage() = 0;
/*!
* Main purpose is to help tansfer meta data to service

View file

@ -25,53 +25,7 @@
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="headerFrame">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<pointsize>11</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</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="headerImage">
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="mServiceHeader">
<property name="text">
<string>Create New</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="HeaderFrame" name="headerFrame"/>
</item>
<item row="2" column="0">
<widget class="QFrame" name="frame">
@ -103,7 +57,7 @@
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QToolButton" name="groupLogo">
<widget class="QLabel" name="groupLogo">
<property name="minimumSize">
<size>
<width>64</width>
@ -116,24 +70,17 @@
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">
border: 2px solid white;
border-radius: 10px;
</string>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string/>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/channels.png</normaloff>:/images/channels.png</iconset>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/channels.png</pixmap>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
@ -195,11 +142,7 @@ border-radius: 10px;
<item>
<widget class="QCheckBox" name="pubKeyShare_cb">
<property name="toolTip">
<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:'MS Shell Dlg 2'; font-size:8.25pt; 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-size:8pt;&quot;&gt;Key recipients can publish to restricted-type Wiki Group, and can view and publish for private-type channels&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Key recipients can publish to restricted-type Wiki Group, and can view and publish for private-type channels</string>
</property>
<property name="text">
<string>Share Publish Key</string>
@ -518,33 +461,10 @@ p, li { white-space: pre-wrap; }
</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>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
@ -554,26 +474,26 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<customwidgets>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
<customwidget>
<class>HeaderFrame</class>
<extends>QFrame</extends>
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FriendSelectionWidget</class>
<extends>QWidget</extends>
<header>gui/common/FriendSelectionWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdChooser</class>
<extends>QComboBox</extends>
<header>gui/gxs/GxsIdChooser.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
<include location="../WikiPoos/Wiki_images.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -21,31 +21,28 @@
#include "GxsIdTreeWidgetItem.h"
#include <algorithm>
#include <retroshare/rspeers.h>
#include <iostream>
/** Constructor */
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidget *parent)
:QTreeWidgetItem(parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent)
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
{
mTimer = new QTimer(this);
mTimer->setSingleShot(true);
connect(mTimer, SIGNAL(timeout()), this, SLOT(loadId()));
return;
init();
}
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(QTreeWidgetItem *parent)
:QTreeWidgetItem(parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
GxsIdTreeWidgetItem::GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent)
:RSTreeWidgetItem(compareRole, parent), QObject(NULL), mTimer(NULL), mCount(0), mColumn(0)
{
init();
}
void GxsIdTreeWidgetItem::init()
{
mTimer = new QTimer(this);
mTimer->setSingleShot(true);
connect(mTimer, SIGNAL(timeout()), this, SLOT(loadId()));
return;
}
void GxsIdTreeWidgetItem::setId(const RsGxsId &id, int column)
@ -135,7 +132,6 @@ void GxsIdTreeWidgetItem::loadId()
{
/* timer event to try again */
mTimer->setInterval(mCount * 1000);
mTimer->start();
mTimer->start();
}
}

View file

@ -23,17 +23,18 @@
#ifndef _GXS_ID_TREEWIDGETITEM_H
#define _GXS_ID_TREEWIDGETITEM_H
#include <QTreeWidget>
#include <QTimer>
#include <retroshare/rsidentity.h>
class GxsIdTreeWidgetItem : public QObject, public QTreeWidgetItem
#include "gui/common/RSTreeWidgetItem.h"
class GxsIdTreeWidgetItem : public QObject, public RSTreeWidgetItem
{
Q_OBJECT
Q_OBJECT
public:
GxsIdTreeWidgetItem(QTreeWidget *parent = NULL);
GxsIdTreeWidgetItem(QTreeWidgetItem *parent);
GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidget *parent = NULL);
GxsIdTreeWidgetItem(const RSTreeWidgetItemCompareRole *compareRole, QTreeWidgetItem *parent);
void setId(const RsGxsId &id, int column);
bool getId(RsGxsId &id);
@ -42,6 +43,7 @@ private slots:
void loadId();
private:
void init();
QTimer *mTimer;
RsGxsId mId;

View file

@ -52,7 +52,7 @@ uint32_t WikiCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC |
WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
:GxsGroupDialog(tokenQueue, WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent, "Create New Wiki Group")
:GxsGroupDialog(tokenQueue, WikiCreateEnabledFlags, WikiCreateDefaultsFlags, parent)
{
// To start with we only have open forums - with distribution controls.
@ -93,7 +93,6 @@ WikiGroupDialog::WikiGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent)
:GxsGroupDialog(collection.mMeta, GXS_GROUP_DIALOG_SHOW_MODE, parent)
{
#if 0
@ -118,6 +117,15 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa
}
QString WikiGroupDialog::serviceHeader()
{
return tr("Create New Wiki Group");
}
QPixmap WikiGroupDialog::serviceImage()
{
return QPixmap();
}
bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta)
{
@ -132,5 +140,3 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
return true;
}

View file

@ -35,7 +35,9 @@ public:
WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent);
protected:
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual QString serviceHeader();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
private: