- 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; return true;
} }
bool PostedGroupDialog::service_EditGroup(uint32_t &token, bool PostedGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta)
RsGroupMetaData &editedMeta)
{ {
RsPostedGroup grp; RsPostedGroup grp;
grp.mMeta = editedMeta; 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 << "PostedGroupDialog::service_EditGroup() submitting changes";
std::cerr << std::endl; std::cerr << std::endl;
@ -121,31 +120,31 @@ bool PostedGroupDialog::service_EditGroup(uint32_t &token,
return true; return true;
} }
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGroupMetaData& groupMetaData, QString &description)
bool PostedGroupDialog::service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData)
{ {
std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")"; std::cerr << "PostedGroupDialog::service_loadGroup(" << token << ")";
std::cerr << std::endl; std::cerr << std::endl;
std::vector<RsPostedGroup> groups; std::vector<RsPostedGroup> groups;
if (!rsPosted->getGroupData(token, groups)) if (!rsPosted->getGroupData(token, groups))
{ {
std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData"; std::cerr << "PostedGroupDialog::service_loadGroup() Error getting GroupData";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
if (groups.size() != 1) if (groups.size() != 1)
{ {
std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1"; std::cerr << "PostedGroupDialog::service_loadGroup() Error Group.size() != 1";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading"; std::cerr << "PostedGroupDialog::service_loadGroup() Unfinished Loading";
std::cerr << std::endl; std::cerr << std::endl;
groupMetaData = groups[0].mMeta; groupMetaData = groups[0].mMeta;
description = QString::fromUtf8(groups[0].mDescription.c_str());
return true; return true;
} }

View File

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

View File

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

View File

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

View File

@ -136,7 +136,7 @@ void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
case UITYPE_CONTACTS_DOCK: case UITYPE_CONTACTS_DOCK:
ui.contactsdockWidget->setWindowTitle(text); ui.contactsdockWidget->setWindowTitle(text);
break; break;
case UITYPE_BUTTONBOX_OK: case UITYPE_BUTTONBOX_OK:
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(text); ui.buttonBox->button(QDialogButtonBox::Ok)->setText(text);
break; break;
} }
@ -150,7 +150,7 @@ void GxsGroupDialog::initMode()
case MODE_CREATE: case MODE_CREATE:
{ {
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 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(); newGroup();
} }
break; break;
@ -162,6 +162,7 @@ void GxsGroupDialog::initMode()
requestGroup(mGrpMeta.mGroupId); requestGroup(mGrpMeta.mGroupId);
} }
break; break;
case MODE_EDIT: case MODE_EDIT:
{ {
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
@ -172,7 +173,6 @@ void GxsGroupDialog::initMode()
} }
} }
void GxsGroupDialog::clearForm() void GxsGroupDialog::clearForm()
{ {
ui.groupName->clear(); ui.groupName->clear();
@ -267,45 +267,27 @@ void GxsGroupDialog::setupDefaults()
void GxsGroupDialog::setupVisibility() void GxsGroupDialog::setupVisibility()
{ {
{ ui.groupName->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_NAME);
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.groupLogo->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION); ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.groupDescLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
}
{ ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); 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.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN);
ui.pubKeyShare_cb->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS);
}
{ ui.pubKeyShare_cb->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_SHAREKEYS);
ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
}
{ ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
}
{ ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS);
ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
} ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
} }
void GxsGroupDialog::setAllReadonly() void GxsGroupDialog::setAllReadonly()
{ {
uint32_t origReadonlyFlags = mReadonlyFlags; uint32_t origReadonlyFlags = mReadonlyFlags;
@ -316,59 +298,39 @@ void GxsGroupDialog::setAllReadonly()
mReadonlyFlags = origReadonlyFlags; mReadonlyFlags = origReadonlyFlags;
} }
void GxsGroupDialog::setupReadonly() void GxsGroupDialog::setupReadonly()
{ {
{ ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
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.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION)); ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
}
{ ui.groupDesc->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION)); ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
}
{ ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
}
{ ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
}
{ ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
}
{ ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.commentGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS)); ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
}
{ ui.commentGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS));
ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
} ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
} }
void GxsGroupDialog::newGroup() void GxsGroupDialog::newGroup()
{ {
setupDefaults(); setupDefaults();
setupVisibility(); setupVisibility();
setupReadonly(); setupReadonly();
clearForm(); clearForm();
} }
void GxsGroupDialog::updateFromExistingMeta() void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{ {
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()"; std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl; std::cerr << std::endl;
@ -386,6 +348,9 @@ void GxsGroupDialog::updateFromExistingMeta()
/* setup name */ /* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str())); ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* set description */
ui.groupDesc->setPlainText(description);
switch(mGrpMeta.mCircleType) switch(mGrpMeta.mCircleType)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUREYESONLY:
@ -405,12 +370,12 @@ void GxsGroupDialog::updateFromExistingMeta()
std::cerr << std::endl; std::cerr << std::endl;
break; break;
} }
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
updateCircleOptions(); updateCircleOptions();
} }
void GxsGroupDialog::submitGroup() void GxsGroupDialog::submitGroup()
{ {
std::cerr << "GxsGroupDialog::submitGroup()"; std::cerr << "GxsGroupDialog::submitGroup()";
@ -475,7 +440,6 @@ void GxsGroupDialog::editGroup()
close(); close();
} }
bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta) bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
{ {
std::cerr << "GxsGroupDialog::prepareGroupMetaData()"; std::cerr << "GxsGroupDialog::prepareGroupMetaData()";
@ -510,7 +474,7 @@ bool GxsGroupDialog::prepareGroupMetaData(RsGroupMetaData &meta)
std::cerr << " External: " << meta.mCircleId; std::cerr << " External: " << meta.mCircleId;
std::cerr << std::endl; std::cerr << std::endl;
ui.idChooser->getChosenId(meta.mAuthorId); ui.idChooser->getChosenId(meta.mAuthorId);
return true; return true;
} }
@ -524,9 +488,9 @@ void GxsGroupDialog::createGroup()
if(name.isEmpty()) if(name.isEmpty())
{ {
/* error message */ /* error message */
QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok); QMessageBox::warning(this, "RetroShare", tr("Please add a Name"), QMessageBox::Ok, QMessageBox::Ok);
return; //Don't add a empty name!! return; //Don't add a empty name!!
} }
uint32_t token; uint32_t token;
@ -610,8 +574,6 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
} }
} }
/**** Above logic is flawed, and will be removed shortly /**** Above logic is flawed, and will be removed shortly
* *
* *
@ -681,8 +643,6 @@ bool GxsGroupDialog::setCircleParameters(RsGroupMetaData &meta)
return true; return true;
} }
void GxsGroupDialog::cancelDialog() void GxsGroupDialog::cancelDialog()
{ {
std::cerr << "GxsGroupDialog::cancelDialog() Should Close!"; std::cerr << "GxsGroupDialog::cancelDialog() Should Close!";
@ -711,16 +671,15 @@ QPixmap GxsGroupDialog::getLogo()
QString GxsGroupDialog::getDescription() QString GxsGroupDialog::getDescription()
{ {
return ui.groupDesc->document()->toPlainText(); return ui.groupDesc->toPlainText();
} }
/*********************************************************************************** /***********************************************************************************
Share Lists. Share Lists.
***********************************************************************************/ ***********************************************************************************/
void GxsGroupDialog::sendShareList(std::string groupId) void GxsGroupDialog::sendShareList(std::string /*groupId*/)
{ {
(void) groupId;
close(); close();
} }
@ -735,8 +694,6 @@ void GxsGroupDialog::setShareList()
} }
} }
/*********************************************************************************** /***********************************************************************************
Loading Group. Loading Group.
***********************************************************************************/ ***********************************************************************************/
@ -756,28 +713,18 @@ void GxsGroupDialog::requestGroup(const RsGxsGroupId &groupId)
mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP); mInternalTokenQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, GXSGROUP_INTERNAL_LOADGROUP);
} }
void GxsGroupDialog::loadGroup(uint32_t token) void GxsGroupDialog::loadGroup(uint32_t token)
{ {
std::cerr << "GxsGroupDialog::loadGroup(" << token << ")"; std::cerr << "GxsGroupDialog::loadGroup(" << token << ")";
std::cerr << std::endl; 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) void GxsGroupDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
{ {
std::cerr << "GxsGroupDialog::loadRequest() UserType: " << req.mUserType; 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); void setUiText(UiType uiType, const QString &text);
/*! /*!
* It is up to the service to do the actual group creation * It is up to the service to do the actual group creation
* Service can also modify initial meta going into group * Service can also modify initial meta going into group
* @param token This should be set to the token retrieved * @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value * @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; virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta) = 0;
/*! /*!
* It is up to the service to do the actual group editing * It is up to the service to do the actual group editing
* @param token This should be set to the token retrieved * @param token This should be set to the token retrieved
* @param meta The deriving GXS service should set their grp meta to this value * @param meta The deriving GXS service should set their grp meta to this value
*/ */
virtual bool service_EditGroup(uint32_t &token, virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) = 0;
RsGroupMetaData &editedMeta) = 0;
// To be overloaded by users. // To be overloaded by users.
// use Token to retrieve from service, fill in metaData. // 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 * This returns a group logo from the ui \n
@ -198,7 +197,7 @@ protected:
* This returns a group description string from the ui * This returns a group description string from the ui
* @return group description string * @return group description string
*/ */
virtual QString getDescription(); QString getDescription();
private slots: private slots:
@ -222,14 +221,14 @@ private:
void setupVisibility(); void setupVisibility();
void clearForm(); void clearForm();
void createGroup(); void createGroup();
void editGroup(); void editGroup();
void sendShareList(std::string forumId); void sendShareList(std::string forumId);
void loadNewGroupId(const uint32_t &token); void loadNewGroupId(const uint32_t &token);
// loading existing Groups. // loading existing Groups.
void requestGroup(const RsGxsGroupId &groupId); void requestGroup(const RsGxsGroupId &groupId);
void loadGroup(uint32_t token); void loadGroup(uint32_t token);
void updateFromExistingMeta(); void updateFromExistingMeta(const QString &description);
bool prepareGroupMetaData(RsGroupMetaData &meta); bool prepareGroupMetaData(RsGroupMetaData &meta);
@ -245,7 +244,7 @@ private:
uint32_t mReadonlyFlags; uint32_t mReadonlyFlags;
uint32_t mDefaultsFlags; uint32_t mDefaultsFlags;
protected: protected:
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::GxsGroupDialog ui; Ui::GxsGroupDialog ui;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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