mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-04-26 09:59:17 -04:00
- Added update of changed posts to GxsChannelPostsWidget
- Added auto update to GxsFeedItem git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7342 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2b36cefca2
commit
0abc2342fe
@ -32,14 +32,14 @@
|
|||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
|
|
||||||
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome)
|
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) :
|
||||||
:GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsPosted, true)
|
GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsPosted, true, false)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome)
|
PostedItem::PostedItem(FeedHolder *parent, uint32_t feedId, const RsPostedPost &post, bool isHome) :
|
||||||
:GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, false),
|
GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsPosted, false, false),
|
||||||
mPost(post)
|
mPost(post)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
@ -319,13 +319,13 @@ void PostedListDialog::updateDisplay(bool /*complete*/)
|
|||||||
/* update List */
|
/* update List */
|
||||||
insertGroups();
|
insertGroups();
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
|
||||||
if(!msgs.empty())
|
if(!msgs.empty())
|
||||||
{
|
{
|
||||||
std::cerr << "rsPosted->msgsChanged():";
|
std::cerr << "rsPosted->msgsChanged():";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit;
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit;
|
||||||
mit = msgs.find(mCurrTopicId);
|
mit = msgs.find(mCurrTopicId);
|
||||||
if(mit != msgs.end())
|
if(mit != msgs.end())
|
||||||
{
|
{
|
||||||
|
@ -42,16 +42,14 @@
|
|||||||
* #define DEBUG_ITEM 1
|
* #define DEBUG_ITEM 1
|
||||||
****/
|
****/
|
||||||
|
|
||||||
#define DEBUG_ITEM 1
|
|
||||||
|
|
||||||
#define COLOR_NORMAL QColor(248, 248, 248)
|
#define COLOR_NORMAL QColor(248, 248, 248)
|
||||||
#define COLOR_NEW QColor(220, 236, 253)
|
#define COLOR_NEW QColor(220, 236, 253)
|
||||||
|
|
||||||
#define SELF_LOAD 1
|
#define SELF_LOAD 1
|
||||||
#define DATA_PROVIDED 2
|
#define DATA_PROVIDED 2
|
||||||
|
|
||||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome) :
|
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) :
|
||||||
GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsGxsChannels, true)
|
GxsFeedItem(parent, feedId, groupId, messageId, isHome, rsGxsChannels, true, autoUpdate)
|
||||||
{
|
{
|
||||||
mMode = SELF_LOAD;
|
mMode = SELF_LOAD;
|
||||||
|
|
||||||
@ -59,8 +57,8 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome) :
|
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subFlags, bool isHome, bool autoUpdate) :
|
||||||
GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, false)
|
GxsFeedItem(parent, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, false, autoUpdate)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load";
|
std::cerr << "GxsChannelPostItem::GxsChannelPostItem() Direct Load";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
@ -75,6 +73,19 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, cons
|
|||||||
loadPost(post);
|
loadPost(post);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GxsChannelPostItem::setPost(const RsGxsChannelPost &post)
|
||||||
|
{
|
||||||
|
if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) {
|
||||||
|
std::cerr << "GxsChannelPostItem::setPost() - Wrong id, cannot set post";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadPost(post);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
GxsChannelPostItem::~GxsChannelPostItem()
|
GxsChannelPostItem::~GxsChannelPostItem()
|
||||||
{
|
{
|
||||||
delete(ui);
|
delete(ui);
|
||||||
@ -162,6 +173,7 @@ void GxsChannelPostItem::loadMessage(const uint32_t &token)
|
|||||||
void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
||||||
{
|
{
|
||||||
/* fill in */
|
/* fill in */
|
||||||
|
|
||||||
#ifdef DEBUG_ITEM
|
#ifdef DEBUG_ITEM
|
||||||
std::cerr << "GxsChannelPostItem::loadPost()";
|
std::cerr << "GxsChannelPostItem::loadPost()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
@ -41,11 +41,12 @@ class GxsChannelPostItem : public GxsFeedItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome);
|
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
||||||
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome);
|
GxsChannelPostItem(FeedHolder *parent, uint32_t feedId, const RsGxsChannelPost &post, uint32_t subscribeFlags, bool isHome, bool autoUpdate);
|
||||||
virtual ~GxsChannelPostItem();
|
virtual ~GxsChannelPostItem();
|
||||||
|
|
||||||
void setFileCleanUpWarning(uint32_t time_left);
|
void setFileCleanUpWarning(uint32_t time_left);
|
||||||
|
bool setPost(const RsGxsChannelPost &post);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void loadMessage(const uint32_t &token);
|
virtual void loadMessage(const uint32_t &token);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "gui/gxs/GxsFeedItem.h"
|
#include "gui/gxs/GxsFeedItem.h"
|
||||||
#include "gui/feeds/FeedHolder.h"
|
#include "gui/feeds/FeedHolder.h"
|
||||||
|
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ void GxsFeedItem::updateItem()
|
|||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData) :
|
GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool loadData, bool autoUpdate) :
|
||||||
QWidget(NULL)
|
QWidget(NULL)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsFeedItem::GxsFeedItem()";
|
std::cerr << "GxsFeedItem::GxsFeedItem()";
|
||||||
@ -136,6 +137,14 @@ GxsFeedItem::GxsFeedItem(FeedHolder *parent, uint32_t feedId, const RsGxsGroupId
|
|||||||
{
|
{
|
||||||
mLoadQueue = NULL;
|
mLoadQueue = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mGxsIface && autoUpdate) {
|
||||||
|
/* Connect to update broadcast */
|
||||||
|
mUpdateBroadcastBase = new RsGxsUpdateBroadcastBase(mGxsIface);
|
||||||
|
connect(mUpdateBroadcastBase, SIGNAL(fillDisplay(bool)), this, SLOT(fillDisplay(bool)));
|
||||||
|
} else {
|
||||||
|
mUpdateBroadcastBase = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsFeedItem::~GxsFeedItem()
|
GxsFeedItem::~GxsFeedItem()
|
||||||
@ -143,12 +152,33 @@ GxsFeedItem::~GxsFeedItem()
|
|||||||
std::cerr << "GxsFeedItem::~GxsFeedItem()";
|
std::cerr << "GxsFeedItem::~GxsFeedItem()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
if (mUpdateBroadcastBase)
|
||||||
|
{
|
||||||
|
delete(mUpdateBroadcastBase);
|
||||||
|
}
|
||||||
|
|
||||||
if (mLoadQueue)
|
if (mLoadQueue)
|
||||||
{
|
{
|
||||||
delete mLoadQueue;
|
delete mLoadQueue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsFeedItem::fillDisplay(bool /*complete*/)
|
||||||
|
{
|
||||||
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = mUpdateBroadcastBase->getMsgIds();
|
||||||
|
if (!msgs.empty())
|
||||||
|
{
|
||||||
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
||||||
|
if (mit != msgs.end())
|
||||||
|
{
|
||||||
|
const std::vector<RsGxsMessageId> &msgIds = mit->second;
|
||||||
|
if (std::find(msgIds.begin(), msgIds.end(), messageId()) != msgIds.end()) {
|
||||||
|
requestMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GxsFeedItem::requestGroupMeta()
|
void GxsFeedItem::requestGroupMeta()
|
||||||
{
|
{
|
||||||
std::cerr << "GxsFeedItem::requestGroup()";
|
std::cerr << "GxsFeedItem::requestGroup()";
|
||||||
@ -177,8 +207,13 @@ void GxsFeedItem::requestMessage()
|
|||||||
|
|
||||||
if (!mLoadQueue)
|
if (!mLoadQueue)
|
||||||
{
|
{
|
||||||
|
if (mGxsIface)
|
||||||
|
{
|
||||||
|
mLoadQueue = new TokenQueue(mGxsIface->getTokenService(), this);
|
||||||
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
class FeedHolder;
|
class FeedHolder;
|
||||||
|
class RsGxsUpdateBroadcastBase;
|
||||||
|
|
||||||
class GxsFeedItem : public QWidget, public TokenResponse
|
class GxsFeedItem : public QWidget, public TokenResponse
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ class GxsFeedItem : public QWidget, public TokenResponse
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/** Note parent can = NULL */
|
/** Note parent can = NULL */
|
||||||
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, bool autoUpdate);
|
||||||
virtual ~GxsFeedItem();
|
virtual ~GxsFeedItem();
|
||||||
|
|
||||||
RsGxsGroupId groupId() { return mGroupId; }
|
RsGxsGroupId groupId() { return mGroupId; }
|
||||||
@ -61,6 +62,10 @@ protected slots:
|
|||||||
void unsubscribe();
|
void unsubscribe();
|
||||||
void removeItem();
|
void removeItem();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
/* RsGxsUpdateBroadcastBase */
|
||||||
|
void fillDisplay(bool complete);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FeedHolder *mParent;
|
FeedHolder *mParent;
|
||||||
uint32_t mFeedId;
|
uint32_t mFeedId;
|
||||||
@ -76,6 +81,7 @@ private:
|
|||||||
|
|
||||||
RsGxsIfaceHelper *mGxsIface;
|
RsGxsIfaceHelper *mGxsIface;
|
||||||
TokenQueue *mLoadQueue;
|
TokenQueue *mLoadQueue;
|
||||||
|
RsGxsUpdateBroadcastBase *mUpdateBroadcastBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,16 +14,17 @@ class RsGxsUpdateBroadcastBase : public QObject
|
|||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
protected:
|
public:
|
||||||
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
||||||
virtual ~RsGxsUpdateBroadcastBase();
|
virtual ~RsGxsUpdateBroadcastBase();
|
||||||
|
|
||||||
|
const std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
||||||
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||||
|
|
||||||
|
protected:
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
void setUpdateWhenInvisible(bool update) { mUpdateWhenInvisible = update; }
|
void setUpdateWhenInvisible(bool update) { mUpdateWhenInvisible = update; }
|
||||||
|
|
||||||
std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
|
||||||
|
|
||||||
void showEvent(QShowEvent *e);
|
void showEvent(QShowEvent *e);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -22,12 +22,12 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIds();
|
return mBase->getGrpIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIds();
|
return mBase->getMsgIds();
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ public:
|
|||||||
|
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
void setUpdateWhenInvisible(bool update);
|
void setUpdateWhenInvisible(bool update);
|
||||||
std::list<RsGxsGroupId> &getGrpIds();
|
const std::list<RsGxsGroupId> &getGrpIds();
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
@ -22,12 +22,12 @@ void RsGxsUpdateBroadcastWidget::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIds();
|
return mBase->getGrpIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
||||||
{
|
{
|
||||||
return mBase->getMsgIds();
|
return mBase->getMsgIds();
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ public:
|
|||||||
|
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
void setUpdateWhenInvisible(bool update);
|
void setUpdateWhenInvisible(bool update);
|
||||||
std::list<RsGxsGroupId> &getGrpIds();
|
const std::list<RsGxsGroupId> &getGrpIds();
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
virtual QWidget *createHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId)
|
||||||
{
|
{
|
||||||
return new GxsChannelPostItem(NULL, 0, grpId, msgId, true);
|
return new GxsChannelPostItem(NULL, 0, grpId, msgId, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QPixmap getServicePixmap()
|
virtual QPixmap getServicePixmap()
|
||||||
|
@ -43,8 +43,8 @@
|
|||||||
#define TOKEN_TYPE_RELATEDPOSTS 8
|
#define TOKEN_TYPE_RELATEDPOSTS 8
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent)
|
GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWidget *parent) :
|
||||||
: GxsMessageFrameWidget(rsGxsChannels, parent),
|
GxsMessageFrameWidget(rsGxsChannels, parent),
|
||||||
ui(new Ui::GxsChannelPostsWidget)
|
ui(new Ui::GxsChannelPostsWidget)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
@ -96,16 +96,16 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
const 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? */
|
/* Do we need to fill all posts? */
|
||||||
requestPosts(mChannelId);
|
requestPosts(mChannelId);
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs = getMsgIds();
|
||||||
if (!msgs.empty())
|
if (!msgs.empty())
|
||||||
{
|
{
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mChannelId);
|
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(mChannelId);
|
||||||
if(mit != msgs.end())
|
if(mit != msgs.end())
|
||||||
{
|
{
|
||||||
requestRelatedPosts(mChannelId, mit->second);
|
requestRelatedPosts(mChannelId, mit->second);
|
||||||
@ -279,9 +279,10 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost> &po
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
//TODO: Update item
|
item->setPost(*it);
|
||||||
|
//TODO: Sort timestamp
|
||||||
} else {
|
} else {
|
||||||
item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true);
|
item = new GxsChannelPostItem(this, 0, *it, subscribeFlags, true, false);
|
||||||
mChannelPostItems.push_back(item);
|
mChannelPostItems.push_back(item);
|
||||||
if (related) {
|
if (related) {
|
||||||
ui->verticalLayout->insertWidget(0, item);
|
ui->verticalLayout->insertWidget(0, item);
|
||||||
@ -626,10 +627,11 @@ void GxsChannelPostsWidget::requestRelatedPosts(const RsGxsGroupId &grpId, const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
|
if (msgIds.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<RsGxsGroupId> groupIds;
|
mStateHelper->setLoading(TOKEN_TYPE_POSTS, true);
|
||||||
groupIds.push_back(grpId);
|
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
|
||||||
|
@ -318,12 +318,12 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||||
if (std::find(grpIds.begin(), grpIds.end(), mForumId) != grpIds.end()) {
|
if (std::find(grpIds.begin(), grpIds.end(), mForumId) != grpIds.end()) {
|
||||||
/* Update threads */
|
/* Update threads */
|
||||||
insertThreads();
|
insertThreads();
|
||||||
} else {
|
} else {
|
||||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds = getMsgIds();
|
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds = getMsgIds();
|
||||||
if (msgIds.find(mForumId) != msgIds.end()) {
|
if (msgIds.find(mForumId) != msgIds.end()) {
|
||||||
/* Update threads */
|
/* Update threads */
|
||||||
insertThreads();
|
insertThreads();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user