First shot of file sharing permissions. Compiles, but needs some testing/debugging.

- added type-safe flags in retroshare/rsflags.h. This should be used to make new flags types in order to prevent mixing flags up in function prototypes.
- group handling is left to rsPeers. We'll move it to rsCircles later.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5754 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-01 10:06:12 +00:00
parent 03d4936b12
commit dc82cee700
27 changed files with 567 additions and 336 deletions

View file

@ -339,9 +339,9 @@ void QuickStartWizard::updateFlags(bool b)
for(it = dirs.begin(); it != dirs.end(); it++,++row)
{
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
uint32_t current_flags = 0 ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? RS_FILE_HINTS_NETWORK_WIDE:0 ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? RS_FILE_HINTS_BROWSABLE:0 ;
TransferInfoFlags current_flags = 0u ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? RS_FILE_HINTS_NETWORK_WIDE:(TransferInfoFlags)0u ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? RS_FILE_HINTS_BROWSABLE:(TransferInfoFlags)0u ;
if( (*it).shareflags ^ current_flags )
{

View file

@ -204,12 +204,12 @@ int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
}
QString RetroshareDirModel::getFlagsString(uint32_t flags)
{
char str[5] = "----" ;
char str[8] = "- - - -" ;
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[1] = 'N' ;
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[2] = 'B' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[3] = 'N' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[2] = 'N' ;
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[4] = 'B' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[6] = 'N' ;
return QString(str) ;
}
@ -340,7 +340,7 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
// return ind;
// }
case 4:
return getGroupsString(details.groups) ;
return getGroupsString(details.parent_groups) ;
default:
return tr("FILE");
@ -364,7 +364,7 @@ QVariant TreeStyle_RDM::displayRole(const DirDetails& details,int coln) const
case 3:
return getFlagsString(details.flags);
case 4:
return getGroupsString(details.groups) ;
return getGroupsString(details.parent_groups) ;
default:
return tr("DIR");

View file

@ -614,7 +614,7 @@ void SearchDialog::advancedSearch(Expression* expression)
// The text "bool exp" should be replaced by an appropriate text describing the actual search.
initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ;
rsFiles -> SearchBoolExp(expression, results, DIR_FLAGS_REMOTE | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
rsFiles -> SearchBoolExp(expression, results, DIR_FLAGS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
/* abstraction to allow reusee of tree rendering code */
resultsToTree(advSearchDialog->getSearchAsString(),req_id, results);
@ -712,7 +712,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
{
std::list<DirDetails> initialResults;
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_LOCAL | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
/* which extensions do we use? */
DirDetails dd;

View file

@ -945,7 +945,7 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
// if file transfer is a cache file index file, don't show it
DLListModel->removeRow(row);
rowCount = DLListModel->rowCount();
@ -971,7 +971,7 @@ void TransfersDialog::insertTransfers()
continue;
}
if ((fileInfo.flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) {
//if file transfer is a cache file index file, don't show it
continue;
}
@ -998,7 +998,7 @@ void TransfersDialog::insertTransfers()
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
continue;
if((info.flags & RS_FILE_HINTS_CACHE) && showCacheTransfers)
if((info.transfer_info_flags & RS_FILE_HINTS_CACHE) && showCacheTransfers)
continue ;
std::list<TransferInfo>::iterator pit;

View file

@ -48,10 +48,10 @@ GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,uint32_t flags)
setLayout(_layout) ;
_flags[0] = RS_FILE_HINTS_BROWSABLE_GROUPS ;
_flags[1] = RS_FILE_HINTS_NETWORK_WIDE_GROUPS ;
_flags[2] = RS_FILE_HINTS_BROWSABLE_OTHERS ;
_flags[3] = RS_FILE_HINTS_NETWORK_WIDE_OTHERS ;
_flags[0] = DIR_FLAGS_BROWSABLE_GROUPS ;
_flags[1] = DIR_FLAGS_NETWORK_WIDE_GROUPS ;
_flags[2] = DIR_FLAGS_BROWSABLE_OTHERS ;
_flags[3] = DIR_FLAGS_NETWORK_WIDE_OTHERS ;
for(int i=0;i<4;++i)
{