mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 08:54:13 -04:00
Add Comment Number On Button.
This commit is contained in:
parent
dea776a61a
commit
ea6bbac732
7 changed files with 97 additions and 4 deletions
|
@ -44,6 +44,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroup
|
|||
|
||||
requestGroup();
|
||||
requestMessage();
|
||||
requestComment();
|
||||
}
|
||||
|
||||
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGroup &group, const RsPostedPost &post, bool isHome, bool autoUpdate) :
|
||||
|
@ -53,6 +54,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedGr
|
|||
|
||||
setGroup(group, false);
|
||||
setPost(post);
|
||||
requestComment();
|
||||
}
|
||||
|
||||
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedPost &post, bool isHome, bool autoUpdate) :
|
||||
|
@ -62,6 +64,7 @@ PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsPostedPo
|
|||
|
||||
requestGroup();
|
||||
setPost(post);
|
||||
requestComment();
|
||||
}
|
||||
|
||||
PostedItem::~PostedItem()
|
||||
|
@ -195,6 +198,26 @@ void PostedItem::loadMessage(const uint32_t &token)
|
|||
}
|
||||
}
|
||||
|
||||
void PostedItem::loadComment(const uint32_t &token)
|
||||
{
|
||||
std::vector<RsGxsComment> cmts;
|
||||
if (!rsPosted->getRelatedComments(token, cmts))
|
||||
{
|
||||
std::cerr << "GxsChannelPostItem::loadComment() ERROR getting data";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t comNb = cmts.size();
|
||||
QString sComButText = tr("Comment");
|
||||
if (comNb == 1) {
|
||||
sComButText = sComButText.append("(1)");
|
||||
} else if (comNb > 1) {
|
||||
sComButText = tr("Comments").append("(%1)").arg(comNb);
|
||||
}
|
||||
ui->commentButton->setText(sComButText);
|
||||
}
|
||||
|
||||
void PostedItem::fill()
|
||||
{
|
||||
if (isLoading()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue