mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
d828d23ca7
commit
07ea6829b6
@ -198,6 +198,7 @@ class NotifyBase
|
|||||||
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
|
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
|
||||||
/* one or more peers has changed the states */
|
/* one or more peers has changed the states */
|
||||||
virtual void notifyPeerStatusChangedSummary() {}
|
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 notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||||
virtual void notifyDiscInfoChanged() {}
|
virtual void notifyDiscInfoChanged() {}
|
||||||
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
||||||
|
@ -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 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 *****/
|
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())
|
if (mit != mReadStatus.end())
|
||||||
{
|
{
|
||||||
RsForumReadStatus* rsi = mit->second;
|
RsForumReadStatus* rsi = mit->second;
|
||||||
|
uint32_t oldStatus = rsi->msgReadStatus[mId];
|
||||||
rsi->msgReadStatus[mId] &= ~statusMask;
|
rsi->msgReadStatus[mId] &= ~statusMask;
|
||||||
rsi->msgReadStatus[mId] |= (status & statusMask);
|
rsi->msgReadStatus[mId] |= (status & statusMask);
|
||||||
|
|
||||||
|
newStatus = rsi->msgReadStatus[mId];
|
||||||
|
if (oldStatus != newStatus) {
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// if forum id does not exist create one
|
// if forum id does not exist create one
|
||||||
RsForumReadStatus* rsi = new RsForumReadStatus();
|
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;
|
rsi->msgReadStatus[mId] = status & statusMask;
|
||||||
mReadStatus[fId] = rsi;
|
mReadStatus[fId] = rsi;
|
||||||
mSaveList.push_back(rsi);
|
mSaveList.push_back(rsi);
|
||||||
|
|
||||||
|
newStatus = rsi->msgReadStatus[mId];
|
||||||
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
} /******* UNLOCKED ********/
|
} /******* UNLOCKED ********/
|
||||||
|
|
||||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
if (changed) {
|
||||||
|
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||||
|
rsicontrol->getNotify().notifyForumMsgReadSatusChanged(fId, mId, newStatus);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -313,9 +313,7 @@ void ChanMsgItem::toggle()
|
|||||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||||
expandButton->setToolTip(tr("Hide"));
|
expandButton->setToolTip(tr("Hide"));
|
||||||
|
|
||||||
if (!mIsHome) {
|
readToggled(false);
|
||||||
readToggled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -392,12 +390,25 @@ void ChanMsgItem::readToggled(bool checked)
|
|||||||
/* ... and as read by user */
|
/* ... and as read by user */
|
||||||
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_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);
|
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 (channelId.toStdString() == mChanId && msgId.toStdString() == mMsgId) {
|
||||||
|
if (!mIsHome) {
|
||||||
|
if (status & CHANNEL_MSG_STATUS_READ) {
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
updateItemStatic();
|
updateItemStatic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "gui/forums/CreateForumMsg.h"
|
#include "gui/forums/CreateForumMsg.h"
|
||||||
#include "gui/chat/HandleRichText.h"
|
#include "gui/chat/HandleRichText.h"
|
||||||
#include "gui/common/AvatarDefs.h"
|
#include "gui/common/AvatarDefs.h"
|
||||||
|
#include "gui/notifyqt.h"
|
||||||
//#include "gui/settings/rsharesettings.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( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
||||||
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
|
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);
|
subjectLabel->setMinimumWidth(20);
|
||||||
|
|
||||||
small();
|
small();
|
||||||
@ -277,7 +280,9 @@ void ForumMsgItem::toggle()
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
if (status != statusNew) {
|
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);
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,6 +48,8 @@ private slots:
|
|||||||
void replyToPost();
|
void replyToPost();
|
||||||
void sendMsg();
|
void sendMsg();
|
||||||
|
|
||||||
|
void forumMsgReadSatusChanged(const QString &forumId, const QString &msgId, int status);
|
||||||
|
|
||||||
void updateItem();
|
void updateItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -200,9 +200,14 @@ void NotifyQt::notifyPeerStatusChangedSummary()
|
|||||||
emit peerStatusChangedSummary();
|
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)
|
void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status)
|
||||||
{
|
{
|
||||||
emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status);
|
emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotifyQt::notifyOwnStatusMessageChanged()
|
void NotifyQt::notifyOwnStatusMessageChanged()
|
||||||
|
@ -48,6 +48,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
virtual void notifyPeerStatusChanged(const std::string& peer_id, uint32_t state);
|
||||||
/* one or more peers has changed the states */
|
/* one or more peers has changed the states */
|
||||||
virtual void notifyPeerStatusChangedSummary();
|
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 notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status);
|
||||||
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
virtual void notifyHistoryChanged(uint32_t msgId, int type);
|
||||||
|
|
||||||
@ -93,6 +94,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
void discInfoChanged() const ;
|
void discInfoChanged() const ;
|
||||||
void downloadComplete(const QString& /* fileHash */);
|
void downloadComplete(const QString& /* fileHash */);
|
||||||
void downloadCompleteCountChanged(int /* count */);
|
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 channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||||
void historyChanged(uint msgId, int type);
|
void historyChanged(uint msgId, int type);
|
||||||
void chatLobbyInviteReceived() ;
|
void chatLobbyInviteReceived() ;
|
||||||
@ -101,8 +103,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||||||
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void UpdateGUI(); /* called by timer */
|
||||||
void UpdateGUI(); /* called by timer */
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void runningTick();
|
void runningTick();
|
||||||
|
Loading…
Reference in New Issue
Block a user