mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 19:12:28 -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
6 changed files with 114 additions and 5 deletions
|
@ -28,9 +28,19 @@
|
|||
#include "PostedUserNotify.h"
|
||||
#include "gui/gxs/GxsGroupShareKey.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
|
||||
#include <retroshare/rsposted.h>
|
||||
|
||||
class PostedGroupInfoData : public RsUserdata
|
||||
{
|
||||
public:
|
||||
PostedGroupInfoData() : RsUserdata() {}
|
||||
|
||||
public:
|
||||
QMap<RsGxsGroupId, QString> mDescription;
|
||||
};
|
||||
|
||||
/** Constructor */
|
||||
PostedDialog::PostedDialog(QWidget *parent)
|
||||
: GxsGroupFrameDialog(rsPosted, parent)
|
||||
|
@ -136,3 +146,40 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue