mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 15:15:15 -04:00
make interactions on BoardPostWidget to mark the post as read
This commit is contained in:
parent
4fd7f455a1
commit
c30c7a4dfe
5 changed files with 35 additions and 12 deletions
|
@ -199,6 +199,13 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie
|
|||
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)));
|
||||
|
||||
// All other interactions with the widget should cause the msg to be set as read.
|
||||
QObject::connect(w,SIGNAL(thumbnailOpenned()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(vote(RsGxsGrpMsgIdPair,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(expand(RsGxsMessageId,bool)),this,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(commentsRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
QObject::connect(w,SIGNAL(shareButtonClicked()),mPostListWidget,SLOT(markCurrentPostAsRead()));
|
||||
|
||||
w->setFixedSize(option.rect.size());
|
||||
w->adjustSize();
|
||||
w->updateGeometry();
|
||||
|
@ -692,6 +699,16 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId)
|
|||
ui->tabWidget->addTab(commentDialog,title);
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::markCurrentPostAsRead()
|
||||
{
|
||||
QModelIndex index = ui->postsTree->selectionModel()->currentIndex();
|
||||
|
||||
if(!index.isValid())
|
||||
throw std::runtime_error("No post under mouse!");
|
||||
|
||||
mPostedPostsModel->setMsgReadStatus(index,true);
|
||||
}
|
||||
|
||||
void PostedListWidgetWithModel::changeReadStatus(const RsGxsMessageId& msgId,bool b)
|
||||
{
|
||||
QModelIndex index=mPostedPostsModel->getIndexOfMessage(msgId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue