Added "Mark all as read/unread" to channels.

Updated open points for forums and channels.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7440 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-07-06 19:25:51 +00:00
parent 199c38b2b8
commit 6c3b6c6880
4 changed files with 19 additions and 44 deletions

View File

@ -28,10 +28,6 @@
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
/****
* #define DEBUG_CHANNEL
***/
/** Constructor */ /** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent) GxsChannelDialog::GxsChannelDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsChannels, parent) : GxsGroupFrameDialog(rsGxsChannels, parent)
@ -62,10 +58,8 @@ QString GxsChannelDialog::text(TextType type)
"<li>Threaded load of messages" "<li>Threaded load of messages"
"<li>Share key" "<li>Share key"
"<li>Restore channel keys" "<li>Restore channel keys"
"<li>Copy/navigate channel link" "<li>Navigate channel link"
"<li>Display count of unread messages" "<li>Don't show own posts as unread"
"<li>Set all as read"
"<li>Set read/unread status"
"</ul>"; "</ul>";
case TEXT_YOUR_GROUP: case TEXT_YOUR_GROUP:

View File

@ -92,6 +92,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid
ui->nameLabel->setMinimumWidth(20); ui->nameLabel->setMinimumWidth(20);
mSubscribeFlags = 0;
mInProcessSettings = false; mInProcessSettings = false;
/* load settings */ /* load settings */
@ -162,11 +163,6 @@ void GxsChannelPostsWidget::updateDisplay(bool complete)
} }
} }
//UserNotify *GxsChannelPostsWidget::getUserNotify(QObject *parent)
//{
// return new ChannelUserNotify(parent);
//}
void GxsChannelPostsWidget::processSettings(bool load) void GxsChannelPostsWidget::processSettings(bool load)
{ {
mInProcessSettings = true; mInProcessSettings = true;
@ -266,6 +262,8 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
{ {
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, true); mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, true);
mSubscribeFlags = group.mMeta.mSubscribeFlags;
/* IMAGE */ /* IMAGE */
QPixmap chanImage; QPixmap chanImage;
if (group.mImage.mData != NULL) { if (group.mImage.mData != NULL) {
@ -278,7 +276,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
/* set Channel name */ /* set Channel name */
ui->nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str())); ui->nameLabel->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
if (group.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) if (mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH)
{ {
mStateHelper->setWidgetEnabled(ui->postButton, true); mStateHelper->setWidgetEnabled(ui->postButton, true);
} }
@ -287,7 +285,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
mStateHelper->setWidgetEnabled(ui->postButton, false); mStateHelper->setWidgetEnabled(ui->postButton, false);
} }
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags)); ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
bool autoDownload = rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId); bool autoDownload = rsGxsChannels->getChannelAutoDownload(group.mMeta.mGroupId);
setAutoDownload(autoDownload); setAutoDownload(autoDownload);
@ -557,31 +555,18 @@ void GxsChannelPostsWidget::fillThreadAddMsg(const QString &channelId, const QSt
void GxsChannelPostsWidget::setAllMessagesRead(bool read) void GxsChannelPostsWidget::setAllMessagesRead(bool read)
{ {
#if 0 if (mChannelId.isNull() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
if (mChannelId.isNull()) {
return; return;
} }
if (!rsChannels) { QList<GxsChannelPostItem *>::iterator mit;
return; for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); ++mit) {
} GxsChannelPostItem *item = *mit;
RsGxsGrpMsgIdPair msgPair = std::make_pair(item->groupId(), item->messageId());
ChannelInfo ci; uint32_t token;
if (rsChannels->getChannelInfo(mChannelId, ci) == false) { rsGxsChannels->setMessageReadStatus(token, msgPair, read);
return;
} }
if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) {
std::list<ChannelMsgSummary> msgs;
std::list<ChannelMsgSummary>::iterator it;
rsChannels->getChannelMsgList(mChannelId, msgs);
for(it = msgs.begin(); it != msgs.end(); it++) {
rsChannels->setMessageStatus(mChannelId, it->msgId, CHANNEL_MSG_STATUS_READ, CHANNEL_MSG_STATUS_READ | CHANNEL_MSG_STATUS_UNREAD_BY_USER);
}
}
#endif
} }
void GxsChannelPostsWidget::subscribeGroup(bool subscribe) void GxsChannelPostsWidget::subscribeGroup(bool subscribe)
@ -641,6 +626,8 @@ void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId)
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
mSubscribeFlags = 0;
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA); mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
if (grpId.isNull()) { if (grpId.isNull()) {

View File

@ -103,6 +103,7 @@ private:
bool filterItem(GxsChannelPostItem *pItem, const QString &text, const int filter); bool filterItem(GxsChannelPostItem *pItem, const QString &text, const int filter);
RsGxsGroupId mChannelId; /* current Channel */ RsGxsGroupId mChannelId; /* current Channel */
int mSubscribeFlags;
TokenQueue *mChannelQueue; TokenQueue *mChannelQueue;
/* Layout Pointers */ /* Layout Pointers */

View File

@ -27,11 +27,6 @@
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/channels/ShareKey.h" #include "gui/channels/ShareKey.h"
// These should be in retroshare/ folder.
//#include "retroshare/rsgxsflags.h"
//#define DEBUG_FORUMS
/** Constructor */ /** Constructor */
GxsForumsDialog::GxsForumsDialog(QWidget *parent) GxsForumsDialog::GxsForumsDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsForums, parent) : GxsGroupFrameDialog(rsGxsForums, parent)
@ -61,9 +56,7 @@ QString GxsForumsDialog::text(TextType type)
return "<b>Open points:</b><ul>" return "<b>Open points:</b><ul>"
"<li>Restore forum keys" "<li>Restore forum keys"
"<li>Display AUTHD" "<li>Display AUTHD"
"<li>Copy/navigate forum link" "<li>Navigate forum link"
"<li>Display author of post"
"<li>Display count of unread messages"
"<li>Don't show own posts as unread" "<li>Don't show own posts as unread"
"<li>Remove messages" "<li>Remove messages"
"</ul>"; "</ul>";