Updated forumV2 support forms to latest version (from forums/)

* Can now create new forum & post/reply messages. 
 	Flags have not been finished for these.
 * Edit/Details are not yet complete.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5347 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-07-28 21:09:53 +00:00
parent 17da89938f
commit ceb4298208
10 changed files with 475 additions and 251 deletions

View File

@ -127,6 +127,18 @@ static int FilterColumnToComboBox(int nIndex)
return FilterColumnToComboBox(COLUMN_THREAD_TITLE);
}
/*
* Transformation Notes:
* there are still a couple of things that the new forums differ from Old version.
* these will need to be addressed in the future.
* -> Missing Messages are not handled yet.
* -> Child TS (for sorting) is not handled by GXS, this will probably have to be done in the GUI.
* -> Need to handle IDs properly.
* -> Popularity not handled in GXS yet.
* -> Much more to do.
*/
/** Constructor */
ForumsV2Dialog::ForumsV2Dialog(QWidget *parent)
: RsAutoUpdatePage(1000,parent)
@ -1484,14 +1496,11 @@ void ForumsV2Dialog::copyMessageLink()
}
}
//#define DISABLE_OTHERCLASSES 1
void ForumsV2Dialog::newforum()
{
#ifndef DISABLE_OTHERCLASSES
CreateForumV2 cf (this);
cf.exec ();
#endif
}
void ForumsV2Dialog::createmessage()
@ -1500,10 +1509,8 @@ void ForumsV2Dialog::createmessage()
return;
}
#ifndef DISABLE_OTHERCLASSES
CreateForumV2Msg *cfm = new CreateForumV2Msg(mCurrForumId, mCurrThreadId);
cfm->show();
#endif
/* window will destroy itself! */
}
@ -1515,11 +1522,9 @@ void ForumsV2Dialog::createthread()
return;
}
#ifndef DISABLE_OTHERCLASSES
CreateForumV2Msg *cfm = new CreateForumV2Msg(mCurrForumId, "");
cfm->setWindowTitle(tr("Start New Thread"));
cfm->show();
#endif
/* window will destroy itself! */
}

View File

@ -80,6 +80,9 @@ public:
/* overloaded from RsAuthUpdatePage */
virtual void updateDisplay();
// Callback for all Loads.
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
protected:
bool eventFilter(QObject *obj, QEvent *ev);
@ -199,9 +202,6 @@ private:
bool convertMsgToThreadWidget(const RsForumV2Msg &msgInfo, std::string authorName,
bool useChildTS, uint32_t filterColumn, QTreeWidgetItem *item);
// Callback for all Loads.
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
TokenQueue *mForumQueue;

View File

@ -27,34 +27,42 @@
#include <algorithm>
#include <retroshare/rsforums.h>
#include <retroshare/rsforumsV2.h>
#include <retroshare/rspeers.h>
#include <iostream>
#define CREATEFORUMSV2_NEWFORUMID 1
/** Constructor */
CreateForumV2::CreateForumV2(QWidget *parent)
: QDialog(parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) );
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) );
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
connect( ui.keyShareList, SIGNAL(itemChanged( QTreeWidgetItem *, int ) ),
this, SLOT(togglePersonItem( QTreeWidgetItem *, int ) ));
mForumQueue = new TokenQueue(rsForumsV2, this);
if(!ui.pubKeyShare_cb->isChecked()){
// connect up the buttons.
connect( ui.cancelButton, SIGNAL( clicked ( bool ) ), this, SLOT( cancelForum( ) ) );
connect( ui.createButton, SIGNAL( clicked ( bool ) ), this, SLOT( createForum( ) ) );
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
if (!ui.pubKeyShare_cb->isChecked()) {
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
this->size().height());
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
newForum();
/* initialize key share list */
ui.keyShareList->setHeaderText(tr("Contacts:"));
ui.keyShareList->setModus(FriendSelectionWidget::MODUS_CHECK);
ui.keyShareList->start();
newForum();
}
void CreateForumV2::newForum()
void CreateForumV2::newForum()
{
/* enforce Public for the moment */
ui.typePublic->setChecked(true);
@ -72,156 +80,151 @@ void CreateForumV2::newForum()
ui.forumName->clear();
ui.forumDesc->clear();
ui.forumName->setFocus();
}
void CreateForumV2::togglePersonItem( QTreeWidgetItem *item, int /*col*/ )
{
/* extract id */
std::string id = (item -> text(1)).toStdString();
/* get state */
bool checked = (Qt::Checked == item -> checkState(0)); /* alway column 0 */
/* call control fns */
std::list<std::string>::iterator lit = std::find(mShareList.begin(), mShareList.end(), id);
if(checked && (lit == mShareList.end())){
// make sure ids not added already
mShareList.push_back(id);
}else
if(lit != mShareList.end()){
mShareList.erase(lit);
}
return;
}
void CreateForumV2::createForum()
void CreateForumV2::createForum()
{
QString name = misc::removeNewLine(ui.forumName->text());
QString desc = ui.forumDesc->toPlainText(); //toHtml();
uint32_t flags = 0;
if(name.isEmpty())
{ /* error message */
QMessageBox::warning(this, "RetroShare",
tr("Please add a Name"),
QMessageBox::Ok, QMessageBox::Ok);
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!!
}
else
if (ui.typePublic->isChecked())
{
if (ui.typePublic->isChecked()) {
flags |= RS_DISTRIB_PUBLIC;
}
else if (ui.typePrivate->isChecked())
{
} else if (ui.typePrivate->isChecked()) {
flags |= RS_DISTRIB_PRIVATE;
}
else if (ui.typeEncrypted->isChecked())
{
} else if (ui.typeEncrypted->isChecked()) {
flags |= RS_DISTRIB_ENCRYPTED;
}
if (ui.msgAuth->isChecked())
{
if (ui.msgAuth->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_REQ;
}
else if (ui.msgAnon->isChecked())
{
} else if (ui.msgAnon->isChecked()) {
flags |= RS_DISTRIB_AUTHEN_ANON;
}
if (rsForums)
{
std::string forumId = rsForums->createForum(name.toStdWString(),
desc.toStdWString(), flags);
if (rsForumsV2) {
uint32_t token;
RsForumV2Group grp;
grp.mMeta.mGroupName = std::string(name.toUtf8());
grp.mDescription = std::string(desc.toUtf8());
grp.mMeta.mGroupFlags = flags;
rsForumsV2->createGroup(token, grp, true);
// get the Queue to handle response.
mForumQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_SUMMARY, CREATEFORUMSV2_NEWFORUMID);
if(ui.pubKeyShare_cb->isChecked())
rsForums->forumShareKeys(forumId, mShareList);
}
}
void CreateForumV2::completeCreateNewForum(const RsGroupMetaData &newForumMeta)
{
sendShareList(newForumMeta.mGroupId);
close();
}
void CreateForumV2::setShareList(){
if(ui.pubKeyShare_cb->isChecked()){
this->resize(this->size().width() + ui.contactsdockWidget->size().width(),
this->size().height());
ui.contactsdockWidget->show();
if (!rsPeers)
{
/* not ready yet! */
return;
}
std::list<std::string> peers;
std::list<std::string>::iterator it;
rsPeers->getFriendList(peers);
/* get a link to the table */
QTreeWidget *shareWidget = ui.keyShareList;
QList<QTreeWidgetItem *> items;
for(it = peers.begin(); it != peers.end(); it++)
{
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*it, detail))
{
continue; /* BAD */
}
/* make a widget per friend */
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
item -> setText(0, PeerDefs::nameWithLocation(detail));
if (detail.state & RS_PEER_STATE_CONNECTED) {
item -> setTextColor(0,(Qt::darkBlue));
}
item -> setSizeHint(0, QSize( 17,17 ) );
item -> setText(1, QString::fromStdString(detail.id));
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item -> setCheckState(0, Qt::Unchecked);
/* add to the list */
items.append(item);
}
/* remove old items */
shareWidget->clear();
shareWidget->setColumnCount(1);
/* add the items in! */
shareWidget->insertTopLevelItems(0, items);
shareWidget->update(); /* update display */
}else{ // hide share widget
ui.contactsdockWidget->hide();
this->resize(this->size().width() - ui.contactsdockWidget->size().width(),
this->size().height());
mShareList.clear();
void CreateForumV2::sendShareList(std::string forumId)
{
if (!rsForumsV2)
{
std::cerr << "CreateForumV2::sendShareList() ForumsV2 not active";
std::cerr << std::endl;
return;
}
if (ui.pubKeyShare_cb->isChecked())
{
std::list<std::string> shareList;
ui.keyShareList->selectedSslIds(shareList, false);
rsForumsV2->groupShareKeys(forumId, shareList);
}
close();
}
void CreateForumV2::cancelForum()
void CreateForumV2::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());
}
}
void CreateForumV2::cancelForum()
{
close();
}
void CreateForumV2::loadNewForumId(const uint32_t &token)
{
std::cerr << "CreateForumV2::loadNewForumId()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsForumsV2->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
completeCreateNewForum(fi);
}
else
{
std::cerr << "CreateForumV2::loadNewForumId() ERROR INVALID Number of Forums Created";
std::cerr << std::endl;
}
}
void CreateForumV2::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "CreateForumV2::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue == mForumQueue)
{
/* now switch on req */
switch(req.mUserType)
{
case CREATEFORUMSV2_NEWFORUMID:
loadNewForumId(req.mToken);
break;
default:
std::cerr << "CreateForumV2::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}
}

View File

@ -25,36 +25,42 @@
#include "ui_CreateForumV2.h"
class CreateForumV2 : public QDialog
#include "util/TokenQueue.h"
class CreateForumV2 : public QDialog, public TokenResponse
{
Q_OBJECT
Q_OBJECT
public:
CreateForumV2(QWidget *parent = 0);
CreateForumV2(QWidget *parent = 0);
void newForum(); /* cleanup */
void newForum(); /* cleanup */
/** Qt Designer generated object */
Ui::CreateForumV2 ui;
QPixmap picture;
// Callback for all Loads.
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots:
/* actions to take.... */
void createForum();
void cancelForum();
void createForum();
void cancelForum();
// set private forum key share list
void setShareList();
// when user checks a person in share list checkboxes
void togglePersonItem(QTreeWidgetItem* item, int col);
// set private forum key share list
void setShareList();
private:
void sendShareList(std::string forumId);
void completeCreateNewForum(const RsGroupMetaData &newForumMeta);
void loadNewForumId(const uint32_t &token);
std::list<std::string> mShareList;
std::list<std::string> mShareList;
QPixmap picture;
TokenQueue *mForumQueue;
/** Qt Designer generated object */
Ui::CreateForumV2 ui;
};
#endif

View File

@ -160,7 +160,7 @@ p, li { white-space: pre-wrap; }
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTreeWidget" name="keyShareList">
<widget class="FriendSelectionWidget" name="keyShareList" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -191,14 +191,6 @@ p, li { white-space: pre-wrap; }
<height>0</height>
</size>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Contacts:</string>
</property>
</column>
</widget>
</item>
</layout>
@ -267,7 +259,7 @@ p, li { white-space: pre-wrap; }
<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>
<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 Private Publish Key</string>
@ -367,6 +359,14 @@ p, li { white-space: pre-wrap; }
</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>

View File

@ -28,7 +28,8 @@
#include <QDropEvent>
#include <QPushButton>
#include <retroshare/rsforums.h>
#include <retroshare/rsforumsV2.h>
#include <retroshare/rspeers.h>
#include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h"
@ -37,6 +38,11 @@
#include "util/misc.h"
#include <sys/stat.h>
#include <iostream>
#define CREATEFORUMV2MSG_FORUMINFO 1
#define CREATEFORUMV2MSG_PARENTMSG 2
/** Constructor */
@ -47,6 +53,9 @@ CreateForumV2Msg::CreateForumV2Msg(std::string fId, std::string pId)
ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
/* Setup Queue */
mForumQueue = new TokenQueue(rsForumsV2, this);
Settings->loadWidgetInformation(this);
connect( ui.forumMessage, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumMessageCostumPopupMenu( QPoint ) ) );
@ -64,6 +73,9 @@ CreateForumV2Msg::CreateForumV2Msg(std::string fId, std::string pId)
ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(false);
mParentMsgLoaded = false;
mForumMetaLoaded = false;
newMsg();
}
@ -75,6 +87,7 @@ void CreateForumV2Msg::forumMessageCostumPopupMenu( QPoint /*point*/ )
contextMnu->addSeparator();
QAction *pasteLinkAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste RetroShare Link"), this, SLOT(pasteLink()));
QAction *pasteLinkFullAct = contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste full RetroShare Link"), this, SLOT(pasteLinkFull()));
contextMnu->addAction(QIcon(":/images/pasterslink.png"), tr("Paste own certificate link"), this, SLOT(pasteOwnCertificateLink()));
if (RSLinkClipboard::empty()) {
pasteLinkAct->setDisabled (true);
@ -88,60 +101,126 @@ void CreateForumV2Msg::forumMessageCostumPopupMenu( QPoint /*point*/ )
void CreateForumV2Msg::newMsg()
{
/* clear all */
ForumInfo fi;
if (rsForums->getForumInfo(mForumId, fi))
{
ForumMsgInfo msg;
mParentMsgLoaded = false;
mForumMetaLoaded = false;
QString name = QString::fromStdWString(fi.forumName);
QString subj;
if ((mParentId != "") && (rsForums->getForumMessage(mForumId, mParentId, msg)))
{
QString title = QString::fromStdWString(msg.title);
name += " " + tr("In Reply to") + ": ";
name += title;
/* request Data */
{
RsTokReqOptions opts;
QString text = title;
std::list<std::string> groupIds;
groupIds.push_back(mForumId);
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
subj = title;
}
else
{
subj = "Re: " + title;
}
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
std::cerr << std::endl;
}
uint32_t token;
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEFORUMV2MSG_FORUMINFO);
ui.forumName->setText(misc::removeNewLine(name));
ui.forumSubject->setText(misc::removeNewLine(subj));
}
if (!ui.forumSubject->text().isEmpty())
{
ui.forumMessage->setFocus();
}
else
{
ui.forumSubject->setFocus();
}
if (mParentId != "")
{
if (fi.forumFlags & RS_DISTRIB_AUTHEN_REQ)
{
ui.signBox->setChecked(true);
ui.signBox->setEnabled(false);
}
else
{
/* Uncheck sign box by default for anonymous forums */
ui.signBox->setChecked(false);
ui.signBox->setEnabled(true);
}
}
RsTokReqOptions opts;
std::list<std::string> msgIds;
msgIds.push_back(mParentId);
std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
std::cerr << std::endl;
uint32_t token;
mForumQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, CREATEFORUMV2MSG_PARENTMSG);
}
}
void CreateForumV2Msg::saveForumInfo(const RsGroupMetaData &meta)
{
mForumMeta = meta;
mForumMetaLoaded = true;
loadFormInformation();
}
void CreateForumV2Msg::saveParentMsg(const RsForumV2Msg &msg)
{
mParentMsg = msg;
mParentMsgLoaded = true;
loadFormInformation();
}
void CreateForumV2Msg::loadFormInformation()
{
if ((!mParentMsgLoaded) && (mParentId != ""))
{
std::cerr << "CreateForumV2Msg::loadMsgInformation() ParentMsg not Loaded Yet";
std::cerr << std::endl;
return;
}
if (!mForumMetaLoaded)
{
std::cerr << "CreateForumV2Msg::loadMsgInformation() ForumMeta not Loaded Yet";
std::cerr << std::endl;
return;
}
std::cerr << "CreateForumV2Msg::loadMsgInformation() Data Available!";
std::cerr << std::endl;
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
QString subj;
if (mParentId != "")
{
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
name += " " + tr("In Reply to") + ": ";
name += title;
QString text = title;
if (text.startsWith("Re:", Qt::CaseInsensitive))
{
subj = title;
}
else
{
subj = "Re: " + title;
}
}
ui.forumName->setText(misc::removeNewLine(name));
ui.forumSubject->setText(misc::removeNewLine(subj));
if (!ui.forumSubject->text().isEmpty())
{
ui.forumMessage->setFocus();
}
else
{
ui.forumSubject->setFocus();
}
if (mForumMeta.mGroupFlags & RS_DISTRIB_AUTHEN_REQ)
{
ui.signBox->setChecked(true);
ui.signBox->setEnabled(false);
}
else
{
/* Uncheck sign box by default for anonymous forums */
ui.signBox->setChecked(false);
ui.signBox->setEnabled(true);
}
ui.forumMessage->setText("");
}
void CreateForumV2Msg::createMsg()
{
QString name = misc::removeNewLine(ui.forumSubject->text());
@ -158,30 +237,56 @@ void CreateForumV2Msg::createMsg()
return; //Don't add a empty Subject!!
}
ForumMsgInfo msgInfo;
RsForumV2Msg msg;
msg.mMeta.mGroupId = mForumId;
msg.mMeta.mParentId = mParentId;
msg.mMeta.mMsgId = "";
if (mParentMsgLoaded)
{
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
}
msgInfo.forumId = mForumId;
msgInfo.threadId = "";
msgInfo.parentId = mParentId;
msgInfo.msgId = "";
msg.mMeta.mMsgName = std::string(name.toUtf8());
msg.mMsg = std::string(desc.toUtf8());
msg.mMeta.mMsgFlags = RS_DISTRIB_AUTHEN_REQ;
msgInfo.title = name.toStdWString();
msgInfo.msg = desc.toStdWString();
msgInfo.msgflags = 0;
if (ui.signBox->isChecked())
{
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
}
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
if ((msg.mMsg == "") && (msg.mMeta.mMsgName == ""))
return; /* do nothing */
if (rsForums->ForumMessageSend(msgInfo) == true) {
close();
}
uint32_t token;
rsForumsV2->createMsg(token, msg, true);
close();
// Previous Info - for reference.
//ForumMsgInfo msgInfo;
//msgInfo.forumId = mForumId;
//msgInfo.threadId = "";
//msgInfo.parentId = mParentId;
//msgInfo.msgId = "";
//msgInfo.title = name.toStdWString();
//msgInfo.msg = desc.toStdWString();
//msgInfo.msgflags = 0;
//if (ui.signBox->isChecked())
//{
// msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
//}
//if ((msgInfo.msg == L"") && (msgInfo.title == L""))
// return; /* do nothing */
//if (rsForumsV2->ForumMessageSend(msgInfo) == true) {
// close();
//}
}
void CreateForumV2Msg::closeEvent (QCloseEvent * /*event*/)
{
Settings->saveWidgetInformation(this);
@ -245,3 +350,75 @@ void CreateForumV2Msg::pasteLinkFull()
{
ui.forumMessage->insertHtml(RSLinkClipboard::toHtmlFull()) ;
}
void CreateForumV2Msg::pasteOwnCertificateLink()
{
RetroShareLink link ;
std::string ownId = rsPeers->getOwnId() ;
if( link.createCertificate(ownId) ) {
ui.forumMessage->insertHtml(link.toHtml() + " ");
}
}
void CreateForumV2Msg::loadForumInfo(const uint32_t &token)
{
std::cerr << "CreateForumV2Msg::loadForumInfo()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsForumsV2->getGroupSummary(token, groupInfo);
if (groupInfo.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
saveForumInfo(fi);
}
else
{
std::cerr << "CreateForumV2Msg::loadForumInfo() ERROR INVALID Number of Forums";
std::cerr << std::endl;
}
}
void CreateForumV2Msg::loadParentMsg(const uint32_t &token)
{
std::cerr << "CreateForumV2Msg::loadParentMsg()";
std::cerr << std::endl;
// Only grab one.... ignore more (shouldn't be any).
RsForumV2Msg msg;
rsForumsV2->getMsgData(token, msg);
saveParentMsg(msg);
}
void CreateForumV2Msg::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "CreateForumV2::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue == mForumQueue)
{
/* now switch on req */
switch(req.mUserType)
{
case CREATEFORUMV2MSG_FORUMINFO:
loadForumInfo(req.mToken);
break;
case CREATEFORUMV2MSG_PARENTMSG:
loadParentMsg(req.mToken);
break;
default:
std::cerr << "CreateForumV2::loadRequest() UNKNOWN UserType ";
std::cerr << std::endl;
}
}
}

View File

@ -25,7 +25,12 @@
#include "ui_CreateForumV2Msg.h"
class CreateForumV2Msg : public QMainWindow
#include "util/TokenQueue.h"
#include <retroshare/rsforumsv2.h>
class CreateForumV2Msg : public QMainWindow, public TokenResponse
{
Q_OBJECT
@ -33,6 +38,7 @@ public:
CreateForumV2Msg(std::string fId, std::string pId);
void newMsg(); /* cleanup */
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private slots:
/** Create the context popup menu and it's submenus */
@ -44,6 +50,7 @@ private slots:
void cancelMsg();
void pasteLink();
void pasteLinkFull();
void pasteOwnCertificateLink();
void smileyWidgetForums();
void addSmileys();
@ -53,9 +60,24 @@ protected:
void closeEvent (QCloseEvent * event);
private:
void saveForumInfo(const RsGroupMetaData &meta);
void saveParentMsg(const RsForumV2Msg &msg);
void loadFormInformation();
void loadForumInfo(const uint32_t &token);
void loadParentMsg(const uint32_t &token);
std::string mForumId;
std::string mParentId;
bool mParentMsgLoaded;
bool mForumMetaLoaded;
RsForumV2Msg mParentMsg;
RsGroupMetaData mForumMeta;
TokenQueue *mForumQueue;
/** Qt Designer generated object */
Ui::CreateForumV2Msg ui;
};

View File

@ -21,7 +21,7 @@
#include "EditForumV2Details.h"
#include <retroshare/rsforums.h>
#include <retroshare/rsforumsV2.h>
#include "util/misc.h"
@ -44,23 +44,27 @@ EditForumV2Details::EditForumV2Details(std::string forumId, QWidget *parent, Qt:
void EditForumV2Details::loadForum()
{
if (!rsForums) {
if (!rsForumsV2) {
return;
}
#warning "EditForumV2Details incomplete"
#if 0
ForumInfo info;
rsForums->getForumInfo(m_forumId, info);
rsForumsV2->getForumInfo(m_forumId, info);
// set name
ui.nameline->setText(QString::fromStdWString(info.forumName));
// set description
ui.DescriptiontextEdit->setText(QString::fromStdWString(info.forumDesc));
#endif
}
void EditForumV2Details::applyDialog()
{
if (!rsForums) {
if (!rsForumsV2) {
return;
}
@ -69,12 +73,16 @@ void EditForumV2Details::applyDialog()
return;
}
#warning "EditForumV2Details incomplete"
#if 0
ForumInfo info;
info.forumName = misc::removeNewLine(ui.nameline->text()).toStdWString();
info.forumDesc = ui.DescriptiontextEdit->document()->toPlainText().toStdWString();
rsForums->setForumInfo(m_forumId, info);
rsForumsV2->setForumInfo(m_forumId, info);
#endif
/* close the Dialog after the Changes applied */
close();

View File

@ -23,12 +23,11 @@
#include <retroshare/rsiface.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsdisc.h>
#include <retroshare/rsforums.h>
#include <retroshare/rsforumsV2.h>
#include <QTime>
#include <QDateTime>
#include <sstream>
#include <list>
#include <iostream>
#include <string>
@ -91,13 +90,15 @@ void ForumV2Details::showDetails(std::string mCurrForumId)
void ForumV2Details::loadDialog()
{
if (!rsForums)
if (!rsForumsV2)
{
return;
}
#warning "ForumV2Details Incomplete"
#if 0
ForumInfo fi;
rsForums->getForumInfo(fId, fi);
rsForumsV2->getForumInfo(fId, fi);
// Set Forum Name
ui.nameline->setText(QString::fromStdWString(fi.forumName));
@ -129,6 +130,8 @@ void ForumV2Details::loadDialog()
ui.radioButton_authd->setChecked(false);
ui.radioButton_anonymous->setChecked(true);
}
#endif
}
void ForumV2Details::applyDialog()

View File

@ -121,7 +121,7 @@
<item row="0" column="0">
<widget class="QRadioButton" name="radioButton_authd">
<property name="text">
<string>Authemticated Messages</string>
<string>Authenticated Messages</string>
</property>
</widget>
</item>