- Added request of complete fill to update broadcast

- Added fill of new messages to GxsChannelPostsWidget instead of a complete refill
- Removed static html text from GxsCannelPostItem.ui

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7334 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-05-05 21:53:47 +00:00
parent 7634afe733
commit 306c8fe431
11 changed files with 185 additions and 53 deletions

View file

@ -11,15 +11,24 @@
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4">
<property name="leftMargin">
<number>1</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>1</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>6</number> <number>6</number>
</property> </property>
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>1</number> <number>1</number>
</property> </property>
<property name="margin">
<number>1</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="sizePolicy"> <property name="sizePolicy">
@ -81,11 +90,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">Channel Subject</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:11pt; font-weight:600; font-style:italic;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:normal; color:#656565;&quot;&gt;Channel Subject&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>false</bool> <bool>false</bool>
@ -105,11 +110,7 @@ p, li { white-space: pre-wrap; }
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">DateTime</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:600; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;DateTime&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -132,11 +133,7 @@ p, li { white-space: pre-wrap; }
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string notr="true">Short Description</string>
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt; color:#666666;&quot;&gt;Short Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>
@ -457,7 +454,16 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QFrame" name="expandFrame"> <widget class="QFrame" name="expandFrame">
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<property name="margin"> <property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
@ -469,7 +475,16 @@ p, li { white-space: pre-wrap; }
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number> <number>5</number>
</property> </property>
<item> <item>
@ -510,9 +525,6 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -39,6 +39,9 @@ public:
GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData); GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData);
virtual ~GxsFeedItem(); virtual ~GxsFeedItem();
RsGxsGroupId groupId() { return mGroupId; }
RsGxsMessageId messageId() { return mMessageId; }
protected: protected:
// generic Fns - to be overloaded. // generic Fns - to be overloaded.

View file

@ -739,7 +739,7 @@ void GxsGroupFrameDialog::acknowledgeSubscribeChange(const uint32_t &token)
RsGxsGroupId groupId; RsGxsGroupId groupId;
mInterface->acknowledgeGrp(token, groupId); mInterface->acknowledgeGrp(token, groupId);
requestGroupSummary(); fillComplete();
} }
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/

View file

@ -10,7 +10,7 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
: QObject(parent) : QObject(parent)
{ {
mUpdateWhenInvisible = false; mUpdateWhenInvisible = false;
mFirstVisible = true; mFillComplete = true;
mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl); mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl);
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged())); connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
@ -22,6 +22,13 @@ RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
{ {
} }
void RsGxsUpdateBroadcastBase::fillComplete()
{
mFillComplete = true;
updateBroadcastChanged();
}
void RsGxsUpdateBroadcastBase::securedUpdateDisplay() void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
{ {
if (RsAutoUpdatePage::eventsLocked()) { if (RsAutoUpdatePage::eventsLocked()) {
@ -30,8 +37,8 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
return; return;
} }
emit fillDisplay(mFirstVisible); emit fillDisplay(mFillComplete);
mFirstVisible = false; mFillComplete = false;
/* Clear updated ids */ /* Clear updated ids */
mGrpIds.clear(); mGrpIds.clear();
@ -40,7 +47,7 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
void RsGxsUpdateBroadcastBase::showEvent(QShowEvent */*event*/) void RsGxsUpdateBroadcastBase::showEvent(QShowEvent */*event*/)
{ {
if (mFirstVisible) { if (mFillComplete) {
/* Initial fill */ /* Initial fill */
securedUpdateDisplay(); securedUpdateDisplay();
} }

View file

@ -18,7 +18,9 @@ protected:
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL); RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
virtual ~RsGxsUpdateBroadcastBase(); virtual ~RsGxsUpdateBroadcastBase();
void fillComplete();
void setUpdateWhenInvisible(bool update) { mUpdateWhenInvisible = update; } void setUpdateWhenInvisible(bool update) { mUpdateWhenInvisible = update; }
std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; } std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; } std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
@ -35,7 +37,7 @@ private slots:
private: private:
RsGxsUpdateBroadcast *mUpdateBroadcast; RsGxsUpdateBroadcast *mUpdateBroadcast;
bool mFirstVisible; bool mFillComplete;
bool mUpdateWhenInvisible; // Update also when not visible bool mUpdateWhenInvisible; // Update also when not visible
std::list<RsGxsGroupId> mGrpIds; std::list<RsGxsGroupId> mGrpIds;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIds; std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIds;

View file

@ -12,6 +12,11 @@ RsGxsUpdateBroadcastPage::~RsGxsUpdateBroadcastPage()
{ {
} }
void RsGxsUpdateBroadcastPage::fillComplete()
{
mBase->fillComplete();
}
void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update) void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
{ {
mBase->setUpdateWhenInvisible(update); mBase->setUpdateWhenInvisible(update);

View file

@ -22,6 +22,7 @@ public:
RsGxsUpdateBroadcastPage(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL, Qt::WindowFlags flags = 0); RsGxsUpdateBroadcastPage(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL, Qt::WindowFlags flags = 0);
virtual ~RsGxsUpdateBroadcastPage(); virtual ~RsGxsUpdateBroadcastPage();
void fillComplete();
void setUpdateWhenInvisible(bool update); void setUpdateWhenInvisible(bool update);
std::list<RsGxsGroupId> &getGrpIds(); std::list<RsGxsGroupId> &getGrpIds();
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds(); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();

View file

@ -12,6 +12,11 @@ RsGxsUpdateBroadcastWidget::~RsGxsUpdateBroadcastWidget()
{ {
} }
void RsGxsUpdateBroadcastWidget::fillComplete()
{
mBase->fillComplete();
}
void RsGxsUpdateBroadcastWidget::setUpdateWhenInvisible(bool update) void RsGxsUpdateBroadcastWidget::setUpdateWhenInvisible(bool update)
{ {
mBase->setUpdateWhenInvisible(update); mBase->setUpdateWhenInvisible(update);

View file

@ -22,6 +22,7 @@ public:
RsGxsUpdateBroadcastWidget(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL, Qt::WindowFlags flags = 0); RsGxsUpdateBroadcastWidget(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL, Qt::WindowFlags flags = 0);
virtual ~RsGxsUpdateBroadcastWidget(); virtual ~RsGxsUpdateBroadcastWidget();
void fillComplete();
void setUpdateWhenInvisible(bool update); void setUpdateWhenInvisible(bool update);
std::list<RsGxsGroupId> &getGrpIds(); std::list<RsGxsGroupId> &getGrpIds();
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds(); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();

View file

@ -25,16 +25,12 @@
#include "gui/gxschannels/CreateGxsChannelMsg.h" #include "gui/gxschannels/CreateGxsChannelMsg.h"
#include "gui/common/UIStateHelper.h" #include "gui/common/UIStateHelper.h"
#include <algorithm>
#define CHAN_DEFAULT_IMAGE ":/images/channels.png" #define CHAN_DEFAULT_IMAGE ":/images/channels.png"
#define WARNING_LIMIT 3600*24*2 #define WARNING_LIMIT 3600*24*2
/* Images for TreeWidget */
#define IMAGE_CHANNELBLUE ":/images/channelsblue.png"
#define IMAGE_CHANNELGREEN ":/images/channelsgreen.png"
#define IMAGE_CHANNELRED ":/images/channelsred.png"
#define IMAGE_CHANNELYELLOW ":/images/channelsyellow.png"
/**** /****
* #define DEBUG_CHANNEL * #define DEBUG_CHANNEL
***/ ***/
@ -44,6 +40,7 @@
#define TOKEN_TYPE_MESSAGE_CHANGE 4 #define TOKEN_TYPE_MESSAGE_CHANGE 4
#define TOKEN_TYPE_GROUP_DATA 6 #define TOKEN_TYPE_GROUP_DATA 6
#define TOKEN_TYPE_POSTS 7 #define TOKEN_TYPE_POSTS 7
#define TOKEN_TYPE_RELATEDPOSTS 8
/** Constructor */ /** Constructor */
GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent) GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent)
@ -56,7 +53,8 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
/* Setup UI helper */ /* Setup UI helper */
mStateHelper = new UIStateHelper(this); mStateHelper = new UIStateHelper(this);
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressBar, UISTATE_LOADING_VISIBLE); // No progress yet
// mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressBar, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressLabel, UISTATE_LOADING_VISIBLE); mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressLabel, UISTATE_LOADING_VISIBLE);
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui->nameLabel); mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui->nameLabel);
@ -92,13 +90,17 @@ GxsChannelPostsWidget::~GxsChannelPostsWidget()
void GxsChannelPostsWidget::updateDisplay(bool complete) void GxsChannelPostsWidget::updateDisplay(bool complete)
{ {
if (complete) { if (complete) {
/* Not needed */ /* Fill complete */
requestGroupData(mChannelId);
requestPosts(mChannelId);
return; return;
} }
std::list<RsGxsGroupId> &grpIds = getGrpIds(); std::list<RsGxsGroupId> &grpIds = getGrpIds();
if (!mChannelId.isNull() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) { if (!mChannelId.isNull() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
requestGroupData(mChannelId); requestGroupData(mChannelId);
/* Do we need to fill all posts? */
requestPosts(mChannelId);
} else { } else {
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds(); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
if (!msgs.empty()) if (!msgs.empty())
@ -106,7 +108,7 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId); std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId);
if(mit != msgs.end()) if(mit != msgs.end())
{ {
requestPosts(mChannelId); requestRelatedPosts(mChannelId, mit->second);
} }
} }
} }
@ -143,7 +145,7 @@ void GxsChannelPostsWidget::setGroupId(const RsGxsGroupId &groupId)
emit groupChanged(this); emit groupChanged(this);
requestGroupData(mChannelId); fillComplete();
} }
QString GxsChannelPostsWidget::groupName(bool withUnreadCount) QString GxsChannelPostsWidget::groupName(bool withUnreadCount)
@ -238,25 +240,56 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
setAutoDownloadButton(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED); setAutoDownloadButton(group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
emit groupChanged(this); emit groupChanged(this);
requestPosts(mChannelId);
} }
void GxsChannelPostsWidget::insertChannelPosts(const std::vector<RsGxsChannelPost> &posts) static bool sortChannelMsgSummaryAsc(const RsGxsChannelPost &msg1, const RsGxsChannelPost &msg2)
{
return (msg1.mMeta.mPublishTs > msg2.mMeta.mPublishTs);
}
static bool sortChannelMsgSummaryDesc(const RsGxsChannelPost &msg1, const RsGxsChannelPost &msg2)
{
return (msg1.mMeta.mPublishTs < msg2.mMeta.mPublishTs);
}
void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost> &posts, bool related)
{ {
std::vector<RsGxsChannelPost>::const_iterator it; std::vector<RsGxsChannelPost>::const_iterator it;
// Do these need sorting? probably. // Do these need sorting? probably.
// can we add that into the request? // can we add that into the request?
//msgs.sort(sortChannelMsgSummary); if (related) {
/* Sort descending to add posts at top */
std::sort(posts.begin(), posts.end(), sortChannelMsgSummaryDesc);
} else {
std::sort(posts.begin(), posts.end(), sortChannelMsgSummaryAsc);
}
uint32_t subscribeFlags = 0xffffffff; uint32_t subscribeFlags = 0xffffffff;
for (it = posts.begin(); it != posts.end(); it++) for (it = posts.begin(); it != posts.end(); it++)
{ {
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true); GxsChannelPostItem *item = NULL;
if (related) {
foreach (GxsChannelPostItem *loopItem, mChannelPostItems) {
if (loopItem->messageId() == it->mMeta.mMsgId) {
item = loopItem;
break;
}
}
}
if (item) {
//TODO: Update item
} else {
item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
mChannelPostItems.push_back(item); mChannelPostItems.push_back(item);
if (related) {
ui->verticalLayout->insertWidget(0, item);
} else {
ui->verticalLayout->addWidget(item); ui->verticalLayout->addWidget(item);
} }
}
}
} }
#if 0 #if 0
@ -448,6 +481,16 @@ void GxsChannelPostsWidget::setAutoDownloadButton(bool autoDl)
} }
} }
void GxsChannelPostsWidget::clearPosts()
{
/* replace all the messages with new ones */
QList<GxsChannelPostItem *>::iterator mit;
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
delete (*mit);
}
mChannelPostItems.clear();
}
/********************************************************************************************** /**********************************************************************************************
* New Stuff here. * New Stuff here.
*************/ *************/
@ -526,12 +569,8 @@ void GxsChannelPostsWidget::requestPosts(const RsGxsGroupId &grpId)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
/* replace all the messages with new ones */ /* Request all posts */
QList<GxsChannelPostItem *>::iterator mit; clearPosts();
for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); mit++) {
delete (*mit);
}
mChannelPostItems.clear();
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS); mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
@ -566,7 +605,57 @@ void GxsChannelPostsWidget::loadPosts(const uint32_t &token)
mStateHelper->setActive(TOKEN_TYPE_POSTS, true); mStateHelper->setActive(TOKEN_TYPE_POSTS, true);
insertChannelPosts(posts); insertChannelPosts(posts, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
}
void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds)
{
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelPostsWidget::requestRelatedPosts()";
std::cerr << std::endl;
#endif
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_RELATEDPOSTS);
if (grpId.isNull()) {
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
mStateHelper->clear(TOKEN_TYPE_POSTS);
return;
}
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
std::list<RsGxsGroupId> groupIds;
groupIds.push_back(grpId);
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_VERSIONS;
uint32_t token;
std::vector<RsGxsGrpMsgIdPair> relatedMsgIds;
for (std::vector<RsGxsMessageId>::const_iterator msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
relatedMsgIds.push_back(RsGxsGrpMsgIdPair(grpId, *msgIt));
}
mChannelQueue->requestMsgRelatedInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, relatedMsgIds, TOKEN_TYPE_RELATEDPOSTS);
}
void GxsChannelPostsWidget::loadRelatedPosts(const uint32_t &token)
{
#ifdef DEBUG_CHANNEL
std::cerr << "GxsChannelPostsWidget::loadRelatedPosts()";
std::cerr << std::endl;
#endif
std::vector<RsGxsChannelPost> posts;
rsGxsChannels->getRelatedPosts(token, posts);
mStateHelper->setActive(TOKEN_TYPE_POSTS, true);
insertChannelPosts(posts, true);
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false); mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
} }
@ -607,6 +696,9 @@ void GxsChannelPostsWidget::loadRequest(const TokenQueue *queue, const TokenRequ
case TOKEN_TYPE_POSTS: case TOKEN_TYPE_POSTS:
loadPosts(req.mToken); loadPosts(req.mToken);
break; break;
case TOKEN_TYPE_RELATEDPOSTS:
loadRelatedPosts(req.mToken);
break;
default: default:
std::cerr << "GxsChannelPostsWidget::loadRequest() ERROR: INVALID TYPE"; std::cerr << "GxsChannelPostsWidget::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl; std::cerr << std::endl;

View file

@ -82,6 +82,7 @@ private:
void processSettings(bool load); void processSettings(bool load);
void setAutoDownloadButton(bool autoDl); void setAutoDownloadButton(bool autoDl);
void clearPosts();
/* NEW GXS FNS */ /* NEW GXS FNS */
void requestGroupData(const RsGxsGroupId &grpId); void requestGroupData(const RsGxsGroupId &grpId);
@ -90,8 +91,11 @@ private:
void requestPosts(const RsGxsGroupId &grpId); void requestPosts(const RsGxsGroupId &grpId);
void loadPosts(const uint32_t &token); void loadPosts(const uint32_t &token);
void requestRelatedPosts(const RsGxsGroupId &grpId, const std::vector<RsGxsMessageId> &msgIds);
void loadRelatedPosts(const uint32_t &token);
void insertChannelDetails(const RsGxsChannelGroup &group); void insertChannelDetails(const RsGxsChannelGroup &group);
void insertChannelPosts(const std::vector<RsGxsChannelPost> &posts); void insertChannelPosts(std::vector<RsGxsChannelPost> &posts, bool related);
void acknowledgeMessageUpdate(const uint32_t &token); void acknowledgeMessageUpdate(const uint32_t &token);