mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 16:39:43 -05:00
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:
parent
ae5cbecaba
commit
92f1673729
@ -68,6 +68,7 @@ class RsPostedVote;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedPost> > PostedPostResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsPostedComment> > PostedCommentResult;
|
||||
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 RsPostedPost &post);
|
||||
@ -92,6 +93,7 @@ virtual ~RsPosted() { return; }
|
||||
virtual bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group) = 0;
|
||||
virtual bool getPost(const uint32_t &token, PostedPostResult &post) = 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 submitPost(uint32_t &token, RsPostedPost &post) = 0;
|
||||
|
@ -118,6 +118,11 @@ bool p3Posted::getComment(const uint32_t &token, PostedCommentResult &comments)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3Posted::getGroupRank(const uint32_t &token, GroupRank &grpRank)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
|
||||
{
|
||||
RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem();
|
||||
|
@ -29,12 +29,12 @@ public:
|
||||
bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group);
|
||||
bool getPost(const uint32_t &token, PostedPostResult& posts) ;
|
||||
bool getComment(const uint32_t &token, PostedCommentResult& comments) ;
|
||||
bool getGroupRank(const uint32_t& token, GroupRank& grpRank);
|
||||
|
||||
bool submitGroup(uint32_t &token, RsPostedGroup &group);
|
||||
bool submitPost(uint32_t &token, RsPostedPost &post);
|
||||
bool submitVote(uint32_t &token, RsPostedVote &vote);
|
||||
bool submitComment(uint32_t &token, RsPostedComment &comment) ;
|
||||
|
||||
// Special Ranking Request.
|
||||
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
|
||||
|
||||
|
@ -1,17 +1,24 @@
|
||||
#include "PostedCreatePostDialog.h"
|
||||
#include "ui_PostedCreatePostDialog.h"
|
||||
|
||||
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, QWidget *parent):
|
||||
QDialog(parent), mTokenQueue(tokenQ), mPosted(posted),
|
||||
PostedCreatePostDialog::PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted *posted, const RsGxsGroupId& grpId, QWidget *parent):
|
||||
QDialog(parent), mTokenQueue(tokenQ), mPosted(posted), mGrpId(grpId),
|
||||
ui(new Ui::PostedCreatePostDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(this, SIGNAL(accepted()), this, SLOT(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();
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,10 @@ public:
|
||||
* @param tokenQ parent callee token
|
||||
* @param posted
|
||||
*/
|
||||
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, QWidget *parent = 0);
|
||||
explicit PostedCreatePostDialog(TokenQueue* tokenQ, RsPosted* posted, const RsGxsGroupId& grpId, QWidget *parent = 0);
|
||||
~PostedCreatePostDialog();
|
||||
|
||||
private:
|
||||
private slots:
|
||||
|
||||
void createPost();
|
||||
|
||||
@ -32,6 +32,7 @@ private:
|
||||
QString mLink;
|
||||
QString mNotes;
|
||||
RsPosted* mPosted;
|
||||
RsGxsGroupId mGrpId;
|
||||
TokenQueue* mTokenQueue;
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
<widget class="QLineEdit" name="linkEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -42,7 +42,7 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit"/>
|
||||
<widget class="QTextEdit" name="notesTextEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
@ -41,7 +41,7 @@
|
||||
0)
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ virtual void notifySelection(PostedItem *item, int ptype) = 0;
|
||||
virtual void requestComments(std::string threadId) = 0;
|
||||
};
|
||||
|
||||
|
||||
class PostedItem : public QWidget, private Ui::PostedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -69,17 +69,14 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
/* Setup Queue */
|
||||
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
|
||||
/* Setup Queue */
|
||||
mPostedQueue = new TokenQueue(rsPosted->getTokenService(), this);
|
||||
|
||||
connect( ui.groupTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( groupListCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) );
|
||||
|
||||
/* Initialize group tree */
|
||||
//ui.groupTreeWidget->initDisplayMenu(ui.displayButton);
|
||||
|
||||
/* create forum tree */
|
||||
/* create posted tree */
|
||||
yourTopics = ui.groupTreeWidget->addCategoryItem(tr("Your Topics"), QIcon(IMAGE_FOLDER), true);
|
||||
subscribedTopics = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Topics"), QIcon(IMAGE_FOLDERRED), true);
|
||||
popularTopics = ui.groupTreeWidget->addCategoryItem(tr("Popular Topics"), QIcon(IMAGE_FOLDERGREEN), false);
|
||||
@ -88,19 +85,7 @@ PostedListDialog::PostedListDialog(QWidget *parent)
|
||||
ui.hotSortButton->setChecked(true);
|
||||
mSortButton = ui.hotSortButton;
|
||||
|
||||
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newGroup() ) );
|
||||
|
||||
connect( ui.hotSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
connect( ui.newSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
connect( ui.topSortButton, SIGNAL( released() ), this, SLOT( sortButtonPressed() ) );
|
||||
|
||||
connect( ui.sortGroup, SIGNAL( buttonClicked( QAbstractButton * ) ), this, SLOT( sortButtonClicked( QAbstractButton * ) ) );
|
||||
connect( ui.periodComboBox, SIGNAL( currentIndexChanged ( int index ) ), this, SLOT( periodChanged ( int ) ) );
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -108,15 +93,16 @@ void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
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());
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void PostedListDialog::createPost()
|
||||
void PostedListDialog::newPost()
|
||||
{
|
||||
|
||||
PostedCreatePostDialog cp(mPostedQueue, rsPosted, mCurrTopicId, this);
|
||||
cp.exec();
|
||||
}
|
||||
|
||||
void PostedListDialog::updateDisplay()
|
||||
@ -126,22 +112,6 @@ void PostedListDialog::updateDisplay()
|
||||
if (!rsPosted)
|
||||
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())
|
||||
{
|
||||
/* update Forums List */
|
||||
@ -168,86 +138,12 @@ void PostedListDialog::changedTopic(const QString &id)
|
||||
insertThreads();
|
||||
}
|
||||
|
||||
void PostedListDialog::sortButtonPressed()
|
||||
{
|
||||
std::cerr << "PostedListDialog::sortButtonPressed()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QAbstractButton *pressed = NULL;
|
||||
if (ui.hotSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() Hot";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.hotSortButton;
|
||||
} else if (ui.newSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() New";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.newSortButton;
|
||||
} else if (ui.topSortButton->isChecked()) {
|
||||
std::cerr << "PostedListDialog::sortButtonPressed() Top";
|
||||
std::cerr << std::endl;
|
||||
pressed = ui.topSortButton;
|
||||
}
|
||||
|
||||
if ((pressed) && (pressed != mSortButton))
|
||||
{
|
||||
mSortButton = pressed;
|
||||
sortButtonClicked( mSortButton );
|
||||
insertThreads();
|
||||
}
|
||||
}
|
||||
|
||||
void PostedListDialog::sortButtonClicked( QAbstractButton *button )
|
||||
{
|
||||
std::cerr << "PostedListDialog::sortButtonClicked( From Button Group! )";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t sortMode = RSPOSTED_VIEWMODE_HOT;
|
||||
|
||||
if (button == ui.hotSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_HOT;
|
||||
} else if (button == ui.newSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_LATEST;
|
||||
} else if (button == ui.topSortButton) {
|
||||
sortMode = RSPOSTED_VIEWMODE_TOP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 ********************************/
|
||||
/*********************** **** **** **** ***********************/
|
||||
|
||||
void PostedListDialog::newGroup()
|
||||
void PostedListDialog::newTopic()
|
||||
{
|
||||
PostedGroupDialog cf (mPostedQueue, rsPosted, this);
|
||||
cf.exec ();
|
||||
@ -263,11 +159,6 @@ void PostedListDialog::showGroupDetails()
|
||||
PostedGroupDialog cf(mGroups[mCurrTopicId], GXS_GROUP_DIALOG_SHOW_MODE, this);
|
||||
cf.exec ();
|
||||
}
|
||||
|
||||
void PostedListDialog::editGroupDetails()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
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()
|
||||
{
|
||||
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;
|
||||
|
||||
if (forumId.empty())
|
||||
if (topicId.empty())
|
||||
{
|
||||
std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
/* if already active -> kill current loading */
|
||||
if (mThreadLoading)
|
||||
{
|
||||
/* Cleanup */
|
||||
std::cerr << "Already Loading -> must Clean ... TODO, retry in a moment";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
clearPosts();
|
||||
|
||||
/* initiate loading */
|
||||
std::cerr << "PostedListDialog::loadCurrentForumThreads() Initiating Loading";
|
||||
std::cerr << std::endl;
|
||||
|
||||
mThreadLoading = true;
|
||||
|
||||
requestGroupThreadData_InsertThreads(forumId);
|
||||
/* initiate loading */
|
||||
requestGroupThreadData_InsertThreads(topicId);
|
||||
}
|
||||
|
||||
|
||||
@ -410,103 +301,86 @@ void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &g
|
||||
{
|
||||
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);
|
||||
|
||||
std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
//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);
|
||||
}
|
||||
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
|
||||
}
|
||||
|
||||
|
||||
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
bool moreData = true;
|
||||
while(moreData)
|
||||
{
|
||||
RsPostedPost post;
|
||||
// Old Format.
|
||||
//if ()
|
||||
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (/*rsPosted->getPost(token, post)*/false)
|
||||
{
|
||||
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
loadPost(post);
|
||||
}
|
||||
else
|
||||
{
|
||||
moreData = false;
|
||||
}
|
||||
}
|
||||
clearPosts();
|
||||
|
||||
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)
|
||||
{
|
||||
PostedItem *item = new PostedItem(this, post);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
PostedItem *item = new PostedItem(this, post);
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
|
||||
|
||||
void PostedListDialog::clearPosts()
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts()" << std::endl;
|
||||
std::cerr << "PostedListDialog::clearPosts()" << std::endl;
|
||||
|
||||
std::list<PostedItem *> postedItems;
|
||||
std::list<PostedItem *>::iterator pit;
|
||||
std::list<PostedItem *> postedItems;
|
||||
std::list<PostedItem *>::iterator pit;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
int count = alayout->count();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
QLayoutItem *litem = alayout->itemAt(i);
|
||||
if (!litem)
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() missing litem";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
PostedItem *item = dynamic_cast<PostedItem *>(litem->widget());
|
||||
if (item)
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() item: " << item;
|
||||
std::cerr << std::endl;
|
||||
|
||||
postedItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
postedItems.push_back(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PostedListDialog::clearPosts() Found Child, which is not a PostedItem???";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
|
||||
{
|
||||
PostedItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
|
||||
{
|
||||
PostedItem *item = *pit;
|
||||
alayout->removeWidget(item);
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -528,7 +402,6 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
|
||||
case TOKENREQ_GROUPINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
|
||||
case RS_TOKREQ_ANSTYPE_ACK:
|
||||
acknowledgeGroup(req.mToken);
|
||||
break;
|
||||
@ -539,6 +412,20 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
|
||||
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:
|
||||
std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
|
@ -56,71 +56,69 @@ class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public To
|
||||
public:
|
||||
PostedListDialog(QWidget *parent = 0);
|
||||
|
||||
virtual void deletePostedItem(PostedItem *, uint32_t ptype) { return; }
|
||||
virtual void notifySelection(PostedItem *item, int ptype) { return; }
|
||||
virtual void requestComments(std::string threadId);
|
||||
virtual void deletePostedItem(PostedItem *, uint32_t ptype) { return; }
|
||||
virtual void notifySelection(PostedItem *item, int ptype) { return; }
|
||||
virtual void requestComments(std::string threadId);
|
||||
|
||||
signals:
|
||||
void loadComments( std::string );
|
||||
void loadComments( std::string );
|
||||
|
||||
private slots:
|
||||
|
||||
void groupListCustomPopupMenu( QPoint /*point*/ );
|
||||
void changedTopic(const QString &id);
|
||||
void groupListCustomPopupMenu( QPoint /*point*/ );
|
||||
void changedTopic(const QString &id);
|
||||
|
||||
void sortButtonClicked( QAbstractButton *button );
|
||||
void sortButtonPressed();
|
||||
|
||||
void periodChanged( int index );
|
||||
|
||||
void newGroup();
|
||||
void showGroupDetails();
|
||||
void editGroupDetails();
|
||||
void createPost();
|
||||
void newTopic();
|
||||
void showGroupDetails();
|
||||
void newPost();
|
||||
|
||||
private:
|
||||
|
||||
void clearPosts();
|
||||
void clearPosts();
|
||||
|
||||
void updateDisplay();
|
||||
void loadPost(const RsPostedPost &post);
|
||||
void updateDisplay();
|
||||
void loadPost(const RsPostedPost &post);
|
||||
|
||||
void insertGroups();
|
||||
void requestGroupSummary();
|
||||
void acknowledgeGroup(const uint32_t &token);
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
void insertGroups();
|
||||
void requestGroupSummary();
|
||||
void acknowledgeGroup(const uint32_t &token);
|
||||
void loadGroupSummary(const uint32_t &token);
|
||||
|
||||
void requestGroupSummary_CurrentForum(const std::string &forumId);
|
||||
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 requestGroupSummary_CurrentForum(const std::string &forumId);
|
||||
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||
|
||||
|
||||
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
||||
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
||||
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
void acknowledgeMsg(const uint32_t &token);
|
||||
void loadPostData(const uint32_t &token);
|
||||
void insertThreads();
|
||||
void loadCurrentTopicThreads(const std::string &forumId);
|
||||
void requestGroupThreadData_InsertThreads(const std::string &forumId);
|
||||
void loadGroupThreadData_InsertThreads(const uint32_t &token);
|
||||
|
||||
|
||||
QTreeWidgetItem *yourTopics;
|
||||
QTreeWidgetItem *subscribedTopics;
|
||||
QTreeWidgetItem *popularTopics;
|
||||
QTreeWidgetItem *otherTopics;
|
||||
void insertGroupData(const std::list<RsGroupMetaData> &groupList);
|
||||
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
|
||||
|
||||
QAbstractButton *mSortButton;
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
bool mThreadLoading;
|
||||
std::string mCurrTopicId;
|
||||
|
||||
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
|
||||
TokenQueue *mPostedQueue;
|
||||
private:
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
QTreeWidgetItem *yourTopics;
|
||||
QTreeWidgetItem *subscribedTopics;
|
||||
QTreeWidgetItem *popularTopics;
|
||||
QTreeWidgetItem *otherTopics;
|
||||
|
||||
QAbstractButton *mSortButton;
|
||||
|
||||
bool mThreadLoading;
|
||||
RsGxsGroupId mCurrTopicId;
|
||||
|
||||
QMap<RsGxsGroupId, RsPostedGroup> mGroups;
|
||||
TokenQueue *mPostedQueue;
|
||||
|
||||
/* UI - from Designer */
|
||||
Ui::PostedListDialog ui;
|
||||
|
||||
};
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
#define GXSGROUP_LOADGROUP 2
|
||||
|
||||
/** 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)
|
||||
{
|
||||
/* 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.groupLogo, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
||||
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
||||
|
||||
//ui.headerFrame->setHeaderImage(QPixmap(":/WikiPoos/images/resource-group-new_48.png"));
|
||||
connect( ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
|
||||
|
||||
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"));
|
||||
|
||||
if (!ui.pubKeyShare_cb->isChecked())
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
* @param parent The parent dialog
|
||||
* @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
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create new Wiki Group</string>
|
||||
<string>Create New Group</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../images.qrc">
|
||||
@ -67,7 +67,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="mServiceHeader">
|
||||
<property name="text">
|
||||
<string>Create Wiki Group</string>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user