mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-29 08:43:29 -05:00
Added set read status to channel post
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7343 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
0abc2342fe
commit
4c66f82da8
@ -796,7 +796,8 @@ void p3GxsChannels::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPai
|
|||||||
std::cerr << "p3GxsChannels::setMessageReadStatus()";
|
std::cerr << "p3GxsChannels::setMessageReadStatus()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_UNREAD;
|
/* Always remove status unprocessed */
|
||||||
|
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_UNREAD | GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
|
||||||
uint32_t status = GXS_SERV::GXS_MSG_STATUS_UNREAD;
|
uint32_t status = GXS_SERV::GXS_MSG_STATUS_UNREAD;
|
||||||
if (read)
|
if (read)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
|||||||
ui->unsubscribeButton->setEnabled(false);
|
ui->unsubscribeButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
ui->readButton->hide();
|
ui->readButton->hide();
|
||||||
//newLabel->hide();
|
ui->newLabel->hide();
|
||||||
ui->copyLinkButton->hide();
|
ui->copyLinkButton->hide();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -228,51 +228,13 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
|||||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||||
{
|
{
|
||||||
ui->readButton->setVisible(true);
|
ui->readButton->setVisible(true);
|
||||||
#if 0
|
|
||||||
uint32_t status = 0;
|
|
||||||
rsChannels->getMessageStatus(mChanId, mMsgId, status);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
|
setReadStatus(IS_MSG_NEW(post.mMeta.mMsgStatus), IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus));
|
||||||
{
|
|
||||||
ui->readButton->setChecked(true);
|
|
||||||
ui->readButton->setIcon(QIcon(":/images/message-state-unread.png"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->readButton->setChecked(false);
|
|
||||||
ui->readButton->setIcon(QIcon(":/images/message-state-read.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool newState;
|
|
||||||
QColor color;
|
|
||||||
if (!IS_MSG_UNREAD(post.mMeta.mMsgStatus))
|
|
||||||
{
|
|
||||||
//newLabel->setVisible(false);
|
|
||||||
newState = false;
|
|
||||||
color = COLOR_NORMAL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//newLabel->setVisible(true);
|
|
||||||
newState = true;
|
|
||||||
color = COLOR_NEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* unpolish widget to clear the stylesheet's palette cache */
|
|
||||||
ui->frame->style()->unpolish(ui->frame);
|
|
||||||
|
|
||||||
QPalette palette = ui->frame->palette();
|
|
||||||
palette.setColor(ui->frame->backgroundRole(), color);
|
|
||||||
ui->frame->setPalette(palette);
|
|
||||||
|
|
||||||
ui->frame->setProperty("new", newState);
|
|
||||||
Rshare::refreshStyleSheet(ui->frame, false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->readButton->setVisible(false);
|
ui->readButton->setVisible(false);
|
||||||
//ui->newLabel->setVisible(false);
|
ui->newLabel->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,6 +314,32 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
|
|||||||
mInUpdateItemStatic = false;
|
mInUpdateItemStatic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsChannelPostItem::setReadStatus(bool isNew, bool isUnread)
|
||||||
|
{
|
||||||
|
if (isUnread)
|
||||||
|
{
|
||||||
|
ui->readButton->setChecked(true);
|
||||||
|
ui->readButton->setIcon(QIcon(":/images/message-state-unread.png"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->readButton->setChecked(false);
|
||||||
|
ui->readButton->setIcon(QIcon(":/images/message-state-read.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->newLabel->setVisible(isNew);
|
||||||
|
|
||||||
|
/* unpolish widget to clear the stylesheet's palette cache */
|
||||||
|
ui->frame->style()->unpolish(ui->frame);
|
||||||
|
|
||||||
|
QPalette palette = ui->frame->palette();
|
||||||
|
palette.setColor(ui->frame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL);
|
||||||
|
ui->frame->setPalette(palette);
|
||||||
|
|
||||||
|
ui->frame->setProperty("new", isNew);
|
||||||
|
Rshare::refreshStyleSheet(ui->frame, false);
|
||||||
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
void GxsChannelPostItem::setFileCleanUpWarning(uint32_t time_left)
|
||||||
{
|
{
|
||||||
int hours = (int)time_left/3600;
|
int hours = (int)time_left/3600;
|
||||||
@ -521,29 +509,16 @@ void GxsChannelPostItem::play()
|
|||||||
|
|
||||||
void GxsChannelPostItem::readToggled(bool checked)
|
void GxsChannelPostItem::readToggled(bool checked)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
if (mInUpdateItemStatic) {
|
if (mInUpdateItemStatic) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set always as read ... */
|
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
|
||||||
uint32_t statusNew = CHANNEL_MSG_STATUS_READ;
|
|
||||||
if (checked) {
|
|
||||||
/* ... and as unread by user */
|
|
||||||
statusNew |= CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
|
||||||
} else {
|
|
||||||
/* ... and as read by user */
|
|
||||||
statusNew &= ~CHANNEL_MSG_STATUS_UNREAD_BY_USER;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mIsHome) {
|
uint32_t token;
|
||||||
disconnect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
rsGxsChannels->setMessageReadStatus(token, msgPair, !checked);
|
||||||
}
|
|
||||||
rsChannels->setMessageStatus(mChanId, mMsgId, statusNew, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
|
setReadStatus(false, checked);
|
||||||
if (!mIsHome) {
|
|
||||||
connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
void GxsChannelPostItem::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||||
|
@ -76,6 +76,8 @@ private:
|
|||||||
void setup();
|
void setup();
|
||||||
void loadPost(const RsGxsChannelPost &post);
|
void loadPost(const RsGxsChannelPost &post);
|
||||||
|
|
||||||
|
void setReadStatus(bool isNew, bool isUnread);
|
||||||
|
|
||||||
bool mInUpdateItemStatic;
|
bool mInUpdateItemStatic;
|
||||||
|
|
||||||
uint32_t mMode;
|
uint32_t mMode;
|
||||||
|
@ -221,6 +221,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="newLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="scoreLabel">
|
<widget class="QLabel" name="scoreLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -54,8 +54,9 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
|
|||||||
mStateHelper = new UIStateHelper(this);
|
mStateHelper = new UIStateHelper(this);
|
||||||
|
|
||||||
// No progress yet
|
// No progress yet
|
||||||
|
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->loadingLabel, UISTATE_LOADING_VISIBLE);
|
||||||
// mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
// mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressBar, UISTATE_LOADING_VISIBLE);
|
||||||
mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressLabel, UISTATE_LOADING_VISIBLE);
|
// mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui->progressLabel, UISTATE_LOADING_VISIBLE);
|
||||||
|
|
||||||
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui->nameLabel);
|
mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui->nameLabel);
|
||||||
|
|
||||||
@ -69,6 +70,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
|
|||||||
|
|
||||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||||
|
|
||||||
|
ui->loadingLabel->hide();
|
||||||
ui->progressLabel->hide();
|
ui->progressLabel->hide();
|
||||||
ui->progressBar->hide();
|
ui->progressBar->hide();
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>2</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
@ -151,6 +151,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="loadingLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Loading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -236,10 +243,6 @@
|
|||||||
<zorder>scrollArea</zorder>
|
<zorder>scrollArea</zorder>
|
||||||
<zorder></zorder>
|
<zorder></zorder>
|
||||||
<zorder>headFrame</zorder>
|
<zorder>headFrame</zorder>
|
||||||
<zorder>toolBarFrame</zorder>
|
|
||||||
<zorder>scrollArea</zorder>
|
|
||||||
<zorder></zorder>
|
|
||||||
<zorder>headFrame</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user