From da4c1e0f7f4ae2938dbbdc01d6da76b43d6c29ed Mon Sep 17 00:00:00 2001
From: drbob
Date: Mon, 11 Mar 2013 20:53:15 +0000
Subject: [PATCH] Added New Services to GUI. - Added GxsChannels - Added New
Common Comments GUI elements. - Moved Posted over to use Comments.
Lots done, but lots to do!
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6212 b45a01b8-16f6-495d-af2f-9b41ad6348cc
---
retroshare-gui/src/gui/ChannelFeed.cpp | 4 +
retroshare-gui/src/gui/ChannelFeed.h | 1 +
retroshare-gui/src/gui/NewsFeed.cpp | 9 +
retroshare-gui/src/gui/NewsFeed.h | 1 +
.../src/gui/Posted/PostedCreatePostDialog.cpp | 2 +-
retroshare-gui/src/gui/Posted/PostedDialog.h | 52 +-
.../src/gui/Posted/PostedGroupDialog.cpp | 68 +-
.../src/gui/Posted/PostedGroupDialog.h | 26 +-
retroshare-gui/src/gui/Posted/PostedItem.cpp | 2 +
.../src/gui/Posted/PostedListDialog.cpp | 856 ++++++-------
.../src/gui/Posted/PostedListDialog.h | 12 +-
retroshare-gui/src/gui/feeds/FeedHolder.h | 3 +
.../src/gui/feeds/GxsChannelPostItem.cpp | 663 ++++++++++
.../src/gui/feeds/GxsChannelPostItem.h | 83 ++
.../src/gui/feeds/GxsChannelPostItem.ui | 481 ++++++++
.../src/gui/gxs/GxsCommentContainer.cpp | 91 ++
.../src/gui/gxs/GxsCommentContainer.h | 97 ++
.../src/gui/gxs/GxsCommentContainer.ui | 88 ++
.../src/gui/gxs/GxsCommentDialog.cpp | 90 ++
retroshare-gui/src/gui/gxs/GxsCommentDialog.h | 51 +
.../src/gui/gxs/GxsCommentDialog.ui | 367 ++++++
.../src/gui/gxs/GxsCommentTreeWidget.cpp | 30 +-
.../src/gui/gxs/GxsCommentTreeWidget.h | 6 +-
.../src/gui/gxs/GxsCreateCommentDialog.cpp | 32 +
.../src/gui/gxs/GxsCreateCommentDialog.h | 34 +
.../src/gui/gxs/GxsCreateCommentDialog.ui | 82 ++
.../src/gui/gxschannels/ChannelDialog.h | 69 ++
.../gui/gxschannels/CreateGxsChannelMsg.cpp | 656 ++++++++++
.../src/gui/gxschannels/CreateGxsChannelMsg.h | 91 ++
.../gui/gxschannels/CreateGxsChannelMsg.ui | 365 ++++++
.../src/gui/gxschannels/GxsChannelDialog.cpp | 1092 +++++++++++++++++
.../src/gui/gxschannels/GxsChannelDialog.h | 182 +++
.../src/gui/gxschannels/GxsChannelDialog.ui | 366 ++++++
.../gui/gxschannels/GxsChannelGroupDialog.cpp | 95 ++
.../gui/gxschannels/GxsChannelGroupDialog.h | 42 +
.../gui/gxsforums/GxsForumThreadWidget.cpp | 19 +-
.../src/gui/unfinished/ApplicationWindow.cpp | 9 +-
retroshare-gui/src/retroshare-gui.pro | 58 +-
38 files changed, 5725 insertions(+), 550 deletions(-)
create mode 100644 retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp
create mode 100644 retroshare-gui/src/gui/feeds/GxsChannelPostItem.h
create mode 100644 retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentContainer.h
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentContainer.ui
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentDialog.h
create mode 100644 retroshare-gui/src/gui/gxs/GxsCommentDialog.ui
create mode 100644 retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.cpp
create mode 100644 retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.h
create mode 100644 retroshare-gui/src/gui/gxs/GxsCreateCommentDialog.ui
create mode 100644 retroshare-gui/src/gui/gxschannels/ChannelDialog.h
create mode 100644 retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp
create mode 100644 retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.h
create mode 100644 retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.ui
create mode 100644 retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp
create mode 100644 retroshare-gui/src/gui/gxschannels/GxsChannelDialog.h
create mode 100644 retroshare-gui/src/gui/gxschannels/GxsChannelDialog.ui
create mode 100644 retroshare-gui/src/gui/gxschannels/GxsChannelGroupDialog.cpp
create mode 100644 retroshare-gui/src/gui/gxschannels/GxsChannelGroupDialog.h
diff --git a/retroshare-gui/src/gui/ChannelFeed.cpp b/retroshare-gui/src/gui/ChannelFeed.cpp
index 4c42874e3..c12f73e02 100644
--- a/retroshare-gui/src/gui/ChannelFeed.cpp
+++ b/retroshare-gui/src/gui/ChannelFeed.cpp
@@ -246,6 +246,10 @@ void ChannelFeed::openChat(std::string /*peerId*/)
{
}
+void ChannelFeed::openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/)
+{
+}
+
void ChannelFeed::editChannelDetail(){
EditChanDetails editUi(this, mChannelId);
diff --git a/retroshare-gui/src/gui/ChannelFeed.h b/retroshare-gui/src/gui/ChannelFeed.h
index a785c4301..4609c2602 100644
--- a/retroshare-gui/src/gui/ChannelFeed.h
+++ b/retroshare-gui/src/gui/ChannelFeed.h
@@ -54,6 +54,7 @@ public:
virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
+ virtual void openComments(uint32_t /*type*/ , const RsGxsGroupId & /*grpId */, const RsGxsMessageId & /*msgId*/);
bool navigate(const std::string& channelId, const std::string& msgId);
diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp
index 6707ea0c9..183504763 100644
--- a/retroshare-gui/src/gui/NewsFeed.cpp
+++ b/retroshare-gui/src/gui/NewsFeed.cpp
@@ -810,6 +810,15 @@ void NewsFeed::openChat(std::string peerId)
ChatDialog::chatFriend(peerId);
}
+
+void NewsFeed::openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
+{
+ std::cerr << "NewsFeed::openComments() Not Handled Yet";
+ std::cerr << std::endl;
+}
+
+
+
void NewsFeed::itemDestroyed(QObject *item)
{
widgets.remove(item);
diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h
index afca54975..352eddbef 100644
--- a/retroshare-gui/src/gui/NewsFeed.h
+++ b/retroshare-gui/src/gui/NewsFeed.h
@@ -47,6 +47,7 @@ public:
virtual QScrollArea *getScrollArea();
virtual void deleteFeedItem(QWidget *item, uint32_t type);
virtual void openChat(std::string peerId);
+ virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId);
static void testFeeds(uint notifyFlags);
static void testFeed(FeedNotify *feedNotify);
diff --git a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp
index c9eebf008..aa611f178 100644
--- a/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedCreatePostDialog.cpp
@@ -18,7 +18,7 @@ void PostedCreatePostDialog::createPost()
post.mMeta.mMsgName = ui->titleEdit->text().toStdString();
uint32_t token;
- mPosted->submitPost(token, post);
+ mPosted->createPost(token, post);
mTokenQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_POST);
close();
}
diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.h b/retroshare-gui/src/gui/Posted/PostedDialog.h
index 4b491770d..cb5c6710f 100644
--- a/retroshare-gui/src/gui/Posted/PostedDialog.h
+++ b/retroshare-gui/src/gui/Posted/PostedDialog.h
@@ -24,43 +24,43 @@
#ifndef MRK_POSTED_DIALOG_H
#define MRK_POSTED_DIALOG_H
-#include "retroshare-gui/mainpage.h"
-#include "ui_PostedDialog.h"
-
#include
-#include
");
}
+#endif
}
diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp
index 80d9ae9d0..729c79b01 100644
--- a/retroshare-gui/src/gui/Posted/PostedListDialog.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedListDialog.cpp
@@ -44,213 +44,222 @@
//#define DEBUG_FORUMS
/* Images for context menu icons */
-#define IMAGE_MESSAGE ":/images/folder-draft.png"
+#define IMAGE_MESSAGE ":/images/folder-draft.png"
#define IMAGE_MESSAGEREPLY ":/images/mail_reply.png"
#define IMAGE_MESSAGEREMOVE ":/images/mail_delete.png"
-#define IMAGE_DOWNLOAD ":/images/start.png"
-#define IMAGE_DOWNLOADALL ":/images/startall.png"
+#define IMAGE_DOWNLOAD ":/images/start.png"
+#define IMAGE_DOWNLOADALL ":/images/startall.png"
/* Images for TreeWidget */
-#define IMAGE_FOLDER ":/images/folder16.png"
-#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
-#define IMAGE_FOLDERRED ":/images/folder_red.png"
+#define IMAGE_FOLDER ":/images/folder16.png"
+#define IMAGE_FOLDERGREEN ":/images/folder_green.png"
+#define IMAGE_FOLDERRED ":/images/folder_red.png"
#define IMAGE_FOLDERYELLOW ":/images/folder_yellow.png"
-#define IMAGE_FORUM ":/images/konversation16.png"
-#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
-#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
-#define IMAGE_INFO ":/images/info16.png"
-#define IMAGE_NEWFORUM ":/images/new_forum16.png"
-#define IMAGE_FORUMAUTHD ":/images/konv_message2.png"
-#define IMAGE_COPYLINK ":/images/copyrslink.png"
+#define IMAGE_FORUM ":/images/konversation16.png"
+#define IMAGE_SUBSCRIBE ":/images/edit_add24.png"
+#define IMAGE_UNSUBSCRIBE ":/images/cancel.png"
+#define IMAGE_INFO ":/images/info16.png"
+#define IMAGE_NEWFORUM ":/images/new_forum16.png"
+#define IMAGE_FORUMAUTHD ":/images/konv_message2.png"
+#define IMAGE_COPYLINK ":/images/copyrslink.png"
// token types to deal with
/** Constructor */
-PostedListDialog::PostedListDialog(CommentHolder *commentHolder, QWidget *parent)
-: RsAutoUpdatePage(1000,parent), mCommentHolder(commentHolder)
+PostedListDialog::PostedListDialog(QWidget *parent)
+: RsAutoUpdatePage(1000,parent), GxsServiceDialog(dynamic_cast(parent))
{
- /* Invoke the Qt Designer generated object setup routine */
- ui.setupUi(this);
+ /* 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( 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) ) );
- connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
- connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
- connect(ui.topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
+ connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
+ connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
+ connect(ui.topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
- /* create posted tree */
- yourTopics = ui.groupTreeWidget->addCategoryItem(tr("My 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);
- otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
+ /* create posted tree */
+ yourTopics = ui.groupTreeWidget->addCategoryItem(tr("My 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);
+ otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
- ui.hotSortButton->setChecked(true);
+ ui.hotSortButton->setChecked(true);
- connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) );
- connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics()));
- connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
+ connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) );
+ connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics()));
+ connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
}
void PostedListDialog::getRankings()
{
+#if 0
+ if(mCurrTopicId.empty())
+ return;
- if(mCurrTopicId.empty())
- return;
+ std::cerr << "PostedListDialog::getHotRankings()";
+ std::cerr << std::endl;
- std::cerr << "PostedListDialog::getHotRankings()";
- std::cerr << std::endl;
+ RsTokReqOptions opts;
+ opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
+ uint32_t token;
- RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
- uint32_t token;
+ QObject* button = sender();
+ if(button == ui.hotSortButton)
+ {
+ rsPosted->requestPostRankings(token, RsPosted::HotRankType, mCurrTopicId);
+ }else if(button == ui.topSortButton)
+ {
+ rsPosted->requestPostRankings(token, RsPosted::TopRankType, mCurrTopicId);
+ }else if(button == ui.newSortButton)
+ {
+ rsPosted->requestPostRankings(token, RsPosted::NewRankType, mCurrTopicId);
+ }else{
+ return;
+ }
- QObject* button = sender();
- if(button == ui.hotSortButton)
- {
- rsPosted->requestPostRankings(token, RsPosted::HotRankType, mCurrTopicId);
- }else if(button == ui.topSortButton)
- {
- rsPosted->requestPostRankings(token, RsPosted::TopRankType, mCurrTopicId);
- }else if(button == ui.newSortButton)
- {
- rsPosted->requestPostRankings(token, RsPosted::NewRankType, mCurrTopicId);
- }else{
- return;
- }
-
- mPostedQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_DATA, TOKEN_USER_TYPE_POST_RANKINGS);
+ mPostedQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_DATA, TOKEN_USER_TYPE_POST_RANKINGS);
+#endif
}
+#if 0
void PostedListDialog::loadRankings(const uint32_t &token)
{
+ RsPostedPostRanking rankings;
- RsPostedPostRanking rankings;
+ if(!rsPosted->getPostRanking(token, rankings))
+ return;
- if(!rsPosted->getPostRanking(token, rankings))
- return;
+ if(rankings.grpId != mCurrTopicId)
+ return;
- if(rankings.grpId != mCurrTopicId)
- return;
-
- applyRanking(rankings.ranking);
+ applyRanking(rankings.ranking);
}
+#endif
+#if 0
void PostedListDialog::applyRanking(const PostedRanking& ranks)
{
- std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
+ std::cerr << std::endl;
- shallowClearPosts();
+ shallowClearPosts();
- QLayout *alayout = ui.scrollAreaWidgetContents->layout();
+ QLayout *alayout = ui.scrollAreaWidgetContents->layout();
- PostedRanking::const_iterator mit = ranks.begin();
+ PostedRanking::const_iterator mit = ranks.begin();
- for(; mit != ranks.end(); mit++)
- {
- const RsGxsMessageId& msgId = mit->second;
+ for(; mit != ranks.end(); mit++)
+ {
+ const RsGxsMessageId& msgId = mit->second;
- if(mPosts.find(msgId) != mPosts.end())
- alayout->addWidget(mPosts[msgId]);
- }
+ if(mPosts.find(msgId) != mPosts.end())
+ alayout->addWidget(mPosts[msgId]);
+ }
- return;
+ return;
}
+#endif
void PostedListDialog::refreshTopics()
{
- std::cerr << "PostedListDialog::requestGroupSummary()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::requestGroupSummary()";
+ std::cerr << std::endl;
- RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
- uint32_t token;
- mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
+ RsTokReqOptions opts;
+ opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
+ uint32_t token;
+ mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
}
void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
{
- QMenu contextMnu( this );
+ QMenu contextMnu( this );
- QAction *action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Post"), this, SLOT(newPost()));
- action->setDisabled (mCurrTopicId.empty());
+ QAction *action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Post"), this, SLOT(newPost()));
+ action->setDisabled (mCurrTopicId.empty());
- contextMnu.exec(QCursor::pos());
+ contextMnu.exec(QCursor::pos());
}
void PostedListDialog::newPost()
{
- if(mCurrTopicId.empty())
- return;
+ if(mCurrTopicId.empty())
+ return;
- PostedCreatePostDialog cp(mPostedQueue, rsPosted, mCurrTopicId, this);
- cp.exec();
+ PostedCreatePostDialog cp(mPostedQueue, rsPosted, mCurrTopicId, this);
+ cp.exec();
}
void PostedListDialog::submitVote(const RsGxsGrpMsgIdPair &msgId, bool up)
{
- uint32_t token;
- RsPostedVote vote;
+#if 0
+ uint32_t token;
+ RsPostedVote vote;
- vote.mMeta.mGroupId = msgId.first;
- vote.mMeta.mParentId = msgId.second;
- vote.mDirection = (uint8_t)up;
- rsPosted->submitVote(token, vote);
+ vote.mMeta.mGroupId = msgId.first;
+ vote.mMeta.mParentId = msgId.second;
+ vote.mDirection = (uint8_t)up;
+ rsPosted->submitVote(token, vote);
- mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
-}
+ mPostedQueue->queueRequest(token, 0 , RS_TOKREQ_ANSTYPE_ACK, TOKEN_USER_TYPE_VOTE);
+#endif
+}
void PostedListDialog::showComments(const RsPostedPost& post)
{
- mCommentHolder->commentLoad(post);
+ commentLoad(post.mMeta.mGroupId, post.mMeta.mMsgId);
+ //mCommentHolder->commentLoad(post);
}
+
+
void PostedListDialog::updateDisplay()
{
- if (!rsPosted)
- return;
+ if (!rsPosted)
+ return;
- std::list groupIds;
- std::map > msgs;
+ std::list groupIds;
+ std::map > msgs;
- if (rsPosted->updated(true, true))
- {
- /* update Forums List */
+ if (rsPosted->updated(true, true))
+ {
+ /* update Forums List */
- rsPosted->groupsChanged(groupIds);
- if(!groupIds.empty())
- {
- std::list::iterator it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
+ rsPosted->groupsChanged(groupIds);
+ if(!groupIds.empty())
+ {
+ std::list::iterator it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
- if(it != groupIds.end()){
- requestGroupSummary();
- return;
- }
- }
+ if(it != groupIds.end()){
+ requestGroupSummary();
+ return;
+ }
+ }
- rsPosted->msgsChanged(msgs);
+ rsPosted->msgsChanged(msgs);
- if(!msgs.empty())
- {
+ if(!msgs.empty())
+ {
- std::map >::iterator mit = msgs.find(mCurrTopicId);
- if(mit != msgs.end())
- {
- updateDisplayedItems(mit->second);
- }
- }
- }
+ std::map >::iterator mit = msgs.find(mCurrTopicId);
+ if(mit != msgs.end())
+ {
+ updateDisplayedItems(mit->second);
+ }
+ }
+ }
}
@@ -258,20 +267,20 @@ void PostedListDialog::updateDisplay()
void PostedListDialog::updateDisplayedItems(const std::vector &msgIds)
{
- RsTokReqOptions opts;
+ RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
- opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
+ opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
+ opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
- GxsMsgReq msgs;
- msgs[mCurrTopicId] = msgIds;
+ GxsMsgReq msgs;
+ msgs[mCurrTopicId] = msgIds;
- std::cerr << "PostedListDialog::updateDisplayedItems(" << mCurrTopicId << ")";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::updateDisplayedItems(" << mCurrTopicId << ")";
+ std::cerr << std::endl;
- uint32_t token;
- mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
+ uint32_t token;
+ mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
}
@@ -279,18 +288,18 @@ void PostedListDialog::updateDisplayedItems(const std::vector &m
void PostedListDialog::changedTopic(const QString &id)
{
- mCurrTopicId = id.toStdString();
- insertThreads();
+ mCurrTopicId = id.toStdString();
+ insertThreads();
}
/*********************** **** **** **** ***********************/
-/** New / Edit Groups ********************************/
+/** New / Edit Groups ********************************/
/*********************** **** **** **** ***********************/
void PostedListDialog::newTopic()
{
- PostedGroupDialog cf (mPostedQueue, rsPosted, this);
+ PostedGroupDialog cf (mPostedQueue, this);
cf.exec ();
}
@@ -301,7 +310,7 @@ void PostedListDialog::showGroupDetails()
return;
}
- PostedGroupDialog cf(mGroups[mCurrTopicId], GxsGroupDialog::MODE_SHOW, this);
+ PostedGroupDialog cf(mGroups[mCurrTopicId], this);
cf.exec ();
}
@@ -313,72 +322,72 @@ void PostedListDialog::insertGroups()
void PostedListDialog::requestGroupSummary()
{
- std::cerr << "PostedListDialog::requestGroupSummary()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::requestGroupSummary()";
+ std::cerr << std::endl;
- RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
+ RsTokReqOptions opts;
+ opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token;
- mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
+ mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
}
void PostedListDialog::acknowledgeGroup(const uint32_t &token)
{
- RsGxsGroupId grpId;
- rsPosted->acknowledgeGrp(token, grpId);
+ RsGxsGroupId grpId;
+ rsPosted->acknowledgeGrp(token, grpId);
- if(!grpId.empty())
- {
+ if(!grpId.empty())
+ {
- RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
- uint32_t reqToken;
- mPostedQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
- }
+ RsTokReqOptions opts;
+ opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
+ uint32_t reqToken;
+ mPostedQueue->requestGroupInfo(reqToken, RS_TOKREQ_ANSTYPE_SUMMARY, opts, TOKEN_USER_TYPE_TOPIC);
+ }
}
void PostedListDialog::acknowledgePostMsg(const uint32_t &token)
{
- RsGxsGrpMsgIdPair msgId;
+ RsGxsGrpMsgIdPair msgId;
- // just acknowledge, don't load anything
- rsPosted->acknowledgeMsg(token, msgId);
+ // just acknowledge, don't load anything
+ rsPosted->acknowledgeMsg(token, msgId);
}
void PostedListDialog::loadGroupSummary(const uint32_t &token)
{
- std::cerr << "PostedListDialog::loadGroupSummary()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadGroupSummary()";
+ std::cerr << std::endl;
- std::list groupInfo;
- rsPosted->getGroupSummary(token, groupInfo);
+ std::list groupInfo;
+ rsPosted->getGroupSummary(token, groupInfo);
- if (groupInfo.size() > 0)
- {
+ if (groupInfo.size() > 0)
+ {
insertGroupData(groupInfo);
- }
- else
- {
- std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups...";
- std::cerr << std::endl;
- }
+ }
+ else
+ {
+ std::cerr << "PostedListDialog::loadGroupSummary() ERROR No Groups...";
+ std::cerr << std::endl;
+ }
}
void PostedListDialog::loadPostData(const uint32_t &token)
{
- loadGroupThreadData_InsertThreads(token);
+ loadGroupThreadData_InsertThreads(token);
}
void PostedListDialog::acknowledgeVoteMsg(const uint32_t &token)
{
- RsGxsGrpMsgIdPair msgId;
+ RsGxsGrpMsgIdPair msgId;
- rsPosted->acknowledgeMsg(token, msgId);
+ rsPosted->acknowledgeMsg(token, msgId);
}
void PostedListDialog::loadVoteData(const uint32_t &token)
{
- return;
+ return;
}
/*********************** **** **** **** ***********************/
@@ -388,13 +397,13 @@ void PostedListDialog::loadVoteData(const uint32_t &token)
void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
{
- RsTokReqOptions opts;
+ RsTokReqOptions opts;
std::list grpIds;
grpIds.push_back(forumId);
- std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
+ std::cerr << std::endl;
uint32_t token;
mPostedQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, POSTEDDIALOG_CURRENTFORUM);
@@ -402,22 +411,22 @@ void PostedListDialog::requestGroupSummary_CurrentForum(const std::string &forum
void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
{
- std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum()";
+ std::cerr << std::endl;
- std::list groupInfo;
- rsPosted->getGroupSummary(token, groupInfo);
+ std::list groupInfo;
+ rsPosted->getGroupSummary(token, groupInfo);
- if (groupInfo.size() == 1)
- {
+ if (groupInfo.size() == 1)
+ {
RsGroupMetaData fi = groupInfo.front();
//insertForumThreads(fi);
- }
- else
- {
- std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
- std::cerr << std::endl;
- }
+ }
+ else
+ {
+ std::cerr << "PostedListDialog::loadGroupSummary_CurrentForum() ERROR Invalid Number of Groups...";
+ std::cerr << std::endl;
+ }
}
/*********************** **** **** **** ***********************/
@@ -428,189 +437,182 @@ void PostedListDialog::loadGroupSummary_CurrentForum(const uint32_t &token)
void PostedListDialog::insertThreads()
{
- loadCurrentTopicThreads(mCurrTopicId);
+ loadCurrentTopicThreads(mCurrTopicId);
}
void PostedListDialog::loadCurrentTopicThreads(const std::string &topicId)
{
- std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadCurrentForumThreads(" << topicId << ")";
+ std::cerr << std::endl;
- if (topicId.empty())
+ if (topicId.empty())
{
- std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
+ std::cerr << std::endl;
return;
- }
+ }
clearPosts();
- /* initiate loading */
- requestGroupThreadData_InsertThreads(topicId);
+ /* initiate loading */
+ requestGroupThreadData_InsertThreads(topicId);
}
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
{
- RsTokReqOptions opts;
+ RsTokReqOptions opts;
- opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
- opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
+ opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
+ opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
- std::list grpIds;
+ std::list grpIds;
grpIds.push_back(groupId);
- std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")";
+ std::cerr << std::endl;
uint32_t token;
- mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST);
+ mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, TOKEN_USER_TYPE_POST);
}
void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
{
- std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
+ std::cerr << std::endl;
- clearPosts();
+ clearPosts();
- PostedPostResult result;
- rsPosted->getPost(token, result);
- std::vector& posts = result[mCurrTopicId];
- std::vector::iterator vit = posts.begin();
+ std::vector posts;
+ rsPosted->getPostData(token, posts);
+ std::vector::iterator vit;
+
+ for(vit = posts.begin(); vit != posts.end(); vit++)
+ {
+ RsPostedPost& p = *vit;
+ loadPost(p);
+ }
- for(; vit != posts.end(); vit++)
- {
- RsPostedPost& p = *vit;
- loadPost(p);
- }
}
void PostedListDialog::loadPost(const RsPostedPost &post)
{
- PostedItem *item = new PostedItem(this, post);
- connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
- QLayout *alayout = ui.scrollAreaWidgetContents->layout();
- mPosts.insert(post.mMeta.mMsgId, item);
- alayout->addWidget(item);
+ PostedItem *item = new PostedItem(this, post);
+ connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
+ QLayout *alayout = ui.scrollAreaWidgetContents->layout();
+ mPosts.insert(post.mMeta.mMsgId, item);
+ alayout->addWidget(item);
}
void PostedListDialog::clearPosts()
{
- std::cerr << "PostedListDialog::clearPosts()" << std::endl;
+ std::cerr << "PostedListDialog::clearPosts()" << std::endl;
- std::list postedItems;
- std::list::iterator pit;
+ std::list postedItems;
+ std::list::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(litem->widget());
- if (item)
- {
- std::cerr << "PostedListDialog::clearPosts() item: " << item;
- std::cerr << std::endl;
+ PostedItem *item = dynamic_cast(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;
+ }
- mPosts.clear();
+ mPosts.clear();
}
void PostedListDialog::shallowClearPosts()
{
- std::cerr << "PostedListDialog::clearPosts()" << std::endl;
+ std::cerr << "PostedListDialog::clearPosts()" << std::endl;
- std::list postedItems;
- std::list::iterator pit;
+ std::list postedItems;
+ std::list::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(litem->widget());
- if (item)
- {
- std::cerr << "PostedListDialog::clearPosts() item: " << item;
- std::cerr << std::endl;
+ PostedItem *item = dynamic_cast(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);
- }
+ for(pit = postedItems.begin(); pit != postedItems.end(); pit++)
+ {
+ PostedItem *item = *pit;
+ alayout->removeWidget(item);
+ }
}
void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
{
- std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
- std::cerr << std::endl;
+ std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
+ std::cerr << std::endl;
- PostedPostResult result;
- rsPosted->getPost(token, result);
+ std::vector posts;
+ rsPosted->getPostData(token, posts);
+ std::vector::iterator vit;
+ for(vit = posts.begin(); vit != posts.end(); vit++)
+ {
- if(result.find(mCurrTopicId) == result.end())
- return;
+ RsPostedPost& p = *vit;
- std::vector& posts = result[mCurrTopicId];
- std::vector::iterator vit = posts.begin();
-
- for(; vit != posts.end(); vit++)
- {
-
- RsPostedPost& p = *vit;
-
- // modify post content
- if(mPosts.find(p.mMeta.mMsgId) != mPosts.end())
- mPosts[p.mMeta.mMsgId]->setContent(p);
-
- }
+ // modify post content
+ if(mPosts.find(p.mMeta.mMsgId) != mPosts.end())
+ mPosts[p.mMeta.mMsgId]->setContent(p);
+ }
}
/*********************** **** **** **** ***********************/
@@ -623,88 +625,88 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
std::cerr << std::endl;
if (queue == mPostedQueue)
- {
- /* now switch on req */
- switch(req.mUserType)
+ {
+ /* now switch on req */
+ switch(req.mUserType)
{
- case TOKEN_USER_TYPE_TOPIC:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_SUMMARY:
- loadGroupSummary(req.mToken);
- break;
- default:
- std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
- break;
- }
- break;
- case TOKEN_USER_TYPE_POST:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_ACK:
- acknowledgePostMsg(req.mToken);
- break;
- case RS_TOKREQ_ANSTYPE_DATA:
- loadPostData(req.mToken);
- break;
- default:
- std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
- break;
- }
- break;
- case TOKEN_USER_TYPE_VOTE:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_ACK:
- acknowledgeVoteMsg(req.mToken);
- break;
- default:
- std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
- break;
- }
- break;
- case TOKEN_USER_TYPE_POST_MOD:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_DATA:
- updateCurrentDisplayComplete(req.mToken);
- break;
- default:
- std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
- break;
- }
- break;
- case TOKEN_USER_TYPE_POST_RANKINGS:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_DATA:
- loadRankings(req.mToken);
- break;
- default:
- std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
- break;
- }
- break;
- default:
- std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
- std::cerr << std::endl;
- break;
+ case TOKEN_USER_TYPE_TOPIC:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_SUMMARY:
+ loadGroupSummary(req.mToken);
+ break;
+ default:
+ std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
+ break;
+ }
+ break;
+ case TOKEN_USER_TYPE_POST:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_ACK:
+ acknowledgePostMsg(req.mToken);
+ break;
+ case RS_TOKREQ_ANSTYPE_DATA:
+ loadPostData(req.mToken);
+ break;
+ default:
+ std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
+ break;
+ }
+ break;
+ case TOKEN_USER_TYPE_VOTE:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_ACK:
+ acknowledgeVoteMsg(req.mToken);
+ break;
+ default:
+ std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
+ break;
+ }
+ break;
+ case TOKEN_USER_TYPE_POST_MOD:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_DATA:
+ updateCurrentDisplayComplete(req.mToken);
+ break;
+ default:
+ std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
+ break;
+ }
+ break;
+ case TOKEN_USER_TYPE_POST_RANKINGS:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_DATA:
+ //loadRankings(req.mToken);
+ break;
+ default:
+ std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
+ break;
+ }
+ break;
+ default:
+ std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
+ std::cerr << std::endl;
+ break;
}
}
- /* now switch on req */
- switch(req.mType)
- {
- case TOKENREQ_GROUPINFO:
- switch(req.mAnsType)
- {
- case RS_TOKREQ_ANSTYPE_ACK:
- acknowledgeGroup(req.mToken);
- break;
- }
- break;
- }
+ /* now switch on req */
+ switch(req.mType)
+ {
+ case TOKENREQ_GROUPINFO:
+ switch(req.mAnsType)
+ {
+ case RS_TOKREQ_ANSTYPE_ACK:
+ acknowledgeGroup(req.mToken);
+ break;
+ }
+ break;
+ }
}
@@ -717,11 +719,11 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo)
{
- groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
- groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
- //groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
- groupItemInfo.popularity = groupInfo.mPop;
- groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
+ groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId);
+ groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
+ //groupItemInfo.description = QString::fromUtf8(groupInfo.forumDesc);
+ groupItemInfo.popularity = groupInfo.mPop;
+ groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
}
@@ -729,60 +731,60 @@ void PostedListDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
void PostedListDialog::insertGroupData(const std::list &groupList)
{
- std::list::const_iterator it;
+ std::list::const_iterator it;
- QList adminList;
- QList subList;
- QList popList;
- QList otherList;
- std::multimap popMap;
+ QList adminList;
+ QList subList;
+ QList popList;
+ QList otherList;
+ std::multimap popMap;
- for (it = groupList.begin(); it != groupList.end(); it++) {
- /* sort it into Publish (Own), Subscribed, Popular and Other */
- uint32_t flags = it->mSubscribeFlags;
+ for (it = groupList.begin(); it != groupList.end(); it++) {
+ /* sort it into Publish (Own), Subscribed, Popular and Other */
+ uint32_t flags = it->mSubscribeFlags;
- GroupItemInfo groupItemInfo;
- groupInfoToGroupItemInfo(*it, groupItemInfo);
+ GroupItemInfo groupItemInfo;
+ groupInfoToGroupItemInfo(*it, groupItemInfo);
// if (flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) {
- adminList.push_back(groupItemInfo);
+ adminList.push_back(groupItemInfo);
// } else if (flags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) {
- /* subscribed forum */
+ /* subscribed forum */
// subList.push_back(groupItemInfo);
// } else {
- /* rate the others by popularity */
-// popMap.insert(std::make_pair(it->mPop, groupItemInfo));
- }
-// }
+ /* rate the others by popularity */
+// popMap.insert(std::make_pair(it->mPop, groupItemInfo));
+ }
+// }
- /* iterate backwards through popMap - take the top 5 or 10% of list */
- uint32_t popCount = 5;
- if (popCount < popMap.size() / 10)
- {
- popCount = popMap.size() / 10;
- }
+ /* iterate backwards through popMap - take the top 5 or 10% of list */
+ uint32_t popCount = 5;
+ if (popCount < popMap.size() / 10)
+ {
+ popCount = popMap.size() / 10;
+ }
- uint32_t i = 0;
- uint32_t popLimit = 0;
- std::multimap::reverse_iterator rit;
- for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
- if (rit != popMap.rend()) {
- popLimit = rit->first;
- }
+ uint32_t i = 0;
+ uint32_t popLimit = 0;
+ std::multimap::reverse_iterator rit;
+ for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++) ;
+ if (rit != popMap.rend()) {
+ popLimit = rit->first;
+ }
- for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
- if (rit->second.popularity < (int) popLimit) {
- otherList.append(rit->second);
- } else {
- popList.append(rit->second);
- }
- }
+ for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
+ if (rit->second.popularity < (int) popLimit) {
+ otherList.append(rit->second);
+ } else {
+ popList.append(rit->second);
+ }
+ }
- /* now we can add them in as a tree! */
- ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
- ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
- ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
- ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
+ /* now we can add them in as a tree! */
+ ui.groupTreeWidget->fillGroupItems(yourTopics, adminList);
+ ui.groupTreeWidget->fillGroupItems(subscribedTopics, subList);
+ ui.groupTreeWidget->fillGroupItems(popularTopics, popList);
+ ui.groupTreeWidget->fillGroupItems(otherTopics, otherList);
}
/**************************************************************************************/
diff --git a/retroshare-gui/src/gui/Posted/PostedListDialog.h b/retroshare-gui/src/gui/Posted/PostedListDialog.h
index e2554dcd1..fb047bf8c 100644
--- a/retroshare-gui/src/gui/Posted/PostedListDialog.h
+++ b/retroshare-gui/src/gui/Posted/PostedListDialog.h
@@ -39,8 +39,8 @@
#include "retroshare-gui/RsAutoUpdatePage.h"
#include "PostedUserTypes.h"
+#include "gui/gxs/GxsCommentContainer.h"
-class CommentHolder;
/*********************** **** **** **** ***********************/
/** Request / Response of Data ********************************/
@@ -53,12 +53,12 @@ class CommentHolder;
#define POSTEDDIALOG_INSERT_POST 5
#define POSTEDDIALOG_REPLY_MESSAGE 6
-class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse
+class PostedListDialog : public RsAutoUpdatePage, public PostedHolder, public TokenResponse, public GxsServiceDialog
{
Q_OBJECT
public:
- PostedListDialog(CommentHolder* commentHolder, QWidget *parent = 0);
+ PostedListDialog(QWidget *parent = 0);
void showComments(const RsPostedPost& post);
@@ -112,8 +112,8 @@ private:
// ranking
- void loadRankings(const uint32_t& token);
- void applyRanking(const PostedRanking& ranks);
+ //void loadRankings(const uint32_t& token);
+ //void applyRanking(const PostedRanking& ranks);
// update displayed item
@@ -141,7 +141,7 @@ private:
QMap mPosts;
TokenQueue *mPostedQueue;
- CommentHolder* mCommentHolder;
+ //CommentHolder* mCommentHolder;
/* UI - from Designer */
Ui::PostedListDialog ui;
diff --git a/retroshare-gui/src/gui/feeds/FeedHolder.h b/retroshare-gui/src/gui/feeds/FeedHolder.h
index a5fe28b3b..3823e3430 100644
--- a/retroshare-gui/src/gui/feeds/FeedHolder.h
+++ b/retroshare-gui/src/gui/feeds/FeedHolder.h
@@ -25,6 +25,8 @@
#include
#include
+#include // WRONG ONE - BUT IT'LL DO FOR NOW.
+
class QScrollArea;
class FeedHolder
@@ -35,6 +37,7 @@ public:
virtual QScrollArea *getScrollArea() = 0;
virtual void deleteFeedItem(QWidget *item, uint32_t type) = 0;
virtual void openChat(std::string peerId) = 0;
+ virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
// Workaround for QTBUG-3372
void lockLayout(QWidget *feedItem, bool lock);
diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp
new file mode 100644
index 000000000..9aba39c30
--- /dev/null
+++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp
@@ -0,0 +1,663 @@
+/****************************************************************
+ * RetroShare is distributed under the following license:
+ *
+ * Copyright (C) 2008 Robert Fernie
+ *
+ * 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
+#include
+#include
+
+#include "rshare.h"
+#include "GxsChannelPostItem.h"
+
+#include "FeedHolder.h"
+#include "SubFileItem.h"
+#include "gui/notifyqt.h"
+#include "util/misc.h"
+#include "gui/RetroShareLink.h"
+#include "util/HandleRichText.h"
+#include "util/DateTime.h"
+
+#include
+
+/****
+ * #define DEBUG_ITEM 1
+ ****/
+
+#define COLOR_NORMAL QColor(248, 248, 248)
+#define COLOR_NEW QColor(220, 236, 253)
+
+#define SELF_LOAD 1
+#define DATA_PROVIDED 2
+
+/** Constructor */
+GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome)
+:QWidget(NULL), mParent(parent), mFeedId(feedId),
+ mChanId(chanId), mMsgId(msgId), mIsHome(isHome)
+{
+ mMode = SELF_LOAD;
+ mSubscribeFlags = 0;
+
+ setup();
+
+ // THIS IS JUST SO WE REMEMBER TO DO IT.
+ updateItemStatic();
+ updateItem();
+}
+
+/** Constructor */
+GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome)
+:QWidget(NULL), mParent(parent), mFeedId(feedId),
+ mChanId(post.mMeta.mGroupId), mMsgId(post.mMeta.mMsgId), mIsHome(isHome)
+{
+ mMode = DATA_PROVIDED;
+ mSubscribeFlags = subFlags;
+
+ setup();
+
+ loadPost(post);
+ updateItem();
+}
+
+
+void GxsChannelPostItem::setup()
+{
+ /* Invoke the Qt Designer generated object setup routine */
+ setupUi(this);
+
+ setAttribute ( Qt::WA_DeleteOnClose, true );
+
+ m_inUpdateItemStatic = false;
+
+ /* general ones */
+ connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) );
+ connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) );
+
+ /* specific */
+ connect(readAndClearButton, SIGNAL(clicked()), this, SLOT(readAndClearItem()));
+ connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
+
+ //connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( download ( void ) ) );
+ // HACK FOR NOW.
+ connect( downloadButton, SIGNAL( clicked( void ) ), this, SLOT( comments ( void ) ) );
+
+ connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( play ( void ) ) );
+ connect( copyLinkButton, SIGNAL( clicked( void ) ), this, SLOT( copyLink ( void ) ) );
+
+ connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) );
+ connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
+
+ downloadButton->hide();
+ playButton->hide();
+ warn_image_label->hide();
+ warning_label->hide();
+
+ titleLabel->setMinimumWidth(100);
+ subjectLabel->setMinimumWidth(100);
+ warning_label->setMinimumWidth(100);
+
+ frame->setProperty("state", "");
+ QPalette palette = frame->palette();
+ palette.setColor(frame->backgroundRole(), COLOR_NORMAL);
+ frame->setPalette(palette);
+
+ expandFrame->hide();
+}
+
+
+
+void GxsChannelPostItem::updateItemStatic()
+{
+ /* fill in */
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::updateItemStatic()";
+ std::cerr << std::endl;
+#endif
+
+ ChannelMsgInfo cmi;
+
+ if (!rsChannels)
+ return;
+
+ if (!rsChannels->getChannelMessage(mChanId, mMsgId, cmi))
+ return;
+
+ m_inUpdateItemStatic = true;
+
+ QString title;
+
+ ChannelInfo ci;
+ rsChannels->getChannelInfo(mChanId, ci);
+
+ if (!mIsHome)
+ {
+ title = tr("Channel Feed") + ": ";
+ RetroShareLink link;
+ link.createChannel(ci.channelId, "");
+ title += link.toHtml();
+ titleLabel->setText(title);
+ RetroShareLink msgLink;
+ msgLink.createChannel(cmi.channelId, cmi.msgId);
+ subjectLabel->setText(msgLink.toHtml());
+
+ if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
+ unsubscribeButton->setEnabled(true);
+ } else {
+ unsubscribeButton->setEnabled(false);
+ }
+ readButton->hide();
+ newLabel->hide();
+ copyLinkButton->hide();
+ }
+ else
+ {
+ /* subject */
+ titleLabel->setText(QString::fromStdWString(cmi.subject));
+ subjectLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
+
+ /* disable buttons: deletion facility not enabled with cache services yet */
+ clearButton->setEnabled(false);
+ unsubscribeButton->setEnabled(false);
+ clearButton->hide();
+ readAndClearButton->hide();
+ unsubscribeButton->hide();
+ copyLinkButton->show();
+
+ if ((ci.channelFlags & RS_DISTRIB_SUBSCRIBED) || (ci.channelFlags & RS_DISTRIB_ADMIN)) {
+ readButton->setVisible(true);
+
+ uint32_t status = 0;
+ rsChannels->getMessageStatus(mChanId, mMsgId, status);
+
+ if ((status & CHANNEL_MSG_STATUS_READ) == 0 || (status & CHANNEL_MSG_STATUS_UNREAD_BY_USER)) {
+ readButton->setChecked(true);
+ readButton->setIcon(QIcon(":/images/message-state-unread.png"));
+ } else {
+ readButton->setChecked(false);
+ readButton->setIcon(QIcon(":/images/message-state-read.png"));
+ }
+
+ bool newState;
+ QColor color;
+ if (status & CHANNEL_MSG_STATUS_READ) {
+ newLabel->setVisible(false);
+ newState = false;
+ color = COLOR_NORMAL;
+ } else {
+ newLabel->setVisible(true);
+ newState = true;
+ color = COLOR_NEW;
+ }
+
+ /* unpolish widget to clear the stylesheet's palette cache */
+ frame->style()->unpolish(frame);
+
+ QPalette palette = frame->palette();
+ palette.setColor(frame->backgroundRole(), color);
+ frame->setPalette(palette);
+
+ frame->setProperty("new", newState);
+ Rshare::refreshStyleSheet(frame, false);
+ } else {
+ readButton->setVisible(false);
+ newLabel->setVisible(false);
+ }
+ }
+
+ msgLabel->setText(RsHtml().formatText(NULL, QString::fromStdWString(cmi.msg), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
+ msgFrame->setVisible(!cmi.msg.empty());
+
+ datetimelabel->setText(DateTime::formatLongDateTime(cmi.ts));
+
+ filelabel->setText(QString("(%1 %2) %3").arg(cmi.count).arg(tr("Files")).arg(misc::friendlyUnit(cmi.size)));
+
+ if (mFileItems.empty() == false) {
+ std::list::iterator it;
+ for(it = mFileItems.begin(); it != mFileItems.end(); it++)
+ {
+ delete(*it);
+ }
+ mFileItems.clear();
+ }
+
+ std::list::iterator it;
+ for(it = cmi.files.begin(); it != cmi.files.end(); it++)
+ {
+ /* add file */
+ SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
+ SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
+ mFileItems.push_back(fi);
+
+ /* check if the file is a media file */
+ if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
+ fi->mediatype();
+
+
+ QLayout *layout = expandFrame->layout();
+ layout->addWidget(fi);
+ }
+
+ if(cmi.thumbnail.image_thumbnail != NULL)
+ {
+ QPixmap thumbnail;
+ thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG");
+
+ logoLabel->setPixmap(thumbnail);
+ }
+
+ m_inUpdateItemStatic = false;
+}
+
+
+
+
+
+void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
+{
+ /* fill in */
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::loadPost()";
+ std::cerr << std::endl;
+#endif
+
+ QString title;
+
+ if (!mIsHome)
+ {
+ title = tr("Channel Feed") + ": ";
+ RetroShareLink link;
+ link.createChannel(post.mMeta.mGroupId, "");
+ title += link.toHtml();
+ titleLabel->setText(title);
+ RetroShareLink msgLink;
+ msgLink.createChannel(post.mMeta.mGroupId, post.mMeta.mMsgId);
+ subjectLabel->setText(msgLink.toHtml());
+
+ if (IS_GROUP_SUBSCRIBED(mSubscribeFlags) || IS_GROUP_ADMIN(mSubscribeFlags))
+ {
+ unsubscribeButton->setEnabled(true);
+ }
+ else
+ {
+ unsubscribeButton->setEnabled(false);
+ }
+ readButton->hide();
+ newLabel->hide();
+ copyLinkButton->hide();
+ }
+ else
+ {
+ /* subject */
+ titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
+ subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
+
+ /* disable buttons: deletion facility not enabled with cache services yet */
+ clearButton->setEnabled(false);
+ unsubscribeButton->setEnabled(false);
+ clearButton->hide();
+ readAndClearButton->hide();
+ unsubscribeButton->hide();
+ copyLinkButton->show();
+
+ if (IS_GROUP_SUBSCRIBED(mSubscribeFlags) || IS_GROUP_ADMIN(mSubscribeFlags))
+ {
+
+ readButton->setVisible(true);
+
+ uint32_t status = 0;
+ rsChannels->getMessageStatus(mChanId, mMsgId, status);
+
+ if (IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
+ {
+ readButton->setChecked(true);
+ readButton->setIcon(QIcon(":/images/message-state-unread.png"));
+ }
+ else
+ {
+ readButton->setChecked(false);
+ readButton->setIcon(QIcon(":/images/message-state-read.png"));
+ }
+
+ bool newState;
+ QColor color;
+ if (!IS_MSG_UNREAD(post.mMeta.mMsgStatus))
+ {
+ newLabel->setVisible(false);
+ newState = false;
+ color = COLOR_NORMAL;
+ }
+ else
+ {
+ newLabel->setVisible(true);
+ newState = true;
+ color = COLOR_NEW;
+ }
+
+ /* unpolish widget to clear the stylesheet's palette cache */
+ frame->style()->unpolish(frame);
+
+ QPalette palette = frame->palette();
+ palette.setColor(frame->backgroundRole(), color);
+ frame->setPalette(palette);
+
+ frame->setProperty("new", newState);
+ Rshare::refreshStyleSheet(frame, false);
+ }
+ else
+ {
+ readButton->setVisible(false);
+ newLabel->setVisible(false);
+ }
+ }
+
+ msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
+ msgFrame->setVisible(!post.mMsg.empty());
+
+ datetimelabel->setText(DateTime::formatLongDateTime(post.mMeta.mPublishTs));
+
+ filelabel->setText(QString("(%1 %2) %3").arg(post.mCount).arg(tr("Files")).arg(misc::friendlyUnit(post.mSize)));
+
+ if (mFileItems.empty() == false) {
+ std::list::iterator it;
+ for(it = mFileItems.begin(); it != mFileItems.end(); it++)
+ {
+ delete(*it);
+ }
+ mFileItems.clear();
+ }
+
+#if 0
+ std::list::iterator it;
+ for(it = cmi.files.begin(); it != cmi.files.end(); it++)
+ {
+ /* add file */
+ SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
+ SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
+ mFileItems.push_back(fi);
+
+ /* check if the file is a media file */
+ if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
+ fi->mediatype();
+
+
+ QLayout *layout = expandFrame->layout();
+ layout->addWidget(fi);
+ }
+
+ if(cmi.thumbnail.image_thumbnail != NULL)
+ {
+ QPixmap thumbnail;
+ thumbnail.loadFromData(cmi.thumbnail.image_thumbnail, cmi.thumbnail.im_thumbnail_size, "PNG");
+
+ logoLabel->setPixmap(thumbnail);
+ }
+#endif
+
+}
+
+void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
+{
+ int hours = (int)time_left/3600;
+ int minutes = (time_left - hours*3600)%60;
+
+ warning_label->setText(tr("Warning! You have less than %1 hours and %2 minute before this file is deleted Consider saving it.").arg(
+ QString::number(hours)).arg(QString::number(minutes)));
+
+ QFont warnFont = warning_label->font();
+ warnFont.setBold(true);
+ warning_label->setFont(warnFont);
+
+ warn_image_label->setVisible(true);
+ warning_label->setVisible(true);
+ return;
+
+}
+
+void GxsChannelPostItem::updateItem()
+{
+ /* fill in */
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::updateItem()";
+ std::cerr << std::endl;
+#endif
+ int msec_rate = 10000;
+
+ int downloadCount = 0;
+ int downloadStartable = 0;
+ int playCount = 0;
+ int playStartable = 0;
+ bool startable;
+ bool loopAgain = false;
+
+ /* Very slow Tick to check when all files are downloaded */
+ std::list::iterator it;
+ for(it = mFileItems.begin(); it != mFileItems.end(); it++)
+ {
+ SubFileItem *item = *it;
+
+ if (item->isDownloadable(startable)) {
+ downloadCount++;
+ if (startable) {
+ downloadStartable++;
+ }
+ }
+ if (item->isPlayable(startable)) {
+ playCount++;
+ if (startable) {
+ playStartable++;
+ }
+ }
+
+ if (!item->done())
+ {
+ /* loop again */
+ loopAgain = true;
+ }
+ }
+
+ if (downloadCount) {
+ downloadButton->show();
+
+ if (downloadStartable) {
+ downloadButton->setEnabled(true);
+ } else {
+ downloadButton->setEnabled(false);
+ }
+ } else {
+ downloadButton->hide();
+ }
+ if (playCount) {
+ /* one file is playable */
+ playButton->show();
+
+ if (playStartable == 1) {
+ playButton->setEnabled(true);
+ } else {
+ playButton->setEnabled(false);
+ }
+ } else {
+ playButton->hide();
+ }
+
+ if (loopAgain) {
+ QTimer::singleShot( msec_rate, this, SLOT(updateItem( void ) ));
+ }
+
+ // HACK TO DISPLAY COMMENT BUTTON FOR NOW.
+ downloadButton->show();
+ downloadButton->setEnabled(true);
+}
+
+void GxsChannelPostItem::toggle()
+{
+ mParent->lockLayout(this, true);
+
+ if (expandFrame->isHidden())
+ {
+ expandFrame->show();
+ expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
+ expandButton->setToolTip(tr("Hide"));
+
+ readToggled(false);
+ }
+ else
+ {
+ expandFrame->hide();
+ expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
+ expandButton->setToolTip(tr("Expand"));
+ }
+
+ mParent->lockLayout(this, false);
+}
+
+void GxsChannelPostItem::removeItem()
+{
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::removeItem()";
+ std::cerr << std::endl;
+#endif
+
+ mParent->lockLayout(this, true);
+ hide();
+ mParent->lockLayout(this, false);
+
+ if (mParent)
+ {
+ mParent->deleteFeedItem(this, mFeedId);
+ }
+}
+
+
+void GxsChannelPostItem::comments()
+{
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::comments()";
+ std::cerr << std::endl;
+#endif
+
+ if (mParent)
+ {
+ mParent->openComments(mFeedId, mChanId, mMsgId);
+ }
+}
+
+/*********** SPECIFIC FUNCTIONS ***********************/
+
+void GxsChannelPostItem::readAndClearItem()
+{
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::readAndClearItem()";
+ std::cerr << std::endl;
+#endif
+
+ readToggled(false);
+ removeItem();
+}
+
+void GxsChannelPostItem::unsubscribeChannel()
+{
+#ifdef DEBUG_ITEM
+ std::cerr << "GxsChannelPostItem::unsubscribeChannel()";
+ std::cerr << std::endl;
+#endif
+
+ if (rsChannels)
+ {
+ rsChannels->channelSubscribe(mChanId, false, false);
+ }
+ updateItemStatic();
+}
+
+void GxsChannelPostItem::download()
+{
+ std::list::iterator it;
+ for(it = mFileItems.begin(); it != mFileItems.end(); it++)
+ {
+ (*it)->download();
+ }
+
+ updateItem();
+}
+
+void GxsChannelPostItem::play()
+{
+ std::list::iterator it;
+ for(it = mFileItems.begin(); it != mFileItems.end(); it++)
+ {
+ bool startable;
+ if ((*it)->isPlayable(startable) && startable) {
+ (*it)->play();
+ }
+ }
+}
+
+void GxsChannelPostItem::readToggled(bool checked)
+{
+ if (m_inUpdateItemStatic) {
+ return;
+ }
+
+ /* set always as read ... */
+ uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
+ if (checked) {
+ /* ... and as unread by user */
+ statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
+ } else {
+ /* ... and as read by user */
+ statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
+ }
+
+ if (!mIsHome) {
+ disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
+ }
+ rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
+ if (!mIsHome) {
+ connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
+ }
+}
+
+void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
+{
+ if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
+ if (!mIsHome) {
+ if (status & CHANNEL_MSG_STATUS_READ) {
+ close();
+ return;
+ }
+ }
+ updateItemStatic();
+ }
+}
+
+void GxsChannelPostItem::copyLink()
+{
+ if (mChanId.empty() || mMsgId.empty()) {
+ return;
+ }
+
+ ChannelMsgInfo cmi;
+ if (rsChannels->getChannelMessage(mChanId, mMsgId, cmi)) {
+ RetroShareLink link;
+ if (link.createChannel(cmi.channelId, cmi.msgId)) {
+ QList urls;
+ urls.push_back(link);
+ RSLinkClipboard::copyLinks(urls);
+ }
+ }
+}
diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h
new file mode 100644
index 000000000..6ede57f06
--- /dev/null
+++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h
@@ -0,0 +1,83 @@
+/****************************************************************
+ * RetroShare is distributed under the following license:
+ *
+ * Copyright (C) 2008 Robert Fernie
+ *
+ * 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 _GXS_CHANNEL_POST_ITEM_H
+#define _GXS_CHANNEL_POST_ITEM_H
+
+#include
+#include "ui_GxsChannelPostItem.h"
+#include
+
+class FeedHolder;
+class SubFileItem;
+
+class GxsChannelPostItem : public QWidget, private Ui::GxsChannelPostItem
+{
+ Q_OBJECT
+
+public:
+ /** Default Constructor */
+ GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const std::string &chanId, const std::string &msgId, bool isHome);
+ GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome);
+ void updateItemStatic();
+ void setFileCleanUpWarning(uint32_t time_left);
+
+ const std::string &msgId() { return mMsgId; }
+
+private slots:
+ /* default stuff */
+ void removeItem();
+ void toggle();
+
+ void readAndClearItem();
+ void unsubscribeChannel();
+ void download();
+ void play();
+ void copyLink();
+ void comments();
+
+ void readToggled(bool checked);
+ void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
+
+ void updateItem();
+
+private:
+ void setup();
+ void loadPost(const RsGxsChannelPost &post);
+
+
+ FeedHolder *mParent;
+ uint32_t mFeedId;
+
+ std::string mChanId;
+ std::string mMsgId;
+
+ bool mIsHome;
+ bool m_inUpdateItemStatic;
+
+ uint32_t mMode;
+ uint32_t mSubscribeFlags;
+
+ std::list mFileItems;
+};
+
+#endif
+
diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui
new file mode 100644
index 000000000..2feb080ba
--- /dev/null
+++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui
@@ -0,0 +1,481 @@
+
+
+ GxsChannelPostItem
+
+
+
+ 0
+ 0
+ 629
+ 172
+
+
+
+
+ 6
+
+
+ 1
+
+
+ 1
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ QFrame::Box
+
+
+ QFrame::Sunken
+
+
+
-
+
+
-
+
+
+
+ 156
+ 107
+
+
+
+
+
+
+ :/images/thumb-default-video.png
+
+
+ true
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 11
+ 75
+ true
+ true
+ PreferAntialias
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:normal; color:#656565;">Channel Subject</span></p></body></html>
+
+
+ false
+
+
+ true
+
+
+
+ -
+
+
+
+ 75
+ true
+ PreferAntialias
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">DateTime</span></p></body></html>
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 60
+
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; color:#666666;">Short Description</span></p></body></html>
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+
+ PreferAntialias
+
+
+
+ fileLabel
+
+
+ Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 24
+ 16777215
+
+
+
+
+
+
+ :/images/status_unknown.png
+
+
+
+ -
+
+
+ TextLabel
+
+
+
+
+
+ -
+
+
+ 8
+
+
-
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Toggle Message Read Status
+
+
+
+ :/images/message-state-unread.png:/images/message-state-unread.png
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+
+ -
+
+
+
+ 16777215
+ 21
+
+
+
+ New
+
+
+
+ -
+
+
+
+
+
+ Qt::NoFocus
+
+
+ Download
+
+
+
+ :/images/download16.png:/images/download16.png
+
+
+
+ -
+
+
+
+
+
+ Qt::NoFocus
+
+
+ Play
+
+
+
+ :/images/player_play.png:/images/player_play.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Copy RetroShare Link
+
+
+
+ :/images/copyrslink.png:/images/copyrslink.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Unsubscribe From Channel
+
+
+
+ :/images/mail_delete.png:/images/mail_delete.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Expand
+
+
+
+ :/images/edit_add24.png:/images/edit_add24.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Set as read and remove item
+
+
+
+ :/images/cancel.png:/images/cancel.png
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Remove Item
+
+
+
+ :/images/close_normal.png:/images/close_normal.png
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+
+
-
+
+
+ QFrame::Box
+
+
+ QFrame::Sunken
+
+
+
+ 5
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ 6
+
+
+ -1
+
+
+ true
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp
new file mode 100644
index 000000000..777ba4c9d
--- /dev/null
+++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.cpp
@@ -0,0 +1,91 @@
+/*
+ * Retroshare Posted List
+ *
+ * Copyright 2012-2012 by Robert Fernie.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License Version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems to "retroshare@lunamutt.com".
+ *
+ */
+
+#include "gui/gxs/GxsCommentContainer.h"
+#include "gui/gxs/GxsCommentDialog.h"
+
+#include
+#include
+
+#include
+#include
+
+/******
+ * #define PHOTO_DEBUG 1
+ *****/
+
+
+/****************************************************************
+ * Posted Dialog
+ *
+ */
+
+GxsCommentContainer::GxsCommentContainer(QWidget *parent)
+: MainPage(parent)
+{
+ ui.setupUi(this);
+}
+
+
+void GxsCommentContainer::setup()
+{
+ mServiceDialog = createServiceDialog();
+ QString name = getServiceName();
+
+ QString list(name);
+ QWidget *widget = dynamic_cast(mServiceDialog);
+ ui.tabWidget->addTab(widget, name);
+}
+
+
+void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
+{
+ QString comments(tr("Comments"));
+ GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService());
+
+ GxsCommentHeader *commentHeader = createHeaderWidget();
+ commentDialog->setCommentHeader(commentHeader);
+
+ commentDialog->commentLoad(grpId, msgId);
+ //commentHeader->commentLoad(grpId, msgId);
+
+ ui.tabWidget->addTab(commentDialog, comments);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/retroshare-gui/src/gui/gxs/GxsCommentContainer.h b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h
new file mode 100644
index 000000000..56af66e47
--- /dev/null
+++ b/retroshare-gui/src/gui/gxs/GxsCommentContainer.h
@@ -0,0 +1,97 @@
+/*
+ * Retroshare Comment Container Dialog
+ *
+ * Copyright 2012-2012 by Robert Fernie.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License Version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems to "retroshare@lunamutt.com".
+ *
+ */
+
+#ifndef MRK_COMMENT_CONTAINER_DIALOG_H
+#define MRK_COMMENT_CONTAINER_DIALOG_H
+
+#include "retroshare-gui/mainpage.h"
+#include "ui_GxsCommentContainer.h"
+
+#include
+#include
+
+#include