Set the status of the message to read when the user read it in the news feed.

Remove the message news feed when the user reads the message in the message list.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8405 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-09 22:57:01 +00:00
parent ceb2825f83
commit d37df7b37e
4 changed files with 33 additions and 4 deletions

View file

@ -48,6 +48,8 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
/* Invoke the Qt Designer generated object setup routine */
setupUi(this);
mCloseOnRead = true;
setAttribute ( Qt::WA_DeleteOnClose, true );
/* general ones */
@ -56,6 +58,7 @@ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, const std::string &msgId,
//connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) );
/* specific ones */
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(checkMessageReadStatus()));
connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) );
connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) );
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) );
@ -215,6 +218,10 @@ void MsgItem::expand(bool open)
expandFrame->show();
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
mCloseOnRead = false;
rsMail->MessageRead(mMsgId, false);
mCloseOnRead = true;
}
else
{
@ -269,7 +276,7 @@ void MsgItem::deleteMsg()
{
rsMail->MessageDelete(mMsgId);
hide(); /* will be cleaned up next refresh */
removeItem();
}
}
@ -302,3 +309,23 @@ void MsgItem::playMedia()
std::cerr << std::endl;
#endif
}
void MsgItem::checkMessageReadStatus()
{
if (!mCloseOnRead) {
return;
}
MessageInfo msgInfo;
if (!rsMail->getMessage(mMsgId, msgInfo)) {
std::cerr << "MsgItem::checkMessageReadStatus() Couldn't find Msg" << std::endl;
return;
}
if (msgInfo.msgflags & RS_MSG_NEW) {
/* Message status is still "new" */
return;
}
removeItem();
}