mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fixed filter of description in group tree of forums, channels and posted.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7797 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f7a08a53a1
commit
51825d851c
@ -28,9 +28,19 @@
|
|||||||
#include "PostedUserNotify.h"
|
#include "PostedUserNotify.h"
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
#include "gui/settings/rsharesettings.h"
|
#include "gui/settings/rsharesettings.h"
|
||||||
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
|
||||||
#include <retroshare/rsposted.h>
|
#include <retroshare/rsposted.h>
|
||||||
|
|
||||||
|
class PostedGroupInfoData : public RsUserdata
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PostedGroupInfoData() : RsUserdata() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
QMap<RsGxsGroupId, QString> mDescription;
|
||||||
|
};
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
PostedDialog::PostedDialog(QWidget *parent)
|
PostedDialog::PostedDialog(QWidget *parent)
|
||||||
: GxsGroupFrameDialog(rsPosted, parent)
|
: GxsGroupFrameDialog(rsPosted, parent)
|
||||||
@ -136,3 +146,40 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons
|
|||||||
{
|
{
|
||||||
return new PostedItem(NULL, 0, grpId, msgId, true, false);
|
return new PostedItem(NULL, 0, grpId, msgId, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||||
|
{
|
||||||
|
std::vector<RsPostedGroup> groups;
|
||||||
|
rsPosted->getGroupData(token, groups);
|
||||||
|
|
||||||
|
/* Save groups to fill description */
|
||||||
|
PostedGroupInfoData *postedData = new PostedGroupInfoData;
|
||||||
|
userdata = postedData;
|
||||||
|
|
||||||
|
std::vector<RsPostedGroup>::iterator groupIt;
|
||||||
|
for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) {
|
||||||
|
RsPostedGroup &group = *groupIt;
|
||||||
|
groupInfo.push_back(group.mMeta);
|
||||||
|
|
||||||
|
if (!group.mDescription.empty()) {
|
||||||
|
postedData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PostedDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||||
|
{
|
||||||
|
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||||
|
|
||||||
|
const PostedGroupInfoData *postedData = dynamic_cast<const PostedGroupInfoData*>(userdata);
|
||||||
|
if (!postedData) {
|
||||||
|
std::cerr << "PostedDialog::groupInfoToGroupItemInfo() Failed to cast data to PostedGroupInfoData";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = postedData->mDescription.find(groupInfo.mGroupId);
|
||||||
|
if (descriptionIt != postedData->mDescription.end()) {
|
||||||
|
groupItemInfo.description = descriptionIt.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,6 +48,7 @@ protected:
|
|||||||
virtual QString getHelpString() const ;
|
virtual QString getHelpString() const ;
|
||||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
|
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
|
||||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
|
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
|
||||||
|
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* GxsGroupFrameDialog */
|
/* GxsGroupFrameDialog */
|
||||||
@ -60,6 +61,8 @@ private:
|
|||||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||||
virtual RsGxsCommentService *getCommentService();
|
virtual RsGxsCommentService *getCommentService();
|
||||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||||
|
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||||
|
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -649,12 +649,11 @@ void GxsGroupFrameDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupI
|
|||||||
{
|
{
|
||||||
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
|
groupItemInfo.id = QString::fromStdString(groupInfo.mGroupId.toStdString());
|
||||||
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
groupItemInfo.name = QString::fromUtf8(groupInfo.mGroupName.c_str());
|
||||||
//groupItemInfo.description =
|
|
||||||
groupItemInfo.popularity = groupInfo.mPop;
|
groupItemInfo.popularity = groupInfo.mPop;
|
||||||
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
groupItemInfo.lastpost = QDateTime::fromTime_t(groupInfo.mLastPost);
|
||||||
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
|
groupItemInfo.subscribeFlags = groupInfo.mSubscribeFlags;
|
||||||
groupItemInfo.privatekey = IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ;
|
groupItemInfo.privatekey = IS_GROUP_PUBLISHER(groupInfo.mSubscribeFlags) ;
|
||||||
groupItemInfo.max_visible_posts = groupInfo.mVisibleMsgCount ;
|
groupItemInfo.max_visible_posts = groupInfo.mVisibleMsgCount ;
|
||||||
|
|
||||||
#if TOGXS
|
#if TOGXS
|
||||||
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
if (groupInfo.mGroupFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||||
|
@ -36,6 +36,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QMap<RsGxsGroupId, QIcon> mIcon;
|
QMap<RsGxsGroupId, QIcon> mIcon;
|
||||||
|
QMap<RsGxsGroupId, QString> mDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
@ -181,7 +182,7 @@ void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<Rs
|
|||||||
std::vector<RsGxsChannelGroup> groups;
|
std::vector<RsGxsChannelGroup> groups;
|
||||||
rsGxsChannels->getGroupData(token, groups);
|
rsGxsChannels->getGroupData(token, groups);
|
||||||
|
|
||||||
/* Save groups to fill icons */
|
/* Save groups to fill icons and description */
|
||||||
GxsChannelGroupInfoData *channelData = new GxsChannelGroupInfoData;
|
GxsChannelGroupInfoData *channelData = new GxsChannelGroupInfoData;
|
||||||
userdata = channelData;
|
userdata = channelData;
|
||||||
|
|
||||||
@ -195,6 +196,10 @@ void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<Rs
|
|||||||
image.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
|
image.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
|
||||||
channelData->mIcon[group.mMeta.mGroupId] = image;
|
channelData->mIcon[group.mMeta.mGroupId] = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!group.mDescription.empty()) {
|
||||||
|
channelData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +214,11 @@ void GxsChannelDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = channelData->mDescription.find(groupInfo.mGroupId);
|
||||||
|
if (descriptionIt != channelData->mDescription.end()) {
|
||||||
|
groupItemInfo.description = descriptionIt.value();
|
||||||
|
}
|
||||||
|
|
||||||
QMap<RsGxsGroupId, QIcon>::const_iterator iconIt = channelData->mIcon.find(groupInfo.mGroupId);
|
QMap<RsGxsGroupId, QIcon>::const_iterator iconIt = channelData->mIcon.find(groupInfo.mGroupId);
|
||||||
if (iconIt != channelData->mIcon.end()) {
|
if (iconIt != channelData->mIcon.end()) {
|
||||||
groupItemInfo.icon = iconIt.value();
|
groupItemInfo.icon = iconIt.value();
|
||||||
|
@ -25,6 +25,16 @@
|
|||||||
#include "GxsForumUserNotify.h"
|
#include "GxsForumUserNotify.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/gxs/GxsGroupShareKey.h"
|
#include "gui/gxs/GxsGroupShareKey.h"
|
||||||
|
#include "gui/common/GroupTreeWidget.h"
|
||||||
|
|
||||||
|
class GxsForumGroupInfoData : public RsUserdata
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GxsForumGroupInfoData() : RsUserdata() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
QMap<RsGxsGroupId, QString> mDescription;
|
||||||
|
};
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
GxsForumsDialog::GxsForumsDialog(QWidget *parent)
|
GxsForumsDialog::GxsForumsDialog(QWidget *parent)
|
||||||
@ -125,3 +135,40 @@ GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGrou
|
|||||||
{
|
{
|
||||||
return new GxsForumThreadWidget(groupId);
|
return new GxsForumThreadWidget(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
||||||
|
{
|
||||||
|
std::vector<RsGxsForumGroup> groups;
|
||||||
|
rsGxsForums->getGroupData(token, groups);
|
||||||
|
|
||||||
|
/* Save groups to fill description */
|
||||||
|
GxsForumGroupInfoData *forumData = new GxsForumGroupInfoData;
|
||||||
|
userdata = forumData;
|
||||||
|
|
||||||
|
std::vector<RsGxsForumGroup>::iterator groupIt;
|
||||||
|
for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) {
|
||||||
|
RsGxsForumGroup &group = *groupIt;
|
||||||
|
groupInfo.push_back(group.mMeta);
|
||||||
|
|
||||||
|
if (!group.mDescription.empty()) {
|
||||||
|
forumData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
||||||
|
{
|
||||||
|
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
||||||
|
|
||||||
|
const GxsForumGroupInfoData *forumData = dynamic_cast<const GxsForumGroupInfoData*>(userdata);
|
||||||
|
if (!forumData) {
|
||||||
|
std::cerr << "GxsForumsDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsForumGroupInfoData";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = forumData->mDescription.find(groupInfo.mGroupId);
|
||||||
|
if (descriptionIt != forumData->mDescription.end()) {
|
||||||
|
groupItemInfo.description = descriptionIt.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -44,6 +44,7 @@ protected:
|
|||||||
virtual QString getHelpString() const ;
|
virtual QString getHelpString() const ;
|
||||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; }
|
||||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Forum; }
|
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Forum; }
|
||||||
|
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* GxsGroupFrameDialog */
|
/* GxsGroupFrameDialog */
|
||||||
@ -54,6 +55,8 @@ private:
|
|||||||
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
virtual GxsGroupDialog *createGroupDialog(TokenQueue *tokenQueue, RsTokenService *tokenService, GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
|
||||||
virtual int shareKeyType();
|
virtual int shareKeyType();
|
||||||
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
|
||||||
|
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
|
||||||
|
virtual void loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata* &userdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user