A stab at progressing posted, got post creation working and parameterised GxsGroupDialog for creating "create <service>" header for all gxs services

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5837 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-11-17 21:43:21 +00:00
parent ae5cbecaba
commit 92f1673729
13 changed files with 172 additions and 268 deletions

View file

@ -68,6 +68,7 @@ class RsPostedVote;
typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult; typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult;
typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult; typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult;
typedef std::map<RsGxsGroupId, std::vector<RsPostedVote> > PostedVoteResult; typedef std::map<RsGxsGroupId, std::vector<RsPostedVote> > PostedVoteResult;
typedef std::pair<RsGxsGroupId, int32_t> GroupRank;
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group); std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post); std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
@ -92,6 +93,7 @@ virtual ~RsPosted() { return; }
virtual bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group) = 0; virtual bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group) = 0;
virtual bool getPost(const uint32_t &token, PostedPostResult &post) = 0; virtual bool getPost(const uint32_t &token, PostedPostResult &post) = 0;
virtual bool getComment(const uint32_t &token, PostedCommentResult &comment) = 0; virtual bool getComment(const uint32_t &token, PostedCommentResult &comment) = 0;
virtual bool getGroupRank(const uint32_t &token, GroupRank& grpRank) = 0;
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0; virtual bool submitGroup(uint32_t &token, RsPostedGroup &group) = 0;
virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0; virtual bool submitPost(uint32_t &token, RsPostedPost &post) = 0;

View file

@ -118,6 +118,11 @@ bool p3Posted::getComment(const uint32_t &token, PostedCommentResult &comments)
return ok; return ok;
} }
bool p3Posted::getGroupRank(const uint32_t &token, GroupRank &grpRank)
{
}
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group) bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
{ {
RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem(); RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem();

View file

@ -29,12 +29,12 @@ public:
bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group); bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group);
bool getPost(const uint32_t &token, PostedPostResult& posts) ; bool getPost(const uint32_t &token, PostedPostResult& posts) ;
bool getComment(const uint32_t &token, PostedCommentResult& comments) ; bool getComment(const uint32_t &token, PostedCommentResult& comments) ;
bool getGroupRank(const uint32_t& token, GroupRank& grpRank);
bool submitGroup(uint32_t &token, RsPostedGroup &group); bool submitGroup(uint32_t &token, RsPostedGroup &group);
bool submitPost(uint32_t &token, RsPostedPost &post); bool submitPost(uint32_t &token, RsPostedPost &post);
bool submitVote(uint32_t &token, RsPostedVote &vote); bool submitVote(uint32_t &token, RsPostedVote &vote);
bool submitComment(uint32_t &token, RsPostedComment &comment) ; bool submitComment(uint32_t &token, RsPostedComment &comment) ;
// Special Ranking Request. // Special Ranking Request.
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ; bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;

View file

@ -1,17 +1,24 @@
#include "PostedCreatePostDialog.h" #include "PostedCreatePostDialog.h"
#include "ui_PostedCreatePostDialog.h" #include "ui_PostedCreatePostDialog.h"
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, QWidget *parent): PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId),
ui(new Ui::PostedCreatePostDialog) ui(new Ui::PostedCreatePostDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(this, SIGNAL(accepted()), this, SLOT(createPost()));
} }
void PostedCreatePostDialog::createPost() void PostedCreatePostDialog::createPost()
{ {
RsPostedPost post;
post.mMeta.mGroupId = mGrpId;
post.mLink = ui->linkEdit->text().toStdString();
post.mNotes = ui->notesTextEdit->toPlainText().toStdString();
uint32_t token;
mPosted->submitPost(token, post);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
close(); close();
} }

View file

@ -19,10 +19,10 @@ public:
* @param tokenQ parent callee token * @param tokenQ parent callee token
* @param posted * @param posted
*/ */
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, QWidget *parent = 0); explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
~PostedCreatePostDialog(); ~PostedCreatePostDialog();
private: private slots:
void createPost(); void createPost();
@ -32,6 +32,7 @@ private:
QString mLink; QString mLink;
QString mNotes; QString mNotes;
RsPosted* mPosted; RsPosted* mPosted;
RsGxsGroupId mGrpId;
TokenQueue* mTokenQueue; TokenQueue* mTokenQueue;
}; };

View file

@ -28,7 +28,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="lineEdit"/> <widget class="QLineEdit" name="linkEdit"/>
</item> </item>
</layout> </layout>
</item> </item>
@ -42,7 +42,7 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="textEdit"/> <widget class="QTextEdit" name="notesTextEdit"/>
</item> </item>
</layout> </layout>
</item> </item>

View file

@ -41,7 +41,7 @@
0) 0)
PostedGroupDialog::PostedGroupDialog(TokenQueue* tokenQueue, RsPosted* posted, QWidget *parent) PostedGroupDialog::PostedGroupDialog(TokenQueue* tokenQueue, RsPosted* posted, QWidget *parent)
:GxsGroupDialog(tokenQueue, POSTED_ENABLE_FLAG, POSTED_CREATE_DEFAULT_FLAG, parent), :GxsGroupDialog(tokenQueue, POSTED_ENABLE_FLAG, POSTED_CREATE_DEFAULT_FLAG, parent, "Create New Posted Topic"),
mPosted(posted) mPosted(posted)
{ {
} }

View file

@ -40,6 +40,7 @@ virtual void notifySelection(PostedItem *item, int ptype) = 0;
virtual void requestComments(std::string threadId) = 0; virtual void requestComments(std::string threadId) = 0;
}; };
class PostedItem : public QWidget, private Ui::PostedItem class PostedItem : public QWidget, private Ui::PostedItem
{ {
Q_OBJECT Q_OBJECT

View file

@ -69,17 +69,14 @@ PostedListDialog::PostedListDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
/* Setup Queue */ /* Setup Queue */
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this); mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) ); connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) ); connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) );
/* Initialize group tree */ /* create posted tree */
//ui.groupTreeWidget->initDisplayMenu(ui.displayButton);
/* create forum tree */
yourTopics = ui.groupTreeWidget->addCategoryItem(tr("Your Topics"), QIcon(IMAGE_FOLDER), true); yourTopics = ui.groupTreeWidget->addCategoryItem(tr("Your Topics"), QIcon(IMAGE_FOLDER), true);
subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true); subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true);
popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false); popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false);
@ -88,19 +85,7 @@ PostedListDialog::PostedListDialog(QWidget *parent)
ui.hotSortButton->setChecked(true); ui.hotSortButton->setChecked(true);
mSortButton = ui.hotSortButton; mSortButton = ui.hotSortButton;
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newGroup() ) ); connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) );
connect( ui.hotSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
connect( ui.newSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
connect( ui.topSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
connect( ui.sortGroup, SIGNAL( buttonClicked( QAbstractButton * ) ), this, SLOT( sortButtonClicked( QAbstractButton * ) ) );
connect( ui.periodComboBox, SIGNAL( currentIndexChanged ( int index ) ), this, SLOT( periodChanged ( int ) ) );
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
} }
@ -108,15 +93,16 @@ void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
{ {
QMenu contextMnu( this ); QMenu contextMnu( this );
QAction *action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Create Post"), this, SLOT(createPost())); QAction *action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Create Topic"), this, SLOT(newPost()));
action->setDisabled (mCurrTopicId.empty()); action->setDisabled (mCurrTopicId.empty());
contextMnu.exec(QCursor::pos()); contextMnu.exec(QCursor::pos());
} }
void PostedListDialog::createPost() void PostedListDialog::newPost()
{ {
PostedCreatePostDialog cp(mPostedQueue, rsPosted, mCurrTopicId, this);
cp.exec();
} }
void PostedListDialog::updateDisplay() void PostedListDialog::updateDisplay()
@ -126,22 +112,6 @@ void PostedListDialog::updateDisplay()
if (!rsPosted) if (!rsPosted)
return; return;
// TODO groupsChanged... HACK XXX.
#if 0
if ((rsPosted->groupsChanged(groupIds)) || (rsPosted->updated()))
{
/* update Forums List */
insertGroups();
it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
if (it != groupIds.end())
{
/* update threads as well */
insertThreads();
}
}
#endif
if (rsPosted->updated()) if (rsPosted->updated())
{ {
/* update Forums List */ /* update Forums List */
@ -168,86 +138,12 @@ void PostedListDialog::changedTopic(const QString &id)
insertThreads(); insertThreads();
} }
void PostedListDialog::sortButtonPressed()
{
std::cerr << "PostedListDialog::sortButtonPressed()";
std::cerr << std::endl;
QAbstractButton *pressed = NULL;
if (ui.hotSortButton->isChecked()) {
std::cerr << "PostedListDialog::sortButtonPressed() Hot";
std::cerr << std::endl;
pressed = ui.hotSortButton;
} else if (ui.newSortButton->isChecked()) {
std::cerr << "PostedListDialog::sortButtonPressed() New";
std::cerr << std::endl;
pressed = ui.newSortButton;
} else if (ui.topSortButton->isChecked()) {
std::cerr << "PostedListDialog::sortButtonPressed() Top";
std::cerr << std::endl;
pressed = ui.topSortButton;
}
if ((pressed) && (pressed != mSortButton))
{
mSortButton = pressed;
sortButtonClicked( mSortButton );
insertThreads();
}
}
void PostedListDialog::sortButtonClicked( QAbstractButton *button )
{
std::cerr << "PostedListDialog::sortButtonClicked( From Button Group! )";
std::cerr << std::endl;
uint32_t sortMode = RSPOSTED_VIEWMODE_HOT;
if (button == ui.hotSortButton) {
sortMode = RSPOSTED_VIEWMODE_HOT;
} else if (button == ui.newSortButton) {
sortMode = RSPOSTED_VIEWMODE_LATEST;
} else if (button == ui.topSortButton) {
sortMode = RSPOSTED_VIEWMODE_TOP;
}
}
void PostedListDialog::periodChanged( int index )
{
uint32_t periodMode = RSPOSTED_PERIOD_HOUR;
switch (index)
{
case 0:
periodMode = RSPOSTED_PERIOD_HOUR;
break;
case 1:
periodMode = RSPOSTED_PERIOD_DAY;
break;
default:
case 2:
periodMode = RSPOSTED_PERIOD_WEEK;
break;
case 3:
periodMode = RSPOSTED_PERIOD_MONTH;
break;
case 4:
periodMode = RSPOSTED_PERIOD_YEAR;
break;
}
}
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/** New / Edit Groups ********************************/ /** New / Edit Groups ********************************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
void PostedListDialog::newGroup() void PostedListDialog::newTopic()
{ {
PostedGroupDialog cf (mPostedQueue, rsPosted, this); PostedGroupDialog cf (mPostedQueue, rsPosted, this);
cf.exec (); cf.exec ();
@ -263,11 +159,6 @@ void PostedListDialog::showGroupDetails()
PostedGroupDialog cf(mGroups[mCurrTopicId], GXS_GROUP_DIALOG_SHOW_MODE, this); PostedGroupDialog cf(mGroups[mCurrTopicId], GXS_GROUP_DIALOG_SHOW_MODE, this);
cf.exec (); cf.exec ();
} }
void PostedListDialog::editGroupDetails()
{
}
void PostedListDialog::insertGroups() void PostedListDialog::insertGroups()
@ -303,6 +194,14 @@ void PostedListDialog::acknowledgeGroup(const uint32_t &token)
} }
} }
void PostedListDialog::acknowledgeMsg(const uint32_t &token)
{
RsGxsGrpMsgIdPair msgId;
// just acknowledge, don't load anything
rsPosted->acknowledgeMsg(token, msgId);
}
void PostedListDialog::loadGroupSummary(const uint32_t &token) void PostedListDialog::loadGroupSummary(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupSummary()"; std::cerr << "PostedListDialog::loadGroupSummary()";
@ -322,6 +221,11 @@ void PostedListDialog::loadGroupSummary(const uint32_t &token)
} }
} }
void PostedListDialog::loadPostData(const uint32_t &token)
{
loadGroupThreadData_InsertThreads(token);
}
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -369,39 +273,26 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
void PostedListDialog::insertThreads() void PostedListDialog::insertThreads()
{ {
loadCurrentForumThreads(mCurrTopicId); loadCurrentTopicThreads(mCurrTopicId);
} }
void PostedListDialog::loadCurrentForumThreads(const std::string &forumId) void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId)
{ {
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << forumId << ")"; std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
std::cerr << std::endl; std::cerr << std::endl;
if (forumId.empty()) if (topicId.empty())
{ {
std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req"; std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
std::cerr << std::endl; std::cerr << std::endl;
return; return;
} }
/* if already active -> kill current loading */
if (mThreadLoading)
{
/* Cleanup */
std::cerr << "Already Loading -> must Clean ... TODO, retry in a moment";
return;
}
clearPosts(); clearPosts();
/* initiate loading */ /* initiate loading */
std::cerr << "PostedListDialog::loadCurrentForumThreads() Initiating Loading"; requestGroupThreadData_InsertThreads(topicId);
std::cerr << std::endl;
mThreadLoading = true;
requestGroupThreadData_InsertThreads(forumId);
} }
@ -410,103 +301,86 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
std::list<std::string> grpIds; std::list<RsGxsGroupId> grpIds;
grpIds.push_back(groupId); grpIds.push_back(groupId);
std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")"; std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")";
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; uint32_t token;
//mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS); mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
// Do specific Posted Request....
if (rsPosted->requestRanking(token, groupId))
{
// get the Queue to handle response.
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
}
} }
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token) void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
{ {
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()"; std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
std::cerr << std::endl; std::cerr << std::endl;
bool moreData = true;
while(moreData)
{
RsPostedPost post;
// Old Format.
//if ()
if (/*rsPosted->getPost(token, post)*/false) clearPosts();
{
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
std::cerr << std::endl;
loadPost(post);
}
else
{
moreData = false;
}
}
mThreadLoading = false; PostedPostResult result;
rsPosted->getPost(token, result);
std::vector<RsPostedPost>& posts = result[mCurrTopicId];
std::vector<RsPostedPost>::iterator vit = posts.begin();
for(; vit != posts.end(); vit++)
{
loadPost(*vit);
}
} }
void PostedListDialog::loadPost(const RsPostedPost &post) void PostedListDialog::loadPost(const RsPostedPost &post)
{ {
PostedItem *item = new PostedItem(this, post); PostedItem *item = new PostedItem(this, post);
QLayout *alayout = ui.scrollAreaWidgetContents->layout(); QLayout *alayout = ui.scrollAreaWidgetContents->layout();
alayout->addWidget(item); alayout->addWidget(item);
} }
void PostedListDialog::clearPosts() void PostedListDialog::clearPosts()
{ {
std::cerr << "PostedListDialog::clearPosts()" << std::endl; std::cerr << "PostedListDialog::clearPosts()" << std::endl;
std::list<PostedItem *> postedItems; std::list<PostedItem *> postedItems;
std::list<PostedItem *>::iterator pit; std::list<PostedItem *>::iterator pit;
QLayout *alayout = ui.scrollAreaWidgetContents->layout(); QLayout *alayout = ui.scrollAreaWidgetContents->layout();
int count = alayout->count(); int count = alayout->count();
for(int i = 0; i < count; i++) for(int i = 0; i < count; i++)
{ {
QLayoutItem *litem = alayout->itemAt(i); QLayoutItem *litem = alayout->itemAt(i);
if (!litem) if (!litem)
{ {
std::cerr << "PostedListDialog::clearPosts() missing litem"; std::cerr << "PostedListDialog::clearPosts() missing litem";
std::cerr << std::endl; std::cerr << std::endl;
continue; continue;
} }
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget()); PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
if (item) if (item)
{ {
std::cerr << "PostedListDialog::clearPosts() item: " << item; std::cerr << "PostedListDialog::clearPosts() item: " << item;
std::cerr << std::endl; std::cerr << std::endl;
postedItems.push_back(item); postedItems.push_back(item);
} }
else else
{ {
std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???"; std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???";
std::cerr << std::endl; std::cerr << std::endl;
} }
} }
for(pit = postedItems.begin(); pit != postedItems.end(); pit++) for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
{ {
PostedItem *item = *pit; PostedItem *item = *pit;
alayout->removeWidget(item); alayout->removeWidget(item);
delete item; delete item;
} }
} }
@ -528,7 +402,6 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
case TOKENREQ_GROUPINFO: case TOKENREQ_GROUPINFO:
switch(req.mAnsType) switch(req.mAnsType)
{ {
case RS_TOKREQ_ANSTYPE_ACK: case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeGroup(req.mToken); acknowledgeGroup(req.mToken);
break; break;
@ -539,6 +412,20 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
break; break;
} }
break; break;
case TOKENREQ_MSGINFO:
switch(req.mAnsType)
{
case RS_TOKREQ_ANSTYPE_ACK:
acknowledgeMsg(req.mToken);
break;
case RS_TOKREQ_ANSTYPE_DATA:
loadPostData(req.mToken);
break;
default:
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
break;
}
default: default:
std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE"; std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl; std::cerr << std::endl;

View file

@ -56,71 +56,69 @@ class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public To
public: public:
PostedListDialog(QWidget *parent = 0); PostedListDialog(QWidget *parent = 0);
virtual void deletePostedItem(PostedItem *, uint32_t ptype) { return; } virtual void deletePostedItem(PostedItem *, uint32_t ptype) { return; }
virtual void notifySelection(PostedItem *item, int ptype) { return; } virtual void notifySelection(PostedItem *item, int ptype) { return; }
virtual void requestComments(std::string threadId); virtual void requestComments(std::string threadId);
signals: signals:
void loadComments( std::string ); void loadComments( std::string );
private slots: private slots:
void groupListCustomPopupMenu( QPoint /*point*/ ); void groupListCustomPopupMenu( QPoint /*point*/ );
void changedTopic(const QString &id); void changedTopic(const QString &id);
void sortButtonClicked( QAbstractButton *button ); void newTopic();
void sortButtonPressed(); void showGroupDetails();
void newPost();
void periodChanged( int index );
void newGroup();
void showGroupDetails();
void editGroupDetails();
void createPost();
private: private:
void clearPosts(); void clearPosts();
void updateDisplay(); void updateDisplay();
void loadPost(const RsPostedPost &post); void loadPost(const RsPostedPost &post);
void insertGroups(); void insertGroups();
void requestGroupSummary(); void requestGroupSummary();
void acknowledgeGroup(const uint32_t &token); void acknowledgeGroup(const uint32_t &token);
void loadGroupSummary(const uint32_t &token); void loadGroupSummary(const uint32_t &token);
void requestGroupSummary_CurrentForum(const std::string &forumId); void requestGroupSummary_CurrentForum(const std::string &forumId);
void loadGroupSummary_CurrentForum(const uint32_t &token); void loadGroupSummary_CurrentForum(const uint32_t &token);
void insertThreads();
void loadCurrentForumThreads(const std::string &forumId);
void requestGroupThreadData_InsertThreads(const std::string &forumId);
void loadGroupThreadData_InsertThreads(const uint32_t &token);
void insertGroupData(const std::list<RsGroupMetaData> &groupList); void acknowledgeMsg(const uint32_t &token);
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); void loadPostData(const uint32_t &token);
void insertThreads();
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadCurrentTopicThreads(const std::string &forumId);
void requestGroupThreadData_InsertThreads(const std::string &forumId);
void loadGroupThreadData_InsertThreads(const uint32_t &token);
QTreeWidgetItem *yourTopics; void insertGroupData(const std::list<RsGroupMetaData> &groupList);
QTreeWidgetItem *subscribedTopics; void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
QTreeWidgetItem *popularTopics;
QTreeWidgetItem *otherTopics;
QAbstractButton *mSortButton; void loadRequest(const TokenQueue *queue, const TokenRequest &req);
bool mThreadLoading;
std::string mCurrTopicId;
QMap<RsGxsGroupId, RsPostedGroup> mGroups; private:
TokenQueue *mPostedQueue;
/* UI - from Designer */ QTreeWidgetItem *yourTopics;
Ui::PostedListDialog ui; QTreeWidgetItem *subscribedTopics;
QTreeWidgetItem *popularTopics;
QTreeWidgetItem *otherTopics;
QAbstractButton *mSortButton;
bool mThreadLoading;
RsGxsGroupId mCurrTopicId;
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
TokenQueue *mPostedQueue;
/* UI - from Designer */
Ui::PostedListDialog ui;
}; };

View file

@ -50,7 +50,7 @@
#define GXSGROUP_LOADGROUP 2 #define GXSGROUP_LOADGROUP 2
/** Constructor */ /** Constructor */
GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent) GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent, const QString &serviceHeader)
: QDialog(parent), mTokenQueue(tokenQueue), mMode(GXS_GROUP_DIALOG_CREATE_MODE), mEnabledFlags(enableFlags), mDefaultsFlags(defaultFlags), mReadonlyFlags(0) : QDialog(parent), mTokenQueue(tokenQueue), mMode(GXS_GROUP_DIALOG_CREATE_MODE), mEnabledFlags(enableFlags), mDefaultsFlags(defaultFlags), mReadonlyFlags(0)
{ {
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
@ -62,9 +62,12 @@ GxsGroupDialog::GxsGroupDialog(TokenQueue *tokenQueue, uint32_t enableFlags, uin
connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) )); connect( ui.pubKeyShare_cb, SIGNAL( clicked() ), this, SLOT( setShareList( ) ));
connect( ui.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo())); connect( ui.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo())); connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
//ui.headerFrame->setHeaderImage(QPixmap(":/WikiPoos/images/resource-group-new_48.png")); if(!serviceHeader.isEmpty())
ui.mServiceHeader->setText(serviceHeader);
//ui.headerFrame->setHeaderImage(QPixmap(":/WikiPoos/images/resource-group-new_48.png"));
//ui.headerFrame->setHeaderText(tr("Create Wiki Group")); //ui.headerFrame->setHeaderText(tr("Create Wiki Group"));
if (!ui.pubKeyShare_cb->isChecked()) if (!ui.pubKeyShare_cb->isChecked())

View file

@ -125,7 +125,7 @@ public:
* @param parent The parent dialog * @param parent The parent dialog
* @param mode * @param mode
*/ */
GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent = NULL); GxsGroupDialog(TokenQueue* tokenQueue, uint32_t enableFlags, uint16_t defaultFlags, QWidget *parent = NULL, const QString& serviceHeader = "");
/*! /*!
* Contructs a GxsGroupDialog for display a group or editing * Contructs a GxsGroupDialog for display a group or editing

View file

@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Create new Wiki Group</string> <string>Create New Group</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../images.qrc"> <iconset resource="../images.qrc">
@ -67,7 +67,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="mServiceHeader">
<property name="text"> <property name="text">
<string>Create Wiki Group</string> <string>Create Wiki Group</string>
</property> </property>