diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 856f3bcc4..57d6a9138 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -28,10 +28,6 @@ #include "gui/settings/rsharesettings.h" #include "gui/notifyqt.h" -/**** - * #define DEBUG_CHANNEL - ***/ - /** Constructor */ GxsChannelDialog::GxsChannelDialog(QWidget *parent) : GxsGroupFrameDialog(rsGxsChannels, parent) @@ -62,10 +58,8 @@ QString GxsChannelDialog::text(TextType type) "
  • Threaded load of messages" "
  • Share key" "
  • Restore channel keys" - "
  • Copy/navigate channel link" - "
  • Display count of unread messages" - "
  • Set all as read" - "
  • Set read/unread status" + "
  • Navigate channel link" + "
  • Don't show own posts as unread" ""; case TEXT_YOUR_GROUP: diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index 5f515eaa4..f1c410e2c 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -92,6 +92,7 @@ GxsChannelPostsWidget::GxsChannelPostsWidget(const RsGxsGroupId &channelId, QWid ui->nameLabel->setMinimumWidth(20); + mSubscribeFlags = 0; mInProcessSettings = false; /* 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) { mInProcessSettings = true; @@ -266,6 +262,8 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) { mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, true); + mSubscribeFlags = group.mMeta.mSubscribeFlags; + /* IMAGE */ QPixmap chanImage; if (group.mImage.mData != NULL) { @@ -278,7 +276,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) /* set Channel name */ 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); } @@ -287,7 +285,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group) 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); setAutoDownload(autoDownload); @@ -557,31 +555,18 @@ void GxsChannelPostsWidget::fillThreadAddMsg(const QString &channelId, const QSt void GxsChannelPostsWidget::setAllMessagesRead(bool read) { -#if 0 - if (mChannelId.isNull()) { + if (mChannelId.isNull() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) { return; } - if (!rsChannels) { - return; + QList::iterator mit; + for (mit = mChannelPostItems.begin(); mit != mChannelPostItems.end(); ++mit) { + GxsChannelPostItem *item = *mit; + RsGxsGrpMsgIdPair msgPair = std::make_pair(item->groupId(), item->messageId()); + + uint32_t token; + rsGxsChannels->setMessageReadStatus(token, msgPair, read); } - - ChannelInfo ci; - if (rsChannels->getChannelInfo(mChannelId, ci) == false) { - return; - } - - if (ci.channelFlags & RS_DISTRIB_SUBSCRIBED) { - std::list msgs; - std::list::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) @@ -641,6 +626,8 @@ void GxsChannelPostsWidget::requestGroupData(const RsGxsGroupId &grpId) std::cerr << std::endl; #endif + mSubscribeFlags = 0; + mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA); if (grpId.isNull()) { diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h index a72187c59..2ec800ee8 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.h @@ -103,6 +103,7 @@ private: bool filterItem(GxsChannelPostItem *pItem, const QString &text, const int filter); RsGxsGroupId mChannelId; /* current Channel */ + int mSubscribeFlags; TokenQueue *mChannelQueue; /* Layout Pointers */ diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp index aef54a930..6b09e58d0 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumsDialog.cpp @@ -27,11 +27,6 @@ #include "gui/notifyqt.h" #include "gui/channels/ShareKey.h" -// These should be in retroshare/ folder. -//#include "retroshare/rsgxsflags.h" - -//#define DEBUG_FORUMS - /** Constructor */ GxsForumsDialog::GxsForumsDialog(QWidget *parent) : GxsGroupFrameDialog(rsGxsForums, parent) @@ -61,9 +56,7 @@ QString GxsForumsDialog::text(TextType type) return "Open points:
      " "
    • Restore forum keys" "
    • Display AUTHD" - "
    • Copy/navigate forum link" - "
    • Display author of post" - "
    • Display count of unread messages" + "
    • Navigate forum link" "
    • Don't show own posts as unread" "
    • Remove messages" "
    ";