mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
added code to change posts read status
This commit is contained in:
parent
010fc1dc44
commit
5dfa481f2f
@ -176,7 +176,9 @@ public:
|
||||
|
||||
virtual bool voteForPost(bool up,const RsGxsGroupId& postGrpId,const RsGxsMessageId& postMsgId,const RsGxsId& voterId) =0;
|
||||
|
||||
enum RS_DEPRECATED RankType {TopRankType, HotRankType, NewRankType };
|
||||
virtual bool setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
|
||||
enum RS_DEPRECATED RankType {TopRankType, HotRankType, NewRankType };
|
||||
|
||||
RS_DEPRECATED_FOR(getBoardsInfo)
|
||||
virtual bool getGroupData( const uint32_t& token,
|
||||
@ -205,8 +207,9 @@ public:
|
||||
//virtual bool createNewComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
//virtual bool createNewVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
RS_DEPRECATED_FOR(setPostReadStatus)
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;
|
||||
|
||||
virtual bool createGroup(uint32_t &token, RsPostedGroup &group) = 0;
|
||||
virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0;
|
||||
|
@ -480,6 +480,19 @@ bool p3Posted::voteForPost(bool up,const RsGxsGroupId& postGrpId,const RsGxsMess
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read)
|
||||
{
|
||||
uint32_t token;
|
||||
|
||||
setMessageReadStatus(token,msgId,read);
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! GXS operation failed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool p3Posted::editBoard(RsPostedGroup& board)
|
||||
{
|
||||
uint32_t token;
|
||||
|
@ -86,6 +86,8 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
|
||||
|
||||
bool voteForPost(bool up,const RsGxsGroupId& postGrpId,const RsGxsMessageId& postMsgId,const RsGxsId& voterId) override;
|
||||
|
||||
bool setPostReadStatus(const RsGxsGrpMsgIdPair& msgId, bool read) override;
|
||||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) override;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts, std::vector<RsGxsVote> &vots) override;
|
||||
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts) override;
|
||||
|
@ -458,6 +458,10 @@ void BoardPostDisplayWidget::loadComments(bool e)
|
||||
emit commentsRequested(mPost.mMeta.mMsgId,e);
|
||||
}
|
||||
|
||||
void BoardPostDisplayWidget::readToggled(bool s)
|
||||
{
|
||||
emit changeReadStatusRequested(mPost.mMeta.mMsgId,s);
|
||||
}
|
||||
void BoardPostDisplayWidget::showAuthorInPeople()
|
||||
{
|
||||
if(mPost.mMeta.mAuthorId.isNull())
|
||||
|
@ -72,9 +72,11 @@ protected slots:
|
||||
void makeDownVote() ;
|
||||
void toggleNotes() ;
|
||||
void showAuthorInPeople();
|
||||
void readToggled(bool);
|
||||
|
||||
signals:
|
||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up_or_down);
|
||||
void changeReadStatusRequested(const RsGxsMessageId&,bool);
|
||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up_or_down);
|
||||
void expand(RsGxsMessageId,bool);
|
||||
void commentsRequested(const RsGxsMessageId&,bool);
|
||||
|
||||
|
@ -181,6 +181,7 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie
|
||||
QObject::connect(w,SIGNAL(vote(RsGxsGrpMsgIdPair,bool)),mPostListWidget,SLOT(voteMsg(RsGxsGrpMsgIdPair,bool)));
|
||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(expandItem(RsGxsMessageId,bool)));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(openComments(const RsGxsMessageId&)));
|
||||
QObject::connect(w,SIGNAL(changeReadStatusRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(changeReadStatus(const RsGxsMessageId&,bool)));
|
||||
|
||||
w->setFixedSize(option.rect.size());
|
||||
w->adjustSize();
|
||||
@ -666,6 +667,11 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId)
|
||||
ui->tabWidget->addTab(commentDialog,title);
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::changeReadStatus(const RsGxsMessageId& msgId,bool b)
|
||||
{
|
||||
QModelIndex index=mPostedPostsModel->getIndexOfMessage(msgId);
|
||||
mPostedPostsModel->setMsgReadStatus(index, b);
|
||||
}
|
||||
void PostedListWidgetWithModel::tabCloseRequested(int index)
|
||||
{
|
||||
std::cerr << "GxsCommentContainer::tabCloseRequested(" << index << ")";
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
#endif
|
||||
public slots:
|
||||
virtual void openComments(const RsGxsMessageId &msgId);
|
||||
virtual void changeReadStatus(const RsGxsMessageId& msgId,bool b);
|
||||
|
||||
protected:
|
||||
/* GxsMessageFramePostWidget */
|
||||
|
@ -715,7 +715,7 @@ void RsPostedPostsModel::createPostsArray(std::vector<RsPostedPost>& posts)
|
||||
}
|
||||
}
|
||||
|
||||
void RsPostedPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status,bool with_children)
|
||||
void RsPostedPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
|
||||
{
|
||||
if(!i.isValid())
|
||||
return ;
|
||||
@ -728,10 +728,16 @@ void RsPostedPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status,
|
||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mFilteredPosts.size())
|
||||
return ;
|
||||
|
||||
#warning TODO
|
||||
// bool has_unread_below, has_read_below;
|
||||
// recursSetMsgReadStatus(entry,read_status,with_children) ;
|
||||
// recursUpdateReadStatusAndTimes(0,has_unread_below,has_read_below);
|
||||
RsGxsGroupId grpId = mPosts[entry].mMeta.mGroupId;
|
||||
RsGxsMessageId msgId = mPosts[entry].mMeta.mMsgId;
|
||||
|
||||
RsThread::async([msgId,grpId,read_status]()
|
||||
{
|
||||
// Call blocking API
|
||||
|
||||
rsPosted->setPostReadStatus(RsGxsGrpMsgIdPair(grpId,msgId),read_status);
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
QModelIndex RsPostedPostsModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
void setTextColorMissing (QColor color) { mTextColorMissing = color;}
|
||||
#endif
|
||||
|
||||
void setMsgReadStatus(const QModelIndex &i, bool read_status, bool with_children);
|
||||
void setMsgReadStatus(const QModelIndex &i, bool read_status);
|
||||
void setFilter(const QStringList &strings, uint32_t &count) ;
|
||||
void setSortingStrategy(SortingStrategy s);
|
||||
void setPostsInterval(int start,int nb_posts);
|
||||
|
Loading…
Reference in New Issue
Block a user