added contextual message to explain current group sharing permissions

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5771 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-03 17:15:47 +00:00
parent d77c73adf4
commit 6b6f961e94
5 changed files with 68 additions and 17 deletions

View file

@ -117,6 +117,36 @@ void GroupFlagsWidget::update_button_state(bool b,int button_id)
}
}
QString GroupFlagsWidget::groupInfoString(FileStorageFlags flags,const std::list<std::string>& groups)
{
// makes a string that explains how files are shared / visible.
QString res ;
QString groups_string ;
for(std::list<std::string>::const_iterator it(groups.begin());it!=groups.end();++it)
{
if(it != groups.begin())
groups_string += ", " ;
groups_string += QString::fromStdString(*it) ;
}
if((flags & DIR_FLAGS_BROWSABLE_OTHERS) && !groups.empty())
res += tr("All your friends can browse this directory\n") ;
else if((flags & DIR_FLAGS_BROWSABLE_GROUPS) && !groups.empty())
res += tr("Friends in groups ") + groups_string + tr(" can browse this directory\n") ;
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS)
res += tr("All your friends can relay anonymous tunnels to this directory") ;
else if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS)
res += tr("Friends in groups ") + groups_string + tr(" can relay anonymous tunnels to this directory") ;
if(flags.toUInt32() == 0)
res += tr("No friends can access nor see this directory.") ;
return res ;
}
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
void GroupFlagsWidget::update_GB_button(bool b) { update_button_state(b,INDEX_GROUP_BROWSABLE) ; updated() ; }
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }