mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-02 10:35:15 -05:00
Merge pull request #1966 from PhenomRetroShare/Fix_ChannelMarkAllRead
Fix Channels Mark All as Un/Read.
This commit is contained in:
commit
f422c7249a
@ -427,7 +427,7 @@ void GxsChannelPostItem::fill()
|
|||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
|
|
||||||
float f = QFontMetricsF(font()).height()/14.0 ;
|
//float f = QFontMetricsF(font()).height()/14.0 ;
|
||||||
|
|
||||||
if(mPost.mThumbnail.mData != NULL)
|
if(mPost.mThumbnail.mData != NULL)
|
||||||
{
|
{
|
||||||
@ -629,14 +629,21 @@ QString GxsChannelPostItem::messageName()
|
|||||||
|
|
||||||
void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
|
void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
|
||||||
{
|
{
|
||||||
|
if (isNew)
|
||||||
|
mPost.mMeta.mMsgStatus |= GXS_SERV::GXS_MSG_STATUS_GUI_NEW;
|
||||||
|
else
|
||||||
|
mPost.mMeta.mMsgStatus &= ~GXS_SERV::GXS_MSG_STATUS_GUI_NEW;
|
||||||
|
|
||||||
if (isUnread)
|
if (isUnread)
|
||||||
{
|
{
|
||||||
ui->readButton->setChecked(true);
|
mPost.mMeta.mMsgStatus |= GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
|
whileBlocking(ui->readButton)->setChecked(true);
|
||||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-unread.png"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->readButton->setChecked(false);
|
mPost.mMeta.mMsgStatus &= ~GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
|
whileBlocking(ui->readButton)->setChecked(false);
|
||||||
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png"));
|
ui->readButton->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/message-state-read.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,7 +842,7 @@ void GxsChannelPostItem::play()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::readToggled(bool checked)
|
void GxsChannelPostItem::readToggled(bool /*checked*/)
|
||||||
{
|
{
|
||||||
if (mInFill) {
|
if (mInFill) {
|
||||||
return;
|
return;
|
||||||
@ -845,10 +852,9 @@ void GxsChannelPostItem::readToggled(bool checked)
|
|||||||
|
|
||||||
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
|
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
|
||||||
|
|
||||||
uint32_t token;
|
rsGxsChannels->markRead(msgPair, isUnread());
|
||||||
rsGxsChannels->setMessageReadStatus(token, msgPair, !checked);
|
|
||||||
|
|
||||||
setReadStatus(false, checked);
|
//setReadStatus(false, checked); // Updated by events
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::makeDownVote()
|
void GxsChannelPostItem::makeDownVote()
|
||||||
|
@ -62,7 +62,10 @@ public:
|
|||||||
QString getMsgLabel();
|
QString getMsgLabel();
|
||||||
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
||||||
|
|
||||||
|
bool isLoaded() const {return mLoaded;};
|
||||||
bool isUnread() const ;
|
bool isUnread() const ;
|
||||||
|
void setReadStatus(bool isNew, bool isUnread);
|
||||||
|
|
||||||
const std::set<RsGxsMessageId>& olderVersions() const { return mPost.mOlderVersions; }
|
const std::set<RsGxsMessageId>& olderVersions() const { return mPost.mOlderVersions; }
|
||||||
|
|
||||||
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
|
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
|
||||||
@ -112,7 +115,6 @@ private:
|
|||||||
void setup();
|
void setup();
|
||||||
void fill();
|
void fill();
|
||||||
void fillExpandFrame();
|
void fillExpandFrame();
|
||||||
void setReadStatus(bool isNew, bool isUnread);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mInFill;
|
bool mInFill;
|
||||||
|
@ -146,13 +146,19 @@ void GxsChannelPostsWidget::handleEvent_main_thread(std::shared_ptr<const RsEven
|
|||||||
|
|
||||||
switch(e->mChannelEventCode)
|
switch(e->mChannelEventCode)
|
||||||
{
|
{
|
||||||
case RsChannelEventCode::UPDATED_CHANNEL:
|
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||||
case RsChannelEventCode::NEW_CHANNEL:
|
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
|
||||||
|
case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]];
|
||||||
case RsChannelEventCode::UPDATED_MESSAGE:
|
case RsChannelEventCode::UPDATED_MESSAGE:
|
||||||
case RsChannelEventCode::NEW_MESSAGE:
|
|
||||||
if(e->mChannelGroupId == groupId())
|
if(e->mChannelGroupId == groupId())
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
break;
|
break;
|
||||||
|
case RsChannelEventCode::READ_STATUS_CHANGED:
|
||||||
|
if (FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(e->mChannelMsgId)))
|
||||||
|
if (GxsChannelPostItem *channelPostItem = dynamic_cast<GxsChannelPostItem*>(feedItem))
|
||||||
|
channelPostItem->setReadStatus(false,!channelPostItem->isUnread());
|
||||||
|
//channelPostItem->setReadStatus(false,e->Don't get read status. Will be more easier and accurate);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -909,9 +915,9 @@ static void setAllMessagesReadCallback(FeedItem *feedItem, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GxsChannelPostsReadData *readData = (GxsChannelPostsReadData*) data;
|
GxsChannelPostsReadData *readData = (GxsChannelPostsReadData*) data;
|
||||||
bool is_not_new = !channelPostItem->isUnread() ;
|
bool isRead = !channelPostItem->isUnread() ;
|
||||||
|
|
||||||
if(is_not_new == readData->mRead)
|
if(channelPostItem->isLoaded() && (isRead == readData->mRead))
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
RsGxsGrpMsgIdPair msgPair = std::make_pair(channelPostItem->groupId(), channelPostItem->messageId());
|
RsGxsGrpMsgIdPair msgPair = std::make_pair(channelPostItem->groupId(), channelPostItem->messageId());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user