added subwidgets for invited GXS ids in circles

This commit is contained in:
csoler 2016-05-21 16:50:50 -04:00
parent 82ad7d6b1c
commit d60e99e8e0
3 changed files with 176 additions and 133 deletions

View File

@ -113,7 +113,7 @@ class RsGxsCircleDetails
uint32_t mCircleType; 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<RsGxsId> mAllowedGxsIds; // This crosses admin list and subscribed list
std::set<RsPgpId> mAllowedNodes; std::set<RsPgpId> mAllowedNodes;

View File

@ -432,6 +432,7 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, const RsGxsGroupId&
{ {
gxs_ids.clear() ; 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 ******/ RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
if (!mCircleCache.is_cached(circleId)) if (!mCircleCache.is_cached(circleId))
return false ; return false ;
@ -1055,13 +1056,15 @@ bool p3GxsCircles::locked_processLoadingCacheEntry(RsGxsCircleCache& cache)
} }
else else
{ {
#ifdef DEBUG_CIRCLES
std::cerr << " Requesting unknown/unloaded identity: " << pit->first << " to originator " << cache.mOriginator << std::endl;
#endif
std::list<PeerId> peers; std::list<PeerId> peers;
if(!cache.mOriginator.isNull()) if(!cache.mOriginator.isNull())
{
peers.push_back(cache.mOriginator) ; peers.push_back(cache.mOriginator) ;
#ifdef DEBUG_CIRCLES
std::cerr << " Requesting unknown/unloaded identity: " << pit->first << " to originator " << cache.mOriginator << std::endl;
#endif
}
else 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; 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;

View File

@ -399,6 +399,9 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
ui->treeWidget_membership->addTopLevelItem(mExternalBelongingCircleItem); ui->treeWidget_membership->addTopLevelItem(mExternalBelongingCircleItem);
} }
std::list<RsGxsId> own_identities ;
rsIdentity->getOwnIds(own_identities) ;
for(vit = groupInfo.begin(); vit != groupInfo.end();++vit) for(vit = groupInfo.begin(); vit != groupInfo.end();++vit)
{ {
#ifdef ID_DEBUG #ifdef ID_DEBUG
@ -502,29 +505,66 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ; item->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ;
} }
#warning TODO // now determine for this circle wether we have pending invites
// switch(details.mSubscribeFlags) // 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
// case GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED: // - own GXS id is is admin and subscribed
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ; // - own GXS id is is subscribed
// 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 ; for(std::list<RsGxsId>::const_iterator it(own_identities.begin());it!=own_identities.end();++it)
// {
// case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST: std::map<RsGxsId,uint32_t>::const_iterator it2 = details.mSubscriptionFlags.find(*it) ;
// 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.")) ; if(it2 == details.mSubscriptionFlags.end())
// break ; continue ;
//
// case GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST | GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED: bool invited ( it2->second & GXS_EXTERNAL_CIRCLE_FLAGS_IN_ADMIN_LIST );
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ; bool subscrb ( it2->second & GXS_EXTERNAL_CIRCLE_FLAGS_SUBSCRIBED );
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("You are a validated member of this circle.")) ;
// break ; QTreeWidgetItem *subitem = NULL ;
//
// default: // see if the item already exists
// item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon()) ; for(QTreeWidgetItemIterator itt(item);(*itt);++itt)
// item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,"") ; if((*itt)->text(CIRCLEGROUP_CIRCLE_COL_GROUPID).toStdString() == (*it).toStdString())
// break ; {
// } 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")) ;
}
} }
} }