diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 53fc4830f..b36159df1 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -51,13 +51,11 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, { setup(); - mLoaded = false ; + requestGroup(); + requestMessage(); + requestComment(); } -// This code has been suspended because it adds more complexity than usefulness. -// It was used to load a channel post where the post item is already known. - -#ifdef SUSPENDED GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) : GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate) { @@ -84,9 +82,9 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, setup(); setGroup(group, false); - - setPost(post,false); - mLoaded = false ; + //requestGroup(); //Already have RsGxsChannelGroup + setPost(post); + requestComment(); } GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) : @@ -99,30 +97,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, setup(); - mLoaded = true ; requestGroup(); setPost(post); requestComment(); } -#endif - - -void GxsChannelPostItem::paintEvent(QPaintEvent *e) -{ - /* This method employs a trick to trigger a deferred loading. The post and group is requested only - * when actually displayed on the screen. */ - - if(!mLoaded) - { - mLoaded = true ; - - requestGroup(); - requestMessage(); - requestComment(); - } - - GxsFeedItem::paintEvent(e) ; -} GxsChannelPostItem::~GxsChannelPostItem() { diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 32f8b0b06..a591e5e22 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -41,11 +41,9 @@ class GxsChannelPostItem : public GxsFeedItem Q_OBJECT public: - // This one is used in NewFeed for incoming channel posts. Only the group and msg ids are known at this point. GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate); - - //GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); - //GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); + GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); + GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate); virtual ~GxsChannelPostItem(); bool setGroup(const RsGxsChannelGroup &group, bool doFill = true); @@ -64,8 +62,6 @@ protected: virtual void doExpand(bool open); virtual void expandFill(bool first); - virtual void paintEvent(QPaintEvent *); - /* GxsGroupFeedItem */ virtual QString groupName(); virtual void loadGroup(const uint32_t &token); @@ -105,7 +101,6 @@ private: private: bool mInFill; bool mCloseOnRead; - bool mLoaded; RsGxsChannelGroup mGroup; RsGxsChannelPost mPost; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index f78bc339a..58c4fef88 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -407,12 +407,10 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re if(item) { ui->feedWidget->removeFeedItem(item) ; - //RsGxsChannelGroup dummyGroup; - //dummyGroup.mMeta.mGroupId = groupId(); - //dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; - //GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); - - GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, true); + RsGxsChannelGroup dummyGroup; + dummyGroup.mMeta.mGroupId = groupId(); + dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; + GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); return ; @@ -429,13 +427,10 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); } else { /* Group is not always available because of the TokenQueue */ - - //RsGxsChannelGroup dummyGroup; - //dummyGroup.mMeta.mGroupId = groupId(); - //dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; - //GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); - - GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, true); + RsGxsChannelGroup dummyGroup; + dummyGroup.mMeta.mGroupId = groupId(); + dummyGroup.mMeta.mSubscribeFlags = 0xffffffff; + GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); }