mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-27 08:25:53 -04:00
added code to change posts read status
This commit is contained in:
parent
010fc1dc44
commit
5dfa481f2f
9 changed files with 46 additions and 9 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue