mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -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
|
@ -25,6 +25,16 @@
|
|||
#include "GxsForumUserNotify.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/gxs/GxsGroupShareKey.h"
|
||||
#include "gui/common/GroupTreeWidget.h"
|
||||
|
||||
class GxsForumGroupInfoData : public RsUserdata
|
||||
{
|
||||
public:
|
||||
GxsForumGroupInfoData() : RsUserdata() {}
|
||||
|
||||
public:
|
||||
QMap<RsGxsGroupId, QString> mDescription;
|
||||
};
|
||||
|
||||
/** Constructor */
|
||||
GxsForumsDialog::GxsForumsDialog(QWidget *parent)
|
||||
|
@ -125,3 +135,40 @@ GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGrou
|
|||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue