mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
363374947f
commit
d27eea84da
@ -1,13 +1,14 @@
|
||||
CONFIG += qt gui uic qrc resources uitools idle bitdht
|
||||
|
||||
# Below is for GXS services.
|
||||
#CONFIG += photoshare
|
||||
#CONFIG += wikipoos
|
||||
#CONFIG += thewire
|
||||
#CONFIG += identities
|
||||
#CONFIG += forumsv2
|
||||
#CONFIG += posted
|
||||
#CONFIG += unfinished
|
||||
CONFIG += photoshare
|
||||
CONFIG += wikipoos
|
||||
CONFIG += thewire
|
||||
CONFIG += identities
|
||||
CONFIG += forumsv2
|
||||
CONFIG += posted
|
||||
CONFIG += unfinished
|
||||
CONFIG += gxsgui
|
||||
|
||||
|
||||
# Other Disabled Bits.
|
||||
@ -965,3 +966,26 @@ posted {
|
||||
gui/Posted/PostedComments.cpp \
|
||||
|
||||
}
|
||||
|
||||
gxsgui {
|
||||
|
||||
HEADERS += gui/gxs/GxsGroupDialog.h \
|
||||
gui/gxs/ForumV2GroupDialog.h \
|
||||
gui/gxs/WikiGroupDialog.h \
|
||||
gui/gxs/PostedGroupDialog.h \
|
||||
# gui/gxs/GxsMsgDialog.h \
|
||||
# gui/gxs/GxsCommentWidget.h \
|
||||
|
||||
FORMS += gui/gxs/GxsGroupDialog.ui \
|
||||
# gui/gxs/GxsMsgDialog.ui \
|
||||
# gui/gxs/GxsCommentWidget.ui \
|
||||
|
||||
SOURCES += gui/gxs/GxsGroupDialog.cpp \
|
||||
gui/gxs/ForumV2GroupDialog.cpp \
|
||||
gui/gxs/WikiGroupDialog.cpp \
|
||||
gui/gxs/PostedGroupDialog.cpp \
|
||||
# gui/gxs/GxsMsgDialog.cpp \
|
||||
# gui/gxs/GxsCommentWidget.cpp \
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,10 +28,9 @@
|
||||
|
||||
#include "ForumsV2Dialog.h"
|
||||
|
||||
#include "forumsv2/CreateForumV2.h"
|
||||
#include "gxs/ForumV2GroupDialog.h"
|
||||
|
||||
#include "forumsv2/CreateForumV2Msg.h"
|
||||
#include "forumsv2/ForumV2Details.h"
|
||||
#include "forumsv2/EditForumV2Details.h"
|
||||
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "settings/rsharesettings.h"
|
||||
@ -1499,7 +1498,9 @@ void ForumsV2Dialog::copyMessageLink()
|
||||
|
||||
void ForumsV2Dialog::newforum()
|
||||
{
|
||||
CreateForumV2 cf (this);
|
||||
ForumV2GroupDialog cf (this);
|
||||
cf.newGroup();
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
@ -1561,12 +1562,10 @@ void ForumsV2Dialog::showForumDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OTHERCLASSES
|
||||
ForumV2Details fui;
|
||||
ForumV2GroupDialog cf (this);
|
||||
cf.existingGroup(mCurrForumId, GXS_GROUP_DIALOG_SHOW_MODE);
|
||||
|
||||
fui.showDetails (mCurrForumId);
|
||||
fui.exec ();
|
||||
#endif
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void ForumsV2Dialog::editForumDetails()
|
||||
@ -1575,10 +1574,10 @@ void ForumsV2Dialog::editForumDetails()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OTHERCLASSES
|
||||
EditForumV2Details editUi(mCurrForumId, this);
|
||||
editUi.exec();
|
||||
#endif
|
||||
ForumV2GroupDialog cf (this);
|
||||
cf.existingGroup(mCurrForumId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include "PostedListDialog.h"
|
||||
|
||||
#include "gui/gxs/PostedGroupDialog.h"
|
||||
|
||||
//#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
@ -82,6 +84,18 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||
popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false);
|
||||
otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
|
||||
|
||||
ui.hotSortButton->setChecked(true);
|
||||
mSortButton = ui.hotSortButton;
|
||||
|
||||
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newGroup() ) );
|
||||
|
||||
connect( ui.hotSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
connect( ui.newSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
connect( ui.topSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
|
||||
connect( ui.sortGroup, SIGNAL( buttonClicked( QAbstractButton * ) ), this, SLOT( sortButtonClicked( QAbstractButton * ) ) );
|
||||
connect( ui.periodComboBox, SIGNAL( currentIndexChanged ( int index ) ), this, SLOT( periodChanged ( int ) ) );
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
@ -177,6 +191,122 @@ void PostedListDialog::changedTopic(const QString &id)
|
||||
insertThreads();
|
||||
}
|
||||
|
||||
void PostedListDialog::sortButtonPressed()
|
||||
{
|
||||
std::cerr << "PostedListDialog::sortButtonPressed()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QAbstractButton *pressed = NULL;
|
||||
if (ui.hotSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() Hot";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.hotSortButton;
|
||||
} else if (ui.newSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() New";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.newSortButton;
|
||||
} else if (ui.topSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() Top";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.topSortButton;
|
||||
}
|
||||
|
||||
if ((pressed) && (pressed != mSortButton))
|
||||
{
|
||||
mSortButton = pressed;
|
||||
sortButtonClicked( mSortButton );
|
||||
insertThreads();
|
||||
}
|
||||
}
|
||||
|
||||
void PostedListDialog::sortButtonClicked( QAbstractButton *button )
|
||||
{
|
||||
std::cerr << "PostedListDialog::sortButtonClicked( From Button Group! )";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t sortMode = RSPOSTED_VIEWMODE_HOT;
|
||||
|
||||
if (button == ui.hotSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_HOT;
|
||||
} else if (button == ui.newSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_LATEST;
|
||||
} else if (button == ui.topSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_TOP;
|
||||
}
|
||||
|
||||
rsPosted->setViewMode(sortMode);
|
||||
}
|
||||
|
||||
|
||||
void PostedListDialog::periodChanged( int index )
|
||||
{
|
||||
uint32_t periodMode = RSPOSTED_PERIOD_HOUR;
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
periodMode = RSPOSTED_PERIOD_HOUR;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
periodMode = RSPOSTED_PERIOD_DAY;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 2:
|
||||
periodMode = RSPOSTED_PERIOD_WEEK;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
periodMode = RSPOSTED_PERIOD_MONTH;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
periodMode = RSPOSTED_PERIOD_YEAR;
|
||||
break;
|
||||
}
|
||||
rsPosted->setViewPeriod(periodMode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** New / Edit Groups ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListDialog::newGroup()
|
||||
{
|
||||
PostedGroupDialog cf (this);
|
||||
cf.newGroup();
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void PostedListDialog::showGroupDetails()
|
||||
{
|
||||
if (mCurrTopicId.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PostedGroupDialog cf (this);
|
||||
cf.existingGroup(mCurrTopicId, GXS_GROUP_DIALOG_SHOW_MODE);
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void PostedListDialog::editGroupDetails()
|
||||
{
|
||||
if (mCurrTopicId.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PostedGroupDialog cf (this);
|
||||
cf.existingGroup(mCurrTopicId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** Request / Response of Data ********************************/
|
||||
@ -292,6 +422,8 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
|
||||
if (mThreadLoading)
|
||||
{
|
||||
/* Cleanup */
|
||||
std::cerr << "Already Loading -> must Clean ... TODO, retry in a moment";
|
||||
return;
|
||||
}
|
||||
|
||||
clearPosts();
|
||||
|
@ -54,6 +54,15 @@ private slots:
|
||||
void groupListCustomPopupMenu( QPoint /*point*/ );
|
||||
void changedTopic(const QString &id);
|
||||
|
||||
void sortButtonClicked( QAbstractButton *button );
|
||||
void sortButtonPressed();
|
||||
|
||||
void periodChanged( int index );
|
||||
|
||||
void newGroup();
|
||||
void showGroupDetails();
|
||||
void editGroupDetails();
|
||||
|
||||
private:
|
||||
|
||||
void clearPosts();
|
||||
@ -86,6 +95,8 @@ void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &
|
||||
QTreeWidgetItem *popularTopics;
|
||||
QTreeWidgetItem *otherTopics;
|
||||
|
||||
QAbstractButton *mSortButton;
|
||||
|
||||
bool mThreadLoading;
|
||||
std::string mCurrTopicId;
|
||||
|
||||
|
@ -13,28 +13,61 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="sortGroup">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hotSortButton">
|
||||
<property name="text">
|
||||
<string>Hot</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newSortButton">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="topSortButton">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoExclusive">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -51,7 +84,7 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<widget class="QComboBox" name="periodComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Today</string>
|
||||
@ -89,14 +122,14 @@
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="pushButton_7">
|
||||
<widget class="QPushButton" name="newTopicButton">
|
||||
<property name="text">
|
||||
<string>New Link Group</string>
|
||||
<string>New Topic</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pushButton_8">
|
||||
<widget class="QPushButton" name="newPostButton">
|
||||
<property name="text">
|
||||
<string>Submit Post</string>
|
||||
</property>
|
||||
@ -132,7 +165,7 @@
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<widget class="QPushButton" name="refreshButton">
|
||||
<property name="text">
|
||||
<string>Refresh</string>
|
||||
</property>
|
||||
@ -159,14 +192,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<widget class="QPushButton" name="prevButton">
|
||||
<property name="text">
|
||||
<string>Prev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<widget class="QPushButton" name="nextButton">
|
||||
<property name="text">
|
||||
<string>Next</string>
|
||||
</property>
|
||||
@ -184,10 +217,16 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>461</width>
|
||||
<height>330</height>
|
||||
<width>406</width>
|
||||
<height>333</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "gui/WikiPoos/WikiAddDialog.h"
|
||||
#include "gui/WikiPoos/WikiEditDialog.h"
|
||||
|
||||
#include "gui/gxs/WikiGroupDialog.h"
|
||||
|
||||
#include <retroshare/rswiki.h>
|
||||
|
||||
#include <iostream>
|
||||
@ -131,6 +133,7 @@ void WikiDialog::OpenOrShowAddPageDialog()
|
||||
|
||||
void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
{
|
||||
#if 0
|
||||
if (mAddGroupDialog)
|
||||
{
|
||||
mAddGroupDialog->show();
|
||||
@ -140,8 +143,58 @@ void WikiDialog::OpenOrShowAddGroupDialog()
|
||||
mAddGroupDialog = new WikiAddDialog(NULL);
|
||||
mAddGroupDialog->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
newGroup();
|
||||
}
|
||||
|
||||
/*********************** **** **** **** ***********************/
|
||||
/** New / Edit Groups ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void WikiDialog::newGroup()
|
||||
{
|
||||
WikiGroupDialog cf (this);
|
||||
cf.newGroup();
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void WikiDialog::showGroupDetails()
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
if (groupId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::showGroupDetails() No Group selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WikiGroupDialog cf (this);
|
||||
cf.existingGroup(groupId, GXS_GROUP_DIALOG_SHOW_MODE);
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void WikiDialog::editGroupDetails()
|
||||
{
|
||||
std::string groupId = getSelectedGroup();
|
||||
if (groupId == "")
|
||||
{
|
||||
std::cerr << "WikiDialog::editGroupDetails() No Group selected";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
WikiGroupDialog cf (this);
|
||||
cf.existingGroup(groupId, GXS_GROUP_DIALOG_EDIT_MODE);
|
||||
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WikiDialog::OpenOrShowEditDialog()
|
||||
{
|
||||
|
@ -55,6 +55,10 @@ private slots:
|
||||
void groupTreeChanged();
|
||||
void modTreeChanged();
|
||||
|
||||
void newGroup();
|
||||
void showGroupDetails();
|
||||
void editGroupDetails();
|
||||
|
||||
private:
|
||||
|
||||
void clearWikiPage();
|
||||
|
100
retroshare-gui/src/gui/gxs/ForumV2GroupDialog.cpp
Normal file
100
retroshare-gui/src/gui/gxs/ForumV2GroupDialog.cpp
Normal 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 */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
44
retroshare-gui/src/gui/gxs/ForumV2GroupDialog.h
Normal file
44
retroshare-gui/src/gui/gxs/ForumV2GroupDialog.h
Normal 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
|
||||
|
638
retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp
Normal file
638
retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp
Normal 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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
176
retroshare-gui/src/gui/gxs/GxsGroupDialog.h
Normal file
176
retroshare-gui/src/gui/gxs/GxsGroupDialog.h
Normal 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
|
||||
|
560
retroshare-gui/src/gui/gxs/GxsGroupDialog.ui
Normal file
560
retroshare-gui/src/gui/gxs/GxsGroupDialog.ui
Normal 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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial'; font-size:24pt; font-weight:600; color:#ffffff;">New Group</span></p></body></html></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>
|
100
retroshare-gui/src/gui/gxs/PostedGroupDialog.cpp
Normal file
100
retroshare-gui/src/gui/gxs/PostedGroupDialog.cpp
Normal 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 */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
44
retroshare-gui/src/gui/gxs/PostedGroupDialog.h
Normal file
44
retroshare-gui/src/gui/gxs/PostedGroupDialog.h
Normal 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
|
||||
|
100
retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp
Normal file
100
retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp
Normal 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 */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
44
retroshare-gui/src/gui/gxs/WikiGroupDialog.h
Normal file
44
retroshare-gui/src/gui/gxs/WikiGroupDialog.h
Normal 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
|
||||
|
Loading…
Reference in New Issue
Block a user