mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-10 01:55:19 -04:00
fixed flags conflicts
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5758 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dc82cee700
commit
e753f22909
43 changed files with 383 additions and 386 deletions
|
@ -91,11 +91,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
|
|||
void *ref = parent.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -152,11 +148,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
|
|||
void *ref = (parent.isValid())? parent.internalPointer() : NULL ;
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -202,14 +194,14 @@ int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
|
|||
{
|
||||
return 5;
|
||||
}
|
||||
QString RetroshareDirModel::getFlagsString(uint32_t flags)
|
||||
QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
|
||||
{
|
||||
char str[8] = "- - - -" ;
|
||||
char str[11] = "- - - -" ;
|
||||
|
||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
||||
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' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[3] = 'N' ;
|
||||
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[6] = 'B' ;
|
||||
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[9] = 'N' ;
|
||||
|
||||
return QString(str) ;
|
||||
}
|
||||
|
@ -377,7 +369,7 @@ QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
|
|||
{
|
||||
QString dir ;
|
||||
DirDetails det(details) ;
|
||||
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if(!requestDirDetails(det.parent,det,flags))
|
||||
return QString();
|
||||
|
@ -518,11 +510,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
|
|||
int coln = index.column();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
return QVariant();
|
||||
|
@ -582,12 +570,8 @@ void RetroshareDirModel::getAgeIndicatorRec(DirDetails &details, QString &ret) c
|
|||
for (it = details.children.begin(); it != details.children.end(); it++) {
|
||||
void *ref = it->ref;
|
||||
DirDetails childDetails;
|
||||
uint32_t flags;
|
||||
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (requestDirDetails(ref, childDetails, flags) && ret == tr(""))
|
||||
getAgeIndicatorRec(childDetails, ret);
|
||||
|
@ -704,11 +688,7 @@ QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent
|
|||
********/
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -787,7 +767,7 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
|
|||
void *ref = index.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -838,11 +818,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
|
|||
void *ref = index.internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
return Qt::ItemIsSelectable; // Error.
|
||||
|
@ -892,7 +868,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
|
|||
#endif
|
||||
}
|
||||
|
||||
bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,uint32_t flags) const
|
||||
bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,FileSearchFlags flags) const
|
||||
{
|
||||
// We should use a cache instead of calling RsFiles::RequestDirDetails(), which is very costly
|
||||
// due to some pointer checking crap.
|
||||
|
@ -950,7 +926,7 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
|
|||
std::list<std::string> srcIds;
|
||||
srcIds.push_back(details.id);
|
||||
rsFiles -> FileRequest(details.name, details.hash,
|
||||
details.count, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
details.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
/* if it is a dir, copy all files included*/
|
||||
else if (details.type == DIR_TYPE_DIR)
|
||||
|
@ -971,7 +947,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
|
|||
QString cleanPath = QDir::cleanPath(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()) + "/" + QString::fromUtf8(dirDetails.path.substr(prefixLen).c_str()));
|
||||
|
||||
srcIds.push_back(dirDetails.id);
|
||||
rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_HINTS_NETWORK_WIDE, srcIds);
|
||||
rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
else if (dirDetails.type & DIR_TYPE_DIR)
|
||||
{
|
||||
|
@ -986,7 +962,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
|
|||
if (!it->ref) continue;
|
||||
|
||||
DirDetails subDirDetails;
|
||||
uint32_t flags = DIR_FLAGS_CHILDREN | DIR_FLAGS_REMOTE;
|
||||
FileSearchFlags flags = RS_FILE_HINTS_REMOTE ;
|
||||
|
||||
if (!requestDirDetails(it->ref, subDirDetails, flags)) continue;
|
||||
|
||||
|
@ -1008,20 +984,10 @@ void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, s
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
{
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
dirVec.push_back(details);
|
||||
}
|
||||
|
@ -1056,12 +1022,7 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
|
||||
if (RemoteMode)
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
else
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
continue;
|
||||
|
@ -1157,10 +1118,8 @@ void RetroshareDirModel::getFilePaths(const QModelIndexList &list, std::list<std
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
if (!requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL))
|
||||
{
|
||||
#ifdef RDM_DEBUG
|
||||
std::cerr << "getFilePaths() Bad Request" << std::endl;
|
||||
|
@ -1214,15 +1173,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
|
|||
void *ref = it -> internalPointer();
|
||||
|
||||
DirDetails details;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
if (RemoteMode)
|
||||
{
|
||||
flags |= DIR_FLAGS_REMOTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags |= DIR_FLAGS_LOCAL;
|
||||
}
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!requestDirDetails(ref, details, flags))
|
||||
{
|
||||
|
@ -1299,7 +1250,7 @@ int RetroshareDirModel::getType ( const QModelIndex & index ) const
|
|||
//if (RemoteMode) // only local files can be opened
|
||||
// return ;
|
||||
|
||||
uint32_t flags = RemoteMode?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL;
|
||||
FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
|
||||
|
||||
return rsFiles->getType(index.internalPointer(),flags);
|
||||
}
|
||||
|
@ -1348,10 +1299,9 @@ void FlatStyle_RDM::updateRefs()
|
|||
std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl;
|
||||
#endif
|
||||
_ref_stack.pop_back() ;
|
||||
uint32_t flags = DIR_FLAGS_DETAILS;
|
||||
DirDetails details ;
|
||||
|
||||
if (requestDirDetails(ref, details, flags))
|
||||
if (requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE))
|
||||
{
|
||||
if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons.
|
||||
_ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(details)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue