- Revert remove of forum settings

- Added process of description in GxsGroupDialog (forum, wiki, channel, posted)
- Show forum description in GsxForumThreadWidget when no thread is selected
- Updated some todo's

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7277 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-04-14 22:36:10 +00:00
parent 0be1f8ee98
commit 06ef59856f
21 changed files with 467 additions and 397 deletions

View File

@ -107,12 +107,11 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
return true;
}
bool PostedGroupDialog::service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta)
bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
{
RsPostedGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
grp.mDescription = getDescription().toUtf8().constData();
std::cerr << "PostedGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl;
@ -121,31 +120,31 @@ bool PostedGroupDialog::service_EditGroup(uint32_t &token,
return true;
}
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
{
std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsPostedGroup> groups;
if (!rsPosted->getGroupData(token, groups))
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
std::vector<RsPostedGroup> groups;
if (!rsPosted->getGroupData(token, groups))
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
description = QString::fromUtf8(groups[0].mDescription.c_str());
return true;
}

View File

@ -39,9 +39,8 @@ protected:
virtual void initUi();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
private:
RsPostedGroup mTopic;

View File

@ -130,7 +130,7 @@ void PostedListDialog::updateShowText()
void PostedListDialog::getRankings()
{
if(mCurrTopicId.isNull())
if(mCurrTopicId.isNull())
return;
std::cerr << "PostedListDialog::getRankings()";
@ -168,12 +168,12 @@ void PostedListDialog::getRankings()
void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/)
{
if (mCurrTopicId.isNull())
if (mCurrTopicId.isNull())
{
return;
}
uint32_t subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mCurrTopicId.toStdString()));
uint32_t subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mCurrTopicId.toStdString()));
QMenu contextMnu(this);
@ -201,10 +201,10 @@ void PostedListDialog::groupListCustomPopupMenu(QPoint /*point*/)
void PostedListDialog::newPost()
{
if(mCurrTopicId.isNull())
if(mCurrTopicId.isNull())
return;
uint32_t subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mCurrTopicId.toStdString()));
uint32_t subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mCurrTopicId.toStdString()));
bool isSubscribed = IS_GROUP_SUBSCRIBED(subscribeFlags);
if (isSubscribed)
@ -219,7 +219,7 @@ void PostedListDialog::unsubscribeTopic()
std::cerr << "PostedListDialog::unsubscribeTopic()";
std::cerr << std::endl;
if(mCurrTopicId.isNull())
if(mCurrTopicId.isNull())
return;
uint32_t token;
@ -232,7 +232,7 @@ void PostedListDialog::subscribeTopic()
std::cerr << "PostedListDialog::subscribeTopic()";
std::cerr << std::endl;
if(mCurrTopicId.isNull())
if(mCurrTopicId.isNull())
return;
uint32_t token;
@ -281,7 +281,7 @@ void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
uint32_t token;
rsPosted->createVote(token, vote);
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
}
}
/*****************************************************************************************/
// Overloaded from FeedHolder.
@ -382,23 +382,23 @@ void PostedListDialog::showTopic()
return;
}
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_SHOW, mCurrTopicId, this);
cf.exec ();
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_SHOW, mCurrTopicId, this);
cf.exec ();
}
void PostedListDialog::editTopic()
{
if (mCurrTopicId.isNull()) {
return;
}
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_EDIT, mCurrTopicId, this);
cf.exec ();
PostedGroupDialog cf(mPostedQueue, rsPosted->getTokenService(), GxsGroupDialog::MODE_EDIT, mCurrTopicId, this);
cf.exec ();
}
void PostedListDialog::showGroupDetails()
{
if (mCurrTopicId.isNull())
if (mCurrTopicId.isNull())
{
return;
}
@ -423,7 +423,7 @@ void PostedListDialog::requestGroupSummary()
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
/* refresh Id Chooser Too */
RsGxsId currentId ;
RsGxsId currentId ;
ui.idChooser->getChosenId(currentId);
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, currentId);
}
@ -433,7 +433,7 @@ void PostedListDialog::acknowledgeGroup(const uint32_t &token)
RsGxsGroupId grpId;
rsPosted->acknowledgeGrp(token, grpId);
if(!grpId.isNull())
if(!grpId.isNull())
{
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
@ -493,7 +493,7 @@ void PostedListDialog::requestGroupSummary_CurrentForum(const RsGxsGroupId &foru
{
RsTokReqOptions opts;
std::list<RsGxsGroupId> grpIds;
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(forumId);
std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
@ -538,7 +538,7 @@ void PostedListDialog::loadCurrentTopicThreads(const RsGxsGroupId &topicId)
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
std::cerr << std::endl;
if (topicId.isNull())
if (topicId.isNull())
{
std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
std::cerr << std::endl;
@ -852,12 +852,12 @@ void PostedListDialog::acknowledgeSubscribeChange(const uint32_t &token)
/*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/
void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "PostedListDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
if (queue == mPostedQueue)
{
/* now switch on req */
@ -951,7 +951,7 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
{
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
groupItemInfo.popularity = groupInfo.mPop;
@ -1033,7 +1033,6 @@ void PostedListDialog::todo()
QMessageBox::information(this, "Todo",
"<b>Open points:</b><ul>"
"<li>Subreddits/tag to posts support"
"<li>Edit Topics"
"<li>Picture Support"
"</ul>");
}

View File

@ -62,8 +62,6 @@
#define WIKIDIALOG_EDITTREE_DATA 9
/* Images for TreeWidget (Copied from GxsForums.cpp) */
#define IMAGE_FOLDER ":/images/folder16.png"
#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
@ -101,7 +99,6 @@ WikiDialog::WikiDialog(QWidget *parent)
connect( ui.treeWidget_Pages, SIGNAL(itemSelectionChanged()), this, SLOT(groupTreeChanged()));
// GroupTreeWidget.
connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString)));
@ -121,9 +118,8 @@ WikiDialog::WikiDialog(QWidget *parent)
mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(IMAGE_FOLDERGREEN), false);
mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(IMAGE_FOLDERYELLOW), false);
//Auto refresh seems not to work, temporary solution at start
insertWikiGroups();
//Auto refresh seems not to work, temporary solution at start
insertWikiGroups();
}
void WikiDialog::checkUpdate()
@ -140,11 +136,10 @@ void WikiDialog::checkUpdate()
return;
}
void WikiDialog::OpenOrShowAddPageDialog()
{
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
{
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() No Group selected";
std::cerr << std::endl;
@ -159,14 +154,12 @@ void WikiDialog::OpenOrShowAddPageDialog()
std::cerr << "WikiDialog::OpenOrShowAddPageDialog() GroupId: " << groupId;
std::cerr << std::endl;
mEditDialog->setupData(groupId, RsGxsMessageId());
mEditDialog->setupData(groupId, RsGxsMessageId());
mEditDialog->setNewPage();
mEditDialog->show();
}
void WikiDialog::OpenOrShowAddGroupDialog()
{
newGroup();
@ -178,46 +171,43 @@ void WikiDialog::OpenOrShowAddGroupDialog()
void WikiDialog::newGroup()
{
WikiGroupDialog cf(mWikiQueue, this);
cf.exec ();
WikiGroupDialog cf(mWikiQueue, this);
cf.exec ();
}
void WikiDialog::showGroupDetails()
{
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
{
std::cerr << "WikiDialog::showGroupDetails() No Group selected";
std::cerr << std::endl;
return;
}
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_SHOW, groupId, this);
cf.exec ();
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_SHOW, groupId, this);
cf.exec ();
}
void WikiDialog::editGroupDetails()
{
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
RsGxsGroupId groupId = getSelectedGroup();
if (groupId.isNull())
{
std::cerr << "WikiDialog::editGroupDetails() No Group selected";
std::cerr << std::endl;
return;
}
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_EDIT, groupId, this);
cf.exec ();
WikiGroupDialog cf(mWikiQueue, rsWiki->getTokenService(), GxsGroupDialog::MODE_EDIT, groupId, this);
cf.exec ();
}
void WikiDialog::OpenOrShowEditDialog()
{
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
if (!getSelectedPage(groupId, pageId, origPageId))
{
@ -242,9 +232,9 @@ void WikiDialog::OpenOrShowRepublishDialog()
{
OpenOrShowEditDialog();
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
if (!getSelectedPage(groupId, pageId, origPageId))
{
@ -260,13 +250,12 @@ void WikiDialog::OpenOrShowRepublishDialog()
mEditDialog->setRepublishMode(origPageId);
}
void WikiDialog::groupTreeChanged()
{
/* */
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
RsGxsGroupId groupId;
RsGxsMessageId pageId;
RsGxsMessageId origPageId;
getSelectedPage(groupId, pageId, origPageId);
if (pageId == mPageSelected)
@ -274,15 +263,15 @@ void WikiDialog::groupTreeChanged()
return; /* nothing changed */
}
if (pageId.isNull())
if (pageId.isNull())
{
/* clear Mods */
clearGroupTree();
return;
}
RsGxsGrpMsgIdPair origPagePair = std::make_pair(groupId, origPageId);
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
RsGxsGrpMsgIdPair origPagePair = std::make_pair(groupId, origPageId);
RsGxsGrpMsgIdPair pagepair = std::make_pair(groupId, pageId);
requestWikiPage(pagepair);
}
@ -306,19 +295,16 @@ void WikiDialog::updateWikiPage(const RsWikiSnapshot &page)
#endif
}
void WikiDialog::clearWikiPage()
{
ui.textBrowser->setPlainText("");
}
void WikiDialog::clearGroupTree()
{
ui.treeWidget_Pages->clear();
}
#define WIKI_GROUP_COL_GROUPNAME 0
#define WIKI_GROUP_COL_GROUPID 1
@ -326,7 +312,6 @@ void WikiDialog::clearGroupTree()
#define WIKI_GROUP_COL_PAGEID 1
#define WIKI_GROUP_COL_ORIGPAGEID 2
bool WikiDialog::getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId, RsGxsMessageId &origPageId)
{
#ifdef WIKI_DEBUG
@ -347,13 +332,13 @@ bool WikiDialog::getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId,
/* check if it has changed */
groupId = getSelectedGroup();
if (groupId.isNull())
if (groupId.isNull())
{
return false;
}
pageId = item->text(WIKI_GROUP_COL_PAGEID).toStdString();
origPageId = RsGxsMessageId(item->text(WIKI_GROUP_COL_ORIGPAGEID).toStdString());
origPageId = RsGxsMessageId(item->text(WIKI_GROUP_COL_ORIGPAGEID).toStdString());
#ifdef WIKI_DEBUG
std::cerr << "WikiDialog::getSelectedPage() PageId: " << pageId << std::endl;
@ -361,7 +346,6 @@ bool WikiDialog::getSelectedPage(RsGxsGroupId &groupId, RsGxsMessageId &pageId,
return true;
}
const RsGxsGroupId& WikiDialog::getSelectedGroup()
{
#ifdef WIKI_DEBUG
@ -370,7 +354,6 @@ const RsGxsGroupId& WikiDialog::getSelectedGroup()
return mGroupId;
}
/************************** Request / Response *************************/
/*** Loading Main Index ***/
@ -379,7 +362,6 @@ void WikiDialog::insertWikiGroups()
requestGroupMeta();
}
void WikiDialog::requestGroupMeta()
{
std::cerr << "WikiDialog::requestGroupMeta()";
@ -392,7 +374,6 @@ void WikiDialog::requestGroupMeta()
mWikiQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, WIKIDIALOG_LISTING_GROUPMETA);
}
void WikiDialog::loadGroupMeta(const uint32_t &token)
{
std::cerr << "WikiDialog::loadGroupMeta()";
@ -400,25 +381,24 @@ void WikiDialog::loadGroupMeta(const uint32_t &token)
std::list<RsGroupMetaData> groupMeta;
if (!rsWiki->getGroupSummary(token, groupMeta))
{
std::cerr << "WikiDialog::loadGroupMeta() Error getting GroupMeta";
std::cerr << std::endl;
return;
}
if (!rsWiki->getGroupSummary(token, groupMeta))
{
std::cerr << "WikiDialog::loadGroupMeta() Error getting GroupMeta";
std::cerr << std::endl;
return;
}
if (groupMeta.size() > 0)
{
insertGroupsData(groupMeta);
}
else
{
std::cerr << "WikiDialog::loadGroupMeta() ERROR No Groups...";
std::cerr << std::endl;
}
if (groupMeta.size() > 0)
{
insertGroupsData(groupMeta);
}
else
{
std::cerr << "WikiDialog::loadGroupMeta() ERROR No Groups...";
std::cerr << std::endl;
}
}
void WikiDialog::requestPages(const std::list<RsGxsGroupId> &groupIds)
{
std::cerr << "WikiDialog::requestPages()";
@ -431,7 +411,6 @@ void WikiDialog::requestPages(const std::list<RsGxsGroupId> &groupIds)
mWikiQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, WIKIDIALOG_LISTING_PAGES);
}
void WikiDialog::loadPages(const uint32_t &token)
{
std::cerr << "WikiDialog::loadPages()";
@ -440,8 +419,6 @@ void WikiDialog::loadPages(const uint32_t &token)
clearGroupTree();
clearWikiPage();
QTreeWidgetItem *groupItem = NULL;
std::vector<RsWikiSnapshot> snapshots;
std::vector<RsWikiSnapshot>::iterator vit;
if (!rsWiki->getSnapshots(token, snapshots))
@ -460,8 +437,8 @@ void WikiDialog::loadPages(const uint32_t &token)
QTreeWidgetItem *pageItem = new QTreeWidgetItem();
pageItem->setText(WIKI_GROUP_COL_PAGENAME, QString::fromStdString(page.mMeta.mMsgName));
pageItem->setText(WIKI_GROUP_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId.toStdString()));
pageItem->setText(WIKI_GROUP_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId.toStdString()));
pageItem->setText(WIKI_GROUP_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId.toStdString()));
pageItem->setText(WIKI_GROUP_COL_ORIGPAGEID, QString::fromStdString(page.mMeta.mOrigMsgId.toStdString()));
ui.treeWidget_Pages->addTopLevelItem(pageItem);
}
@ -522,8 +499,6 @@ void WikiDialog::loadWikiPage(const uint32_t &token)
updateWikiPage(page);
}
void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "WikiDialog::loadRequest() UserType: " << req.mUserType;
@ -557,32 +532,28 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
}
}
}
/************************** Group Widget Stuff *********************************/
void WikiDialog::subscribeToGroup()
{
wikiSubscribe(true);
wikiSubscribe(true);
}
void WikiDialog::unsubscribeToGroup()
{
wikiSubscribe(false);
wikiSubscribe(false);
}
void WikiDialog::wikiSubscribe(bool subscribe)
{
if (mGroupId.isNull()) {
return;
}
if (mGroupId.isNull()) {
return;
}
uint32_t token;
rsWiki->subscribeToGroup(token, mGroupId, subscribe);
uint32_t token;
rsWiki->subscribeToGroup(token, mGroupId, subscribe);
}
@ -590,25 +561,23 @@ void WikiDialog::wikiGroupChanged(const QString &groupId)
{
mGroupId = groupId.toStdString();
if (mGroupId.isNull()) {
return;
}
if (mGroupId.isNull()) {
return;
}
std::list<RsGxsGroupId> groupIds;
groupIds.push_back(mGroupId);
requestPages(groupIds);
int subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
int subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
ui.toolButton_NewPage->setEnabled(IS_GROUP_ADMIN(subscribeFlags));
ui.toolButton_Republish->setEnabled(IS_GROUP_ADMIN(subscribeFlags));
}
void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
{
int subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
int subscribeFlags = ui.groupTreeWidget->subscribeFlags(QString::fromStdString(mGroupId.toStdString()));
QMenu contextMnu(this);
@ -625,10 +594,10 @@ void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
std::cerr << std::endl;
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Group"), this, SLOT(subscribeToGroup()));
action->setDisabled (mGroupId.isNull() || IS_GROUP_SUBSCRIBED(subscribeFlags));
action->setDisabled (mGroupId.isNull() || IS_GROUP_SUBSCRIBED(subscribeFlags));
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Group"), this, SLOT(unsubscribeToGroup()));
action->setEnabled (!mGroupId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
action->setEnabled (!mGroupId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
contextMnu.addSeparator();
@ -636,7 +605,7 @@ void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
action->setEnabled (!mGroupId.isNull());
action = contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Wiki Group"), this, SLOT(editGroupDetails()));
action->setEnabled (!mGroupId.isNull() && IS_GROUP_ADMIN(subscribeFlags));
action->setEnabled (!mGroupId.isNull() && IS_GROUP_ADMIN(subscribeFlags));
/************** NOT ENABLED YET *****************/
@ -665,10 +634,6 @@ void WikiDialog::groupListCustomPopupMenu(QPoint /*point*/)
contextMnu.exec(QCursor::pos());
}
void WikiDialog::insertGroupsData(const std::list<RsGroupMetaData> &wikiList)
{
std::list<RsGroupMetaData>::const_iterator it;
@ -725,13 +690,11 @@ void WikiDialog::insertGroupsData(const std::list<RsGroupMetaData> &wikiList)
ui.groupTreeWidget->fillGroupItems(mSubscribedGroups, subList);
ui.groupTreeWidget->fillGroupItems(mPopularGroups, popList);
ui.groupTreeWidget->fillGroupItems(mOtherGroups, otherList);
}
void WikiDialog::GroupMetaDataToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
{
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
//groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
groupItemInfo.popularity = groupInfo.mPop;
@ -746,6 +709,5 @@ void WikiDialog::todo()
QMessageBox::information(this, "Todo",
"<b>Open points:</b><ul>"
"<li>Auto update Group trees"
"<li>Edit Groups"
"</ul>");
}

View File

@ -136,7 +136,7 @@ void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
case UITYPE_CONTACTS_DOCK:
ui.contactsdockWidget->setWindowTitle(text);
break;
case UITYPE_BUTTONBOX_OK:
case UITYPE_BUTTONBOX_OK:
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(text);
break;
}
@ -150,7 +150,7 @@ void GxsGroupDialog::initMode()
case MODE_CREATE:
{
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Forum"));
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Forum"));
newGroup();
}
break;
@ -162,6 +162,7 @@ void GxsGroupDialog::initMode()
requestGroup(mGrpMeta.mGroupId);
}
break;
case MODE_EDIT:
{
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
@ -172,7 +173,6 @@ void GxsGroupDialog::initMode()
}
}
void GxsGroupDialog::clearForm()
{
ui.groupName->clear();
@ -267,45 +267,27 @@ void GxsGroupDialog::setupDefaults()
void GxsGroupDialog::setupVisibility()
{
{
ui.groupName->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_NAME);
}
{
ui.groupLogo->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
}
ui.groupName->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_NAME);
{
ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.groupDescLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
}
ui.groupLogo->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
{
ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION);
}
ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.groupDescLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
{
ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN);
}
ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION);
{
ui.pubKeyShare_cb->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS);
}
ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN);
{
ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
}
ui.pubKeyShare_cb->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS);
{
ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
}
ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
{
ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
}
ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
}
void GxsGroupDialog::setAllReadonly()
{
uint32_t origReadonlyFlags = mReadonlyFlags;
@ -316,59 +298,39 @@ void GxsGroupDialog::setAllReadonly()
mReadonlyFlags = origReadonlyFlags;
}
void GxsGroupDialog::setupReadonly()
{
{
ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
}
{
ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
}
ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
{
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
}
ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
{
ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
}
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
{
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
}
ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
{
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
}
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
{
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
}
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
{
ui.commentGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS));
}
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
{
ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
}
ui.commentGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS));
ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
}
void GxsGroupDialog::newGroup()
{
setupDefaults();
setupVisibility();
setupReadonly();
clearForm();
}
void GxsGroupDialog::updateFromExistingMeta()
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl;
@ -386,6 +348,9 @@ void GxsGroupDialog::updateFromExistingMeta()
/* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* set description */
ui.groupDesc->setPlainText(description);
switch(mGrpMeta.mCircleType)
{
case GXS_CIRCLE_TYPE_YOUREYESONLY:
@ -405,12 +370,12 @@ void GxsGroupDialog::updateFromExistingMeta()
std::cerr << std::endl;
break;
}
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
updateCircleOptions();
}
void GxsGroupDialog::submitGroup()
{
std::cerr << "GxsGroupDialog::submitGroup()";
@ -475,7 +440,6 @@ void GxsGroupDialog::editGroup()
close();
}
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
{
std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
@ -510,7 +474,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
std::cerr << " External: " << meta.mCircleId;
std::cerr << std::endl;
ui.idChooser->getChosenId(meta.mAuthorId);
ui.idChooser->getChosenId(meta.mAuthorId);
return true;
}
@ -524,9 +488,9 @@ void GxsGroupDialog::createGroup()
if(name.isEmpty())
{
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
/* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!!
}
uint32_t token;
@ -610,8 +574,6 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
}
}
/**** Above logic is flawed, and will be removed shortly
*
*
@ -681,8 +643,6 @@ bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
return true;
}
void GxsGroupDialog::cancelDialog()
{
std::cerr << "GxsGroupDialog::cancelDialog() Should Close!";
@ -711,16 +671,15 @@ QPixmap GxsGroupDialog::getLogo()
QString GxsGroupDialog::getDescription()
{
return ui.groupDesc->document()->toPlainText();
return ui.groupDesc->toPlainText();
}
/***********************************************************************************
Share Lists.
***********************************************************************************/
void GxsGroupDialog::sendShareList(std::string groupId)
void GxsGroupDialog::sendShareList(std::string /*groupId*/)
{
(void) groupId;
close();
}
@ -735,8 +694,6 @@ void GxsGroupDialog::setShareList()
}
}
/***********************************************************************************
Loading Group.
***********************************************************************************/
@ -756,28 +713,18 @@ void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP);
}
void GxsGroupDialog::loadGroup(uint32_t token)
{
std::cerr << "GxsGroupDialog::loadGroup(" << token << ")";
std::cerr << std::endl;
if (service_loadGroup(token, mMode, mGrpMeta))
QString description;
if (service_loadGroup(token, mMode, mGrpMeta, description))
{
updateFromExistingMeta();
updateFromExistingMeta(description);
}
}
bool GxsGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{
(void) mode;
(void) groupMetaData;
std::cerr << "GxsGroupDialog::service_loadGroup(" << token << ") NOT IMPLEMENTED";
std::cerr << std::endl;
return false;
}
void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType;
@ -798,8 +745,3 @@ void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &re
}
}
}

