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

@ -40,6 +40,7 @@
#include "util/DateTime.h"
#include "util/RsProtectedTimer.h"
#include "util/QtVersion.h"
#include "notifyqt.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsmsgs.h>
@ -127,6 +128,8 @@ MessagesDialog::MessagesDialog(QWidget *parent)
inChange = false;
lockUpdate = 0;
connect(NotifyQt::getInstance(), SIGNAL(messagesChanged()), this, SLOT(insertMessages()));
connect(NotifyQt::getInstance(), SIGNAL(messagesTagsChanged()), this, SLOT(messagesTagsChanged()));
connect(ui.messageTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(messageTreeWidgetCustomPopupMenu(QPoint)));
connect(ui.listWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(folderlistWidgetCustomPopupMenu(QPoint)));
connect(ui.messageTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)) , this, SLOT(clicked(QTreeWidgetItem*,int)));

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();
}

View File

@ -51,6 +51,7 @@ private slots:
void playMedia();
void deleteMsg();
void replyMsg();
void checkMessageReadStatus();
void updateItem();
@ -62,6 +63,7 @@ private:
std::string mMsgId;
bool mIsHome;
bool mCloseOnRead;
std::list<SubFileItem *> mFileItems;
};

View File

@ -27,7 +27,6 @@
#include "gui/FriendsDialog.h"
#include "gui/SearchDialog.h"
#include "gui/FileTransfer/TransfersDialog.h"
#include "gui/MessagesDialog.h"
#include "gui/SharedFilesDialog.h"
#include "gui/NetworkDialog.h"
#include "gui/chat/ChatDialog.h"
@ -391,8 +390,6 @@ int main(int argc, char *argv[])
QObject::connect(notify,SIGNAL(transfersChanged()) ,w->transfersDialog ,SLOT(insertTransfers() )) ;
QObject::connect(notify,SIGNAL(publicChatChanged(int)) ,w->friendsDialog ,SLOT(publicChatChanged(int) ));
QObject::connect(notify,SIGNAL(neighboursChanged()) ,w->friendsDialog->networkDialog ,SLOT(securedUpdateDisplay())) ;
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
QObject::connect(notify,SIGNAL(messagesTagsChanged()) ,w->messagesDialog ,SLOT(messagesTagsChanged() )) ;
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus()));