fixed bugs in setting read status

This commit is contained in:
csoler 2020-09-26 14:41:20 +02:00
parent 2561b9bc7e
commit 2a51da2291
4 changed files with 9 additions and 11 deletions

View File

@ -94,15 +94,9 @@ void BoardPostDisplayWidgetBase::makeUpVote()
void BoardPostDisplayWidgetBase::setReadStatus(bool isNew, bool isUnread)
{
if (isUnread)
{
readButton()->setChecked(true);
readButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
}
else
{
readButton()->setChecked(false);
readButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png"));
}
newLabel()->setVisible(isNew);
}
@ -123,8 +117,10 @@ void BoardPostDisplayWidgetBase::loadComments(bool e)
emit commentsRequested(mPost.mMeta.mMsgId,e);
}
void BoardPostDisplayWidgetBase::readToggled(bool s)
void BoardPostDisplayWidgetBase::readToggled()
{
bool s = IS_MSG_UNREAD(mPost.mMeta.mMsgStatus);
emit changeReadStatusRequested(mPost.mMeta.mMsgId,s);
}
void BoardPostDisplayWidgetBase::showAuthorInPeople()
@ -163,7 +159,7 @@ void BoardPostDisplayWidgetBase::setup()
QObject::connect(commentButton(), SIGNAL(toggled(bool)), this, SLOT(loadComments(bool)));
QObject::connect(voteUpButton(), SIGNAL(clicked()), this, SLOT(makeUpVote()));
QObject::connect(voteDownButton(), SIGNAL(clicked()), this, SLOT(makeDownVote()));
QObject::connect(readButton(), SIGNAL(toggled(bool)), this, SLOT(readToggled(bool)));
QObject::connect(readButton(), SIGNAL(clicked()), this, SLOT(readToggled()));
QAction *CopyLinkAction = new QAction(QIcon(""),tr("Copy RetroShare Link"), this);
connect(CopyLinkAction, SIGNAL(triggered()), this, SLOT(copyMessageLink()));
@ -173,6 +169,8 @@ void BoardPostDisplayWidgetBase::setup()
int S = QFontMetricsF(font()).height() ;
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));

View File

@ -82,7 +82,7 @@ protected slots:
void loadComments(bool e);
void showAuthorInPeople();
void readToggled(bool);
void readToggled();
void setReadStatus(bool isNew, bool isUnread) ;
void makeUpVote() ;
void makeDownVote() ;

View File

@ -298,7 +298,7 @@
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>

View File

@ -330,7 +330,7 @@
<normaloff>:/images/message-state-unread.png</normaloff>:/images/message-state-unread.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>