The channel message (in channels) is set to read when the user clicks on the show more button.

The forum/channel news feed is removed when the user reads the message in forums/channels.
Recompile needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4927 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-02-12 00:58:47 +00:00
parent d828d23ca7
commit 07ea6829b6
7 changed files with 57 additions and 8 deletions

View File

@ -198,6 +198,7 @@ class NotifyBase
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary() {}
virtual void notifyForumMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
virtual void notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
virtual void notifyDiscInfoChanged() {}
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};

View File

@ -367,6 +367,9 @@ bool p3Forums::ForumMessageSend(ForumMsgInfo &info)
bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,const uint32_t status, const uint32_t statusMask)
{
bool changed = false;
uint32_t newStatus = 0;
{
RsStackMutex stack(distribMtx); /***** STACK LOCKED MUTEX *****/
@ -374,8 +377,14 @@ bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,co
if (mit != mReadStatus.end())
{
RsForumReadStatus* rsi = mit->second;
uint32_t oldStatus = rsi->msgReadStatus[mId];
rsi->msgReadStatus[mId] &= ~statusMask;
rsi->msgReadStatus[mId] |= (status & statusMask);
newStatus = rsi->msgReadStatus[mId];
if (oldStatus != newStatus) {
changed = true;
}
} else {
// if forum id does not exist create one
RsForumReadStatus* rsi = new RsForumReadStatus();
@ -383,12 +392,18 @@ bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,co
rsi->msgReadStatus[mId] = status & statusMask;
mReadStatus[fId] = rsi;
mSaveList.push_back(rsi);
newStatus = rsi->msgReadStatus[mId];
changed = true;
}
IndicateConfigChanged();
} /******* UNLOCKED ********/
if (changed) {
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
rsicontrol->getNotify().notifyForumMsgReadSatusChanged(fId, mId, newStatus);
}
return true;
}

View File

@ -313,10 +313,8 @@ void ChanMsgItem::toggle()
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
expandButton->setToolTip(tr("Hide"));
if (!mIsHome) {
readToggled(false);
}
}
else
{
expandFrame->hide();
@ -392,12 +390,25 @@ void ChanMsgItem::readToggled(bool checked)
/* ... and as read by user */
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
}
if (!mIsHome) {
disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
}
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
if (!mIsHome) {
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
}
}
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int /*status*/)
void ChanMsgItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
{
if (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
if (!mIsHome) {
if (status & CHANNEL_MSG_STATUS_READ) {
close();
return;
}
}
updateItemStatic();
}
}

View File

@ -33,6 +33,7 @@
#include "gui/forums/CreateForumMsg.h"
#include "gui/chat/HandleRichText.h"
#include "gui/common/AvatarDefs.h"
#include "gui/notifyqt.h"
//#include "gui/settings/rsharesettings.h"
/****
@ -57,6 +58,8 @@ ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::strin
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
subjectLabel->setMinimumWidth(20);
small();
@ -277,7 +280,9 @@ void ForumMsgItem::toggle()
// }
if (status != statusNew) {
disconnect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)));
rsForums->setMessageStatus(mForumId, mPostId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER);
connect(NotifyQt::getInstance(), SIGNAL(forumMsgReadSatusChanged(QString,QString,int)), this, SLOT(forumMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
}
}
}
@ -402,3 +407,12 @@ void ForumMsgItem::sendMsg()
}
}
}
void ForumMsgItem::forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status)
{
if (mForumId == forumId.toStdString() && mPostId == msgId.toStdString()) {
if (status & FORUM_MSG_STATUS_READ) {
close();
}
}
}

View File

@ -48,6 +48,8 @@ private slots:
void replyToPost();
void sendMsg();
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
void updateItem();
private:

View File

@ -200,6 +200,11 @@ void NotifyQt::notifyPeerStatusChangedSummary()
emit peerStatusChangedSummary();
}
void NotifyQt::notifyForumMsgReadSatusChanged(const std::string& forumId, const std::string& msgId, uint32_t status)
{
emit forumMsgReadSatusChanged(QString::fromStdString(forumId), QString::fromStdString(msgId), status);
}
void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status)
{
emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status);

View File

@ -48,6 +48,7 @@ class NotifyQt: public QObject, public NotifyBase
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary();
virtual void notifyForumMsgReadSatusChanged(const std::string& forumId, const std::string& msgId, uint32_t status);
virtual void notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status);
virtual void notifyHistoryChanged(uint32_t msgId, int type);
@ -93,6 +94,7 @@ class NotifyQt: public QObject, public NotifyBase
void discInfoChanged() const ;
void downloadComplete(const QString& /* fileHash */);
void downloadCompleteCountChanged(int /* count */);
void forumMsgReadSatusChanged(const QString& forumId, const QString& msgId, int status);
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
void historyChanged(uint msgId, int type);
void chatLobbyInviteReceived() ;
@ -101,7 +103,6 @@ class NotifyQt: public QObject, public NotifyBase
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
public slots:
void UpdateGUI(); /* called by timer */
private slots: