mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
make interactions on BoardPostWidget to mark the post as read
This commit is contained in:
parent
4fd7f455a1
commit
c30c7a4dfe
@ -191,18 +191,14 @@ void BoardPostDisplayWidgetBase::setup()
|
|||||||
|
|
||||||
readButton()->setChecked(false);
|
readButton()->setChecked(false);
|
||||||
|
|
||||||
// voteUpButton()->setIconSize(QSize(S*1.5,S*1.5));
|
|
||||||
// voteDownButton()->setIconSize(QSize(S*1.5,S*1.5));
|
|
||||||
// commentButton()->setIconSize(QSize(S*1.5,S*1.5));
|
|
||||||
// readButton()->setIconSize(QSize(S*1.5,S*1.5));
|
|
||||||
// shareButton()->setIconSize(QSize(S*1.5,S*1.5));
|
|
||||||
|
|
||||||
QMenu *menu = new QMenu();
|
QMenu *menu = new QMenu();
|
||||||
menu->addAction(CopyLinkAction);
|
menu->addAction(CopyLinkAction);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
menu->addAction(showInPeopleAct);
|
menu->addAction(showInPeopleAct);
|
||||||
shareButton()->setMenu(menu);
|
shareButton()->setMenu(menu);
|
||||||
|
|
||||||
|
connect(shareButton(),SIGNAL(pressed()),this,SLOT(handleShareButtonClicked()));
|
||||||
|
|
||||||
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
RsReputationLevel overall_reputation = rsReputations->overallReputationLevel(mPost.mMeta.mAuthorId);
|
||||||
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
bool redacted = (overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
||||||
|
|
||||||
@ -307,6 +303,10 @@ void BoardPostDisplayWidgetBase::setup()
|
|||||||
emit sizeChanged(this);
|
emit sizeChanged(this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
void BoardPostDisplayWidgetBase::handleShareButtonClicked()
|
||||||
|
{
|
||||||
|
emit shareButtonClicked();
|
||||||
|
}
|
||||||
//===================================================================================================================================
|
//===================================================================================================================================
|
||||||
//== class BoardPostDisplayWidget ==
|
//== class BoardPostDisplayWidget ==
|
||||||
//===================================================================================================================================
|
//===================================================================================================================================
|
||||||
@ -423,7 +423,7 @@ void BoardPostDisplayWidget_compact::viewPicture()
|
|||||||
|
|
||||||
PView->show();
|
PView->show();
|
||||||
|
|
||||||
/* window will destroy itself! */
|
emit thumbnailOpenned();
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton *BoardPostDisplayWidget_compact::voteUpButton() { return ui->voteUpButton; }
|
QToolButton *BoardPostDisplayWidget_compact::voteUpButton() { return ui->voteUpButton; }
|
||||||
|
@ -87,12 +87,15 @@ protected slots:
|
|||||||
void makeUpVote() ;
|
void makeUpVote() ;
|
||||||
void makeDownVote() ;
|
void makeDownVote() ;
|
||||||
void setCommentsSize(int comNb) ;
|
void setCommentsSize(int comNb) ;
|
||||||
|
void handleShareButtonClicked() ;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changeReadStatusRequested(const RsGxsMessageId&,bool);
|
void changeReadStatusRequested(const RsGxsMessageId&,bool);
|
||||||
void vote(const RsGxsGrpMsgIdPair& msgId, bool up_or_down);
|
void vote(const RsGxsGrpMsgIdPair& msgId, bool up_or_down);
|
||||||
void expand(RsGxsMessageId,bool);
|
void expand(RsGxsMessageId,bool);
|
||||||
void commentsRequested(const RsGxsMessageId&,bool);
|
void commentsRequested(const RsGxsMessageId&,bool);
|
||||||
|
void thumbnailOpenned();
|
||||||
|
void shareButtonClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RsPostedPost mPost;
|
RsPostedPost mPost;
|
||||||
|
@ -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(commentsRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(openComments(const RsGxsMessageId&)));
|
||||||
QObject::connect(w,SIGNAL(changeReadStatusRequested(const RsGxsMessageId&,bool)),mPostListWidget,SLOT(changeReadStatus(const RsGxsMessageId&,bool)));
|
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->setFixedSize(option.rect.size());
|
||||||
w->adjustSize();
|
w->adjustSize();
|
||||||
w->updateGeometry();
|
w->updateGeometry();
|
||||||
@ -692,6 +699,16 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId)
|
|||||||
ui->tabWidget->addTab(commentDialog,title);
|
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)
|
void PostedListWidgetWithModel::changeReadStatus(const RsGxsMessageId& msgId,bool b)
|
||||||
{
|
{
|
||||||
QModelIndex index=mPostedPostsModel->getIndexOfMessage(msgId);
|
QModelIndex index=mPostedPostsModel->getIndexOfMessage(msgId);
|
||||||
|
@ -149,6 +149,7 @@ private slots:
|
|||||||
public slots:
|
public slots:
|
||||||
void handlePostsTreeSizeChange(QSize size);
|
void handlePostsTreeSizeChange(QSize size);
|
||||||
void voteMsg(RsGxsGrpMsgIdPair msg,bool up_or_down);
|
void voteMsg(RsGxsGrpMsgIdPair msg,bool up_or_down);
|
||||||
|
void markCurrentPostAsRead();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
@ -748,13 +748,15 @@ void RsPostedPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
|
|||||||
RsGxsGroupId grpId = mPosts[entry].mMeta.mGroupId;
|
RsGxsGroupId grpId = mPosts[entry].mMeta.mGroupId;
|
||||||
RsGxsMessageId msgId = mPosts[entry].mMeta.mMsgId;
|
RsGxsMessageId msgId = mPosts[entry].mMeta.mMsgId;
|
||||||
|
|
||||||
RsThread::async([msgId,grpId,read_status]()
|
bool current_read_status = !(IS_MSG_UNREAD(mPosts[entry].mMeta.mMsgStatus) || IS_MSG_NEW(mPosts[entry].mMeta.mMsgStatus));
|
||||||
{
|
|
||||||
// Call blocking API
|
|
||||||
|
|
||||||
rsPosted->setPostReadStatus(RsGxsGrpMsgIdPair(grpId,msgId),read_status);
|
if(current_read_status != read_status)
|
||||||
} );
|
RsThread::async([msgId,grpId,read_status]()
|
||||||
|
{
|
||||||
|
// Call blocking API
|
||||||
|
|
||||||
|
rsPosted->setPostReadStatus(RsGxsGrpMsgIdPair(grpId,msgId),read_status);
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex RsPostedPostsModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
QModelIndex RsPostedPostsModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
||||||
|
Loading…
Reference in New Issue
Block a user