View File

@ -168,24 +168,23 @@ protected:
void setUiText(UiType uiType, const QString &text);
/*!
* It is up to the service to do the actual group creation
* Service can also modify initial meta going into group
* It is up to the service to do the actual group creation
* Service can also modify initial meta going into group
* @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value
*/
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0;
/*!
* It is up to the service to do the actual group editing
* @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value
*/
virtual bool service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta) = 0;
/*!
* It is up to the service to do the actual group editing
* @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value
*/
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) = 0;
// To be overloaded by users.
// use Token to retrieve from service, fill in metaData.
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description) = 0;
/*!
* This returns a group logo from the ui \n
@ -198,8 +197,8 @@ protected:
* This returns a group description string from the ui
* @return group description string
*/
virtual QString getDescription();
QString getDescription();
private slots:
/* actions to take.... */
@ -222,14 +221,14 @@ private:
void setupVisibility();
void clearForm();
void createGroup();
void editGroup();
void editGroup();
void sendShareList(std::string forumId);
void loadNewGroupId(const uint32_t &token);
// loading existing Groups.
void requestGroup(const RsGxsGroupId &groupId);
void loadGroup(uint32_t token);
void updateFromExistingMeta();
void updateFromExistingMeta(const QString &description);
bool prepareGroupMetaData(RsGroupMetaData &meta);
@ -245,7 +244,7 @@ private:
uint32_t mReadonlyFlags;
uint32_t mDefaultsFlags;
protected:
protected:
/** Qt Designer generated object */
Ui::GxsGroupDialog ui;

View File

@ -98,7 +98,7 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
// Specific Function.
RsWikiCollection grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
grp.mDescription = getDescription().toStdString();
std::cerr << "WikiGroupDialog::service_CreateGroup() storing to Queue";
std::cerr << std::endl;
@ -107,11 +107,11 @@ bool WikiGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaData
return true;
}
bool WikiGroupDialog::service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta)
bool WikiGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
{
RsWikiCollection grp;
grp.mMeta = editedMeta;
grp.mDescription = getDescription().toStdString();
std::cerr << "WikiGroupDialog::service_EditGroup() submitting changes.";
std::cerr << std::endl;
@ -120,31 +120,31 @@ bool WikiGroupDialog::service_EditGroup(uint32_t &token,
return true;
}
bool WikiGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
bool WikiGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
{
std::cerr << "WikiGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::cerr << "WikiGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsWikiCollection> groups;
if (!rsWiki->getCollections(token, groups))
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
std::vector<RsWikiCollection> groups;
if (!rsWiki->getCollections(token, groups))
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "WikiGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "WikisGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
std::cerr << "WikisGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
description = QString::fromUtf8(groups[0].mDescription.c_str());
return true;
}

View File

@ -40,9 +40,8 @@ protected:
virtual void initUi();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGroupMetaData& groupMetaData);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData& groupMetaData);
private:

View File

@ -130,7 +130,6 @@ void GxsChannelDialog::todo()
"<li>Restore channel keys"
"<li>Copy/navigate channel link"
"<li>Display count of unread messages"
"<li>Show/Edit channel details"
"<li>Set all as read"
"<li>Set read/unread status"
"</ul>");

View File

@ -98,19 +98,17 @@ bool GxsChannelGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMe
// Specific Function.
RsGxsChannelGroup grp;
grp.mMeta = meta;
//grp.mDescription = std::string(desc.toUtf8());
grp.mDescription = getDescription().toUtf8().constData();
rsGxsChannels->createGroup(token, grp);
return true;
}
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta)
bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
{
RsGxsChannelGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
grp.mDescription = getDescription().toUtf8().constData();
std::cerr << "GxsChannelGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl;
@ -119,31 +117,31 @@ bool GxsChannelGroupDialog::service_EditGroup(uint32_t &token,
return true;
}
bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::cerr << "GxsChannelGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsGxsChannelGroup> groups;
if (!rsGxsChannels->getGroupData(token, groups))
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
std::vector<RsGxsChannelGroup> groups;
if (!rsGxsChannels->getGroupData(token, groups))
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "GxsChannelGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
std::cerr << "GxsChannelsGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
description = QString::fromUtf8(groups[0].mDescription.c_str());
return true;
}

View File

@ -37,9 +37,8 @@ protected:
virtual void initUi();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
};

View File

@ -99,18 +99,17 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta
// Specific Function.
RsGxsForumGroup grp;
grp.mMeta = meta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
grp.mDescription = getDescription().toUtf8().constData();
rsGxsForums->createGroup(token, grp);
return true;
}
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta)
bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
{
RsGxsForumGroup grp;
grp.mMeta = editedMeta;
grp.mDescription = std::string(ui.groupDesc->toPlainText().toUtf8());
grp.mDescription = getDescription().toUtf8().constData();
std::cerr << "GxsForumGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl;
@ -119,34 +118,31 @@ bool GxsForumGroupDialog::service_EditGroup(uint32_t &token,
return true;
}
bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
{
std::cerr << "GxsForumGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::cerr << "GxsForumGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl;
std::vector<RsGxsForumGroup> groups;
if (!rsGxsForums->getGroupData(token, groups))
{
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
std::vector<RsGxsForumGroup> groups;
if (!rsGxsForums->getGroupData(token, groups))
{
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
if (groups.size() != 1)
{
std::cerr << "GxsForumGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl;
return false;
}
std::cerr << "GxsForumsGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
std::cerr << "GxsForumsGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl;
groupMetaData = groups[0].mMeta;
description = QString::fromUtf8(groups[0].mDescription.c_str());
return true;
}

View File

@ -37,9 +37,8 @@ protected:
virtual void initUi();
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData);
virtual bool service_EditGroup(uint32_t &token,
RsGroupMetaData &editedMeta);
virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description);
virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta);
};

View File

@ -804,7 +804,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
item->setText(COLUMN_THREAD_DATE, text);
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
//#TODO
#if 0
@ -910,14 +910,14 @@ void GxsForumThreadWidget::insertThreads()
}
// Get Current Forum Info... then complete insertForumThreads().
requestGroupSummary_CurrentForum(mForumId);
requestGroup_CurrentForum(mForumId);
}
void GxsForumThreadWidget::insertForumThreads(const RsGroupMetaData &fi)
void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
{
mSubscribeFlags = fi.mSubscribeFlags;
ui->forumName->setText(QString::fromUtf8(fi.mGroupName.c_str()));
// mForumDescription = QString::fromUtf8(fi.mDescription); // not available
mSubscribeFlags = group.mMeta.mSubscribeFlags;
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
mForumDescription = QString::fromUtf8(group.mDescription.c_str());
ui->progressBar->reset();
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, true);
@ -1551,7 +1551,7 @@ void GxsForumThreadWidget::createthread()
static QString buildReplyHeader(const RsMsgMetaData &meta)
{
RetroShareLink link;
//link.createMessage(meta.mAuthorId, "");
link.createMessage(meta.mAuthorId, "");
QString from = link.toHtml();
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumsDialog", "Original Message"));
@ -1587,15 +1587,14 @@ void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg)
return;
}
// NB: TODO REMOVE rsPeers references.
if (rsPeers->getPeerName(RsPeerId(msg.mMeta.mAuthorId)) !="")
if (!msg.mMeta.mAuthorId.isNull())
{
MessageComposer *msgDialog = MessageComposer::newMsg();
msgDialog->setTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
msgDialog->setQuotedMsg(QString::fromUtf8(msg.mMsg.c_str()), buildReplyHeader(msg.mMeta));
//msgDialog->addRecipient(MessageComposer::TO, msg.mMeta.mAuthorId, false);
msgDialog->addRecipient(MessageComposer::TO, RsPeerId(msg.mMeta.mAuthorId));
msgDialog->show();
msgDialog->activateWindow();
@ -1679,7 +1678,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
/** Request / Response of Data ********************************/
/*********************** **** **** **** ***********************/
void GxsForumThreadWidget::requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId)
void GxsForumThreadWidget::requestGroup_CurrentForum(const RsGxsGroupId &forumId)
{
ui->progressBar->reset();
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, true);
@ -1687,32 +1686,31 @@ void GxsForumThreadWidget::requestGroupSummary_CurrentForum(const RsGxsGroupId &
emit forumChanged(this);
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_CURRENTFORUM);
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(forumId);
std::cerr << "GxsForumsDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
std::cerr << "GxsForumsDialog::requestGroup_CurrentForum(" << forumId << ")";
std::cerr << std::endl;
uint32_t token;
mThreadQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_CURRENTFORUM);
mThreadQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_TYPE_CURRENTFORUM);
}
void GxsForumThreadWidget::loadGroupSummary_CurrentForum(const uint32_t &token)
void GxsForumThreadWidget::loadGroup_CurrentForum(const uint32_t &token)
{
std::cerr << "GxsForumsDialog::loadGroupSummary_CurrentForum()";
std::cerr << "GxsForumsDialog::loadGroup_CurrentForum()";
std::cerr << std::endl;
std::list<RsGroupMetaData> groupInfo;
rsGxsForums->getGroupSummary(token, groupInfo);
std::vector<RsGxsForumGroup> groups;
rsGxsForums->getGroupData(token, groups);
if (groupInfo.size() == 1)
if (groups.size() == 1)
{
RsGroupMetaData fi = groupInfo.front();
insertForumThreads(fi);
insertForumThreads(groups[0]);
}
else
{
@ -1809,7 +1807,6 @@ void GxsForumThreadWidget::requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &
uint32_t token;
mThreadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_REPLY_MESSAGE);
}
void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
@ -1850,7 +1847,7 @@ void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenReque
switch(req.mUserType)
{
case TOKEN_TYPE_CURRENTFORUM:
loadGroupSummary_CurrentForum(req.mToken);
loadGroup_CurrentForum(req.mToken);
break;
case TOKEN_TYPE_INSERT_POST:

View File

@ -9,6 +9,7 @@ class RSTreeWidgetItemCompareRole;
class RsGxsForumMsg;
class GxsForumsFillThread;
class UIStateHelper;
class RsGxsForumGroup;
namespace Ui {
class GxsForumThreadWidget;
@ -105,7 +106,7 @@ private slots:
void fillThreadStatus(QString text);
private:
void insertForumThreads(const RsGroupMetaData &fi);
void insertForumThreads(const RsGxsForumGroup &group);
void insertPostData(const RsGxsForumMsg &msg); // Second Half.
void insertThreads();
@ -143,8 +144,8 @@ private:
unsigned int mUnreadCount;
unsigned int mNewCount;
void requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId);
void loadGroupSummary_CurrentForum(const uint32_t &token);
void requestGroup_CurrentForum(const RsGxsGroupId &forumId);
void loadGroup_CurrentForum(const uint32_t &token);
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
void loadMsgData_InsertPost(const uint32_t &token);

View File

@ -135,8 +135,8 @@ void GxsForumsDialog::todo()
"<li>Restore forum keys"
"<li>Display AUTHD"
"<li>Copy/navigate forum link"
"<li>Display author of post"
"<li>Display count of unread messages"
"<li>Show/Edit forum details"
"<li>Don't show own posts as unread"
"<li>Remove messages"
"</ul>");
@ -350,7 +350,7 @@ void GxsForumsDialog::insertForumsData(const std::list<RsGroupMetaData> &forumLi
ui.forumTreeWidget->fillGroupItems(popularForums, popList);
ui.forumTreeWidget->fillGroupItems(otherForums, otherList);
updateMessageSummaryList(RsGxsGroupId());
updateMessageSummaryList(RsGxsGroupId());
}
GxsForumThreadWidget *GxsForumsDialog::forumThreadWidget(const RsGxsGroupId &forumId)
@ -390,7 +390,7 @@ void GxsForumsDialog::changedForum(const QString &forumId)
// requestGroupSummary_CurrentForum(mForumId);
/* search exisiting tab */
GxsForumThreadWidget *threadWidget = forumThreadWidget(mForumId);
GxsForumThreadWidget *threadWidget = forumThreadWidget(mForumId);
if (!threadWidget) {
if (mThreadWidget) {
@ -399,7 +399,7 @@ void GxsForumsDialog::changedForum(const QString &forumId)
threadWidget->setForumId(mForumId);
} else {
/* create new tab */
threadWidget = createThreadWidget(mForumId);
threadWidget = createThreadWidget(mForumId);
}
}
@ -408,7 +408,7 @@ void GxsForumsDialog::changedForum(const QString &forumId)
void GxsForumsDialog::forumTreeMiddleButtonClicked(QTreeWidgetItem *item)
{
openForumInNewTab(RsGxsGroupId(ui.forumTreeWidget->itemId(item).toStdString()));
openForumInNewTab(RsGxsGroupId(ui.forumTreeWidget->itemId(item).toStdString()));
}
void GxsForumsDialog::openInNewTab()
@ -418,7 +418,7 @@ void GxsForumsDialog::openInNewTab()
void GxsForumsDialog::openForumInNewTab(const RsGxsGroupId &forumId)
{
if (forumId.isNull()) {
if (forumId.isNull()) {
return;
}
@ -453,7 +453,7 @@ void GxsForumsDialog::threadTabChanged(int index)
return;
}
ui.forumTreeWidget->activateId(QString::fromStdString(threadWidget->forumId().toStdString()), false);
ui.forumTreeWidget->activateId(QString::fromStdString(threadWidget->forumId().toStdString()), false);
}
void GxsForumsDialog::threadTabInfoChanged(QWidget *widget)
@ -474,7 +474,7 @@ void GxsForumsDialog::threadTabInfoChanged(QWidget *widget)
void GxsForumsDialog::copyForumLink()
{
if (mForumId.isNull()) {
if (mForumId.isNull()) {
return;
}
@ -531,7 +531,7 @@ void GxsForumsDialog::unsubscribeToForum()
void GxsForumsDialog::forumSubscribe(bool subscribe)
{
if (mForumId.isNull()) {
if (mForumId.isNull()) {
return;
}
@ -542,7 +542,7 @@ void GxsForumsDialog::forumSubscribe(bool subscribe)
void GxsForumsDialog::showForumDetails()
{
if (mForumId.isNull()) {
if (mForumId.isNull()) {
return;
}
@ -552,7 +552,7 @@ void GxsForumsDialog::showForumDetails()
void GxsForumsDialog::editForumDetails()
{
if (mForumId.isNull()) {
if (mForumId.isNull()) {
return;
}
@ -565,7 +565,7 @@ void GxsForumsDialog::editForumDetails()
void GxsForumsDialog::shareKey()
{
ShareKey shareUi(this, mForumId.toStdString(), FORUM_KEY_SHARE);
ShareKey shareUi(this, mForumId.toStdString(), FORUM_KEY_SHARE);
shareUi.exec();
}
@ -583,7 +583,7 @@ void GxsForumsDialog::updateMessageSummaryList( RsGxsGroupId forumId)
continue;
}
if (forumId.isNull() || childId == forumId.toStdString()) {
if (forumId.isNull() || childId == forumId.toStdString()) {
/* calculate unread messages */
unsigned int newMessageCount = 0;
unsigned int unreadMessageCount = 0;
@ -595,7 +595,7 @@ void GxsForumsDialog::updateMessageSummaryList( RsGxsGroupId forumId)
ui.forumTreeWidget->setUnreadCount(childItem, unreadMessageCount);
if (forumId.isNull() == false) {
if (forumId.isNull() == false) {
/* Calculate only this forum */
break;
}
@ -606,11 +606,11 @@ void GxsForumsDialog::updateMessageSummaryList( RsGxsGroupId forumId)
bool GxsForumsDialog::navigate(const RsGxsGroupId forumId, const std::string& msgId)
{
if (forumId.isNull()) {
if (forumId.isNull()) {
return false;
}
if (ui.forumTreeWidget->activateId(QString::fromStdString(forumId.toStdString()), msgId.empty()) == NULL) {
if (ui.forumTreeWidget->activateId(QString::fromStdString(forumId.toStdString()), msgId.empty()) == NULL) {
return false;
}

View File

@ -0,0 +1,55 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 "ForumPage.h"
#include "rshare.h"
#include "rsharesettings.h"
ForumPage::ForumPage(QWidget * parent, Qt::WindowFlags flags)
: ConfigPage(parent, flags)
{
ui.setupUi(this);
setAttribute(Qt::WA_QuitOnClose, false);
}
ForumPage::~ForumPage()
{
}
/** Saves the changes on this page */
bool ForumPage::save(QString &/*errmsg*/)
{
Settings->setForumMsgSetToReadOnActivate(ui.setMsgToReadOnActivate->isChecked());
Settings->setForumExpandNewMessages(ui.expandNewMessages->isChecked());
Settings->setForumOpenAllInNewTab(ui.openAllInNewTabCheckBox->isChecked());
Settings->setForumLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked());
return true;
}
/** Loads the settings for this page */
void ForumPage::load()
{
ui.setMsgToReadOnActivate->setChecked(Settings->getForumMsgSetToReadOnActivate());
ui.expandNewMessages->setChecked(Settings->getForumExpandNewMessages());
ui.openAllInNewTabCheckBox->setChecked(Settings->getForumOpenAllInNewTab());
ui.loadEmbeddedImages->setChecked(Settings->getForumLoadEmbeddedImages());
}

View File

@ -0,0 +1,50 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
*
* 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 FORUMPAGE_H
#define FORUMPAGE_H
#include <retroshare-gui/configpage.h>
#include "ui_ForumPage.h"
class ForumPage : public ConfigPage
{
Q_OBJECT
public:
ForumPage(QWidget * parent = 0, Qt::WindowFlags flags = 0);
~ForumPage();
/** Saves the changes on this page */
virtual bool save(QString &errmsg);
/** Loads the settings for this page */
virtual void load();
virtual QPixmap iconPixmap() const { return QPixmap(":/images/konversation.png") ; }
virtual QString pageName() const { return tr("Forum") ; }
virtual QString helpText() const { return ""; }
private:
Ui::ForumPage ui;
};
#endif // !FORUMPAGE_H

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ForumPage</class>
<widget class="QWidget" name="ForumPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>340</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="setMsgToReadOnActivate">
<property name="text">
<string>Set message to read on activate</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="expandNewMessages">
<property name="text">
<string>Expand new messages</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="gxsGroupBox">
<property name="title">
<string>New forum</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="openAllInNewTabCheckBox">
<property name="text">
<string>Open all forums in new tab</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -36,7 +36,7 @@
#include "RelayPage.h"
#include "ChatPage.h"
#include "MessagePage.h"
//#include "ForumPage.h"
#include "ForumPage.h"
#include "PluginsPage.h"
#include "ServicePermissionsPage.h"
#include "rsharesettings.h"
@ -132,7 +132,7 @@ RSettingsWin::initStackedWidget()
addPage(new NotifyPage());
addPage(new CryptoPage());
addPage(new MessagePage());
//addPage(new ForumPage());
addPage(new ForumPage());
addPage(new ChatPage());
addPage(new AppearancePage());
addPage(new SoundPage() );

View File

@ -400,6 +400,7 @@ HEADERS += rshare.h \
gui/settings/CryptoPage.h \
gui/settings/MessagePage.h \
gui/settings/NewTag.h \
gui/settings/ForumPage.h \
gui/settings/PluginsPage.h \
gui/settings/PluginItem.h \
gui/settings/AppearancePage.h \
@ -511,7 +512,6 @@ HEADERS += rshare.h \
# gui/channels/CreateChannelMsg.h \
# gui/channels/EditChanDetails.h \
# gui/channels/ChannelUserNotify.h \
# gui/settings/ForumPage.h \
FORMS += gui/StartDialog.ui \
gui/GenCertDialog.ui \
@ -561,6 +561,7 @@ FORMS += gui/StartDialog.ui \
gui/settings/CryptoPage.ui \
gui/settings/MessagePage.ui \
gui/settings/NewTag.ui \
gui/settings/ForumPage.ui \
gui/settings/PluginsPage.ui \
gui/settings/AppearancePage.ui \
gui/settings/TransferPage.ui \
@ -617,7 +618,6 @@ FORMS += gui/StartDialog.ui \
# gui/channels/EditChanDetails.ui \
# gui/feeds/ChanNewItem.ui \
# gui/feeds/ChanMsgItem.ui \
# gui/settings/ForumPage.ui \
SOURCES += main.cpp \
rshare.cpp \
@ -759,6 +759,7 @@ SOURCES += main.cpp \
gui/settings/CryptoPage.cpp \
gui/settings/MessagePage.cpp \
gui/settings/NewTag.cpp \
gui/settings/ForumPage.cpp \
gui/settings/PluginsPage.cpp \
gui/settings/PluginItem.cpp \
gui/settings/AppearancePage.cpp \
@ -825,7 +826,6 @@ SOURCES += main.cpp \
# gui/channels/ChannelUserNotify.cpp \
# gui/feeds/ChanNewItem.cpp \
# gui/feeds/ChanMsgItem.cpp \
# gui/settings/ForumPage.cpp \
RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc