diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 53fc4830f..93107d649 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -46,9 +46,20 @@ #define COLOR_NORMAL QColor(248, 248, 248) #define COLOR_NEW QColor(220, 236, 253) -GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) : +GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set& older_versions) : GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) { + QVector v; + bool self = false; + + for(std::set::const_iterator it(older_versions.begin());it!=older_versions.end();++it) + v.push_back(*it) ; + + if(older_versions.find(messageId) == older_versions.end()) + v.push_back(messageId); + + setMessageVersions(v) ; + setup(); mLoaded = false ; diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 32f8b0b06..96d2f499e 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -42,7 +42,10 @@ class GxsChannelPostItem : public GxsFeedItem 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); + // It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of + // previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed. + + GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set& older_versions = std::set()); //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); @@ -64,6 +67,9 @@ protected: virtual void doExpand(bool open); virtual void expandFill(bool first); + // This does nothing except triggering the loading of the post data and comments. This function is mainly used to detect + // when the post is actually made visible. + virtual void paintEvent(QPaintEvent *); /* GxsGroupFeedItem */ diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index f78bc339a..12f5b5e85 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -412,7 +412,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re //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); + GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); return ; @@ -435,7 +435,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re //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); + GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, false,post.mOlderVersions); ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs)); }