mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 16:27:01 -05:00
added subwidgets for invited GXS ids in circles
This commit is contained in:
parent
82ad7d6b1c
commit
d60e99e8e0
@ -113,7 +113,7 @@ class RsGxsCircleDetails
|
||||
|
||||
uint32_t mCircleType;
|
||||
|
||||
bool mAmIAllowed ;
|
||||
bool mAmIAllowed ; // true when one of load GXS ids belong to the circle allowed list (admin list & subscribed list).
|
||||
|
||||
std::set<RsGxsId> mAllowedGxsIds; // This crosses admin list and subscribed list
|
||||
std::set<RsPgpId> mAllowedNodes;
|
||||
|
@ -432,6 +432,7 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, const RsGxsGroupId&
|
||||
{
|
||||
gxs_ids.clear() ;
|
||||
|
||||
#warning Shouldn't we allow to propagate circle restricted info to partially loaded circles? Otherwise if an identity disappears, it will block the circle.
|
||||
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
|
||||
if (!mCircleCache.is_cached(circleId))
|
||||
return false ;
|
||||
@ -1055,13 +1056,15 @@ bool p3GxsCircles::locked_processLoadingCacheEntry(RsGxsCircleCache& cache)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << " Requesting unknown/unloaded identity: " << pit->first << " to originator " << cache.mOriginator << std::endl;
|
||||
#endif
|
||||
std::list<PeerId> peers;
|
||||
|
||||
if(!cache.mOriginator.isNull())
|
||||
{
|
||||
peers.push_back(cache.mOriginator) ;
|
||||
#ifdef DEBUG_CIRCLES
|
||||
std::cerr << " Requesting unknown/unloaded identity: " << pit->first << " to originator " << cache.mOriginator << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " (WW) cache entry for circle " << cache.mCircleId << " has empty originator. Asking info for GXS id " << pit->first << " to all connected friends." << std::endl;
|
||||
|
@ -399,6 +399,9 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
ui->treeWidget_membership->addTopLevelItem(mExternalBelongingCircleItem);
|
||||
}
|
||||
|
||||
std::list<RsGxsId> own_identities ;
|
||||
rsIdentity->getOwnIds(own_identities) ;
|
||||
|
||||
for(vit = groupInfo.begin(); vit != groupInfo.end();++vit)
|
||||
{
|
||||
#ifdef ID_DEBUG
|
||||
@ -502,29 +505,66 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
|
||||
}
|
||||
|
||||
#warning TODO
|
||||
// switch(details.mSubscribeFlags)
|
||||
// {
|
||||
// case GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED:
|
||||
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ;
|
||||
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("Your request to be in this circle is pending. You need to wait for the administrator to validate it.")) ;
|
||||
// break ;
|
||||
//
|
||||
// case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST:
|
||||
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_blue_128.png")) ;
|
||||
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("You are invited to this circle by the administrator. Right click to join the circle.")) ;
|
||||
// break ;
|
||||
//
|
||||
// case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST | GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED:
|
||||
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ;
|
||||
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("You are a validated member of this circle.")) ;
|
||||
// break ;
|
||||
//
|
||||
// default:
|
||||
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon()) ;
|
||||
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,"") ;
|
||||
// break ;
|
||||
// }
|
||||
// now determine for this circle wether we have pending invites
|
||||
// we add a sub-item to the circle (to show the invite system info) in the following two cases:
|
||||
// - own GXS id is in admin list but not subscribed
|
||||
// - own GXS id is is admin and subscribed
|
||||
// - own GXS id is is subscribed
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it(own_identities.begin());it!=own_identities.end();++it)
|
||||
{
|
||||
std::map<RsGxsId,uint32_t>::const_iterator it2 = details.mSubscriptionFlags.find(*it) ;
|
||||
|
||||
if(it2 == details.mSubscriptionFlags.end())
|
||||
continue ;
|
||||
|
||||
bool invited ( it2->second & GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST );
|
||||
bool subscrb ( it2->second & GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED );
|
||||
|
||||
QTreeWidgetItem *subitem = NULL ;
|
||||
|
||||
// see if the item already exists
|
||||
for(QTreeWidgetItemIterator itt(item);(*itt);++itt)
|
||||
if((*itt)->text(CIRCLEGROUP_CIRCLE_COL_GROUPID).toStdString() == (*it).toStdString())
|
||||
{
|
||||
subitem = *itt ;
|
||||
break ;
|
||||
}
|
||||
|
||||
if(!(invited || subscrb))
|
||||
{
|
||||
if(subitem != NULL)
|
||||
delete subitem ;
|
||||
continue ;
|
||||
}
|
||||
|
||||
if(!subitem)
|
||||
{
|
||||
subitem = new QTreeWidgetItem(item);
|
||||
|
||||
RsIdentityDetails idd ;
|
||||
rsIdentity->getIdDetails(*it,idd) ;
|
||||
|
||||
QPixmap pixmap ;
|
||||
|
||||
if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
|
||||
pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;
|
||||
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, QString::fromStdString(it2->first.toStdString())) ;
|
||||
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(it2->second)) ;
|
||||
|
||||
subitem->setIcon(RSID_COL_NICKNAME, QIcon(pixmap));
|
||||
|
||||
item->addChild(subitem) ;
|
||||
}
|
||||
|
||||
if(invited && !subscrb)
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Invited")) ;
|
||||
if(!invited && subscrb)
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Subscription pending")) ;
|
||||
if(invited && subscrb)
|
||||
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Member")) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user