From 2a51da229100753d74c5a4d194d621c3d0cffb0b Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 26 Sep 2020 14:41:20 +0200 Subject: [PATCH] fixed bugs in setting read status --- .../src/gui/Posted/BoardPostDisplayWidget.cpp | 14 ++++++-------- .../src/gui/Posted/BoardPostDisplayWidget.h | 2 +- .../src/gui/Posted/BoardPostDisplayWidget_card.ui | 2 +- .../gui/Posted/BoardPostDisplayWidget_compact.ui | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp index b441f91e3..3ccf899d5 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp @@ -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)); diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h index 45e24a005..2ef9233b5 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.h @@ -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() ; diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui index 241924862..d784b6721 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_card.ui @@ -298,7 +298,7 @@ :/images/message-state-unread.png:/images/message-state-unread.png - true + false false diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui index cbc65bf2d..47a4a3890 100644 --- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui +++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget_compact.ui @@ -330,7 +330,7 @@ :/images/message-state-unread.png:/images/message-state-unread.png - true + false false