mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-20 13:24:33 -05:00
corrected bug about display/selection of anonymous files
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2176 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8d74bb0e6b
commit
8ccf3c3e2d
@ -87,17 +87,24 @@ int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<D
|
||||
|
||||
for(std::list<FileEntry*>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails pdetails ;
|
||||
RequestDirDetails((*rit)->parent,pdetails,0) ;
|
||||
DirDetails cdetails ;
|
||||
RequestDirDetails (*rit,cdetails,0);
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "Filtering candidate " << (*rit)->name << ", flags=" << cdetails.flags ;
|
||||
#endif
|
||||
|
||||
if ( ((cdetails.type == DIR_TYPE_FILE) && (pdetails.flags & flags & (DIR_FLAGS_BROWSABLE | DIR_FLAGS_NETWORK_WIDE)) > 0) ||
|
||||
((cdetails.type == DIR_TYPE_DIR) && (cdetails.flags & flags & (DIR_FLAGS_BROWSABLE | DIR_FLAGS_NETWORK_WIDE)) > 0) )
|
||||
if (cdetails.type == DIR_TYPE_FILE && ( cdetails.flags & flags & (DIR_FLAGS_BROWSABLE | DIR_FLAGS_NETWORK_WIDE)) > 0)
|
||||
{
|
||||
cdetails.id = "Local";
|
||||
results.push_back(cdetails);
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << ": kept" << std::endl ;
|
||||
#endif
|
||||
}
|
||||
#ifdef FIM_DEBUG
|
||||
else
|
||||
std::cerr << ": discarded" << std::endl ;
|
||||
#endif
|
||||
}
|
||||
return !results.empty() ;
|
||||
}
|
||||
@ -1029,26 +1036,26 @@ int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, uint32_t
|
||||
return false ;
|
||||
|
||||
// look for the top level and setup flags accordingly
|
||||
// The top level directory is the first dir in parents for which
|
||||
// dir->parent->parent == NULL
|
||||
|
||||
if(ref != NULL)
|
||||
{
|
||||
FileEntry *file = (FileEntry *) ref;
|
||||
DirEntry *dir = dynamic_cast<DirEntry*>(file->parent) ;
|
||||
DirEntry *last_dir = NULL ;
|
||||
DirEntry *dir = dynamic_cast<DirEntry*>(file) ;
|
||||
if(dir == NULL)
|
||||
dir = dynamic_cast<DirEntry*>(file->parent) ;
|
||||
|
||||
if(dir != NULL)
|
||||
while(dir->parent != NULL)
|
||||
{
|
||||
last_dir = dir ;
|
||||
if(dir != NULL && dir->parent != NULL)
|
||||
while(dir->parent->parent != NULL)
|
||||
dir = dir->parent ;
|
||||
}
|
||||
|
||||
if(last_dir != NULL)
|
||||
if(dir != NULL && dir->parent != NULL)
|
||||
{
|
||||
#ifdef FIM_DEBUG
|
||||
std::cerr << "FileIndexMonitor::RequestDirDetails: parent->name=" << last_dir->name << std::endl ;
|
||||
std::cerr << "FileIndexMonitor::RequestDirDetails: top parent name=" << dir->name << std::endl ;
|
||||
#endif
|
||||
std::map<std::string,SharedDirInfo>::const_iterator it = directoryMap.find(last_dir->name) ;
|
||||
std::map<std::string,SharedDirInfo>::const_iterator it = directoryMap.find(dir->name) ;
|
||||
|
||||
if(it == directoryMap.end())
|
||||
std::cerr << "*********** ERROR *********** In " << __PRETTY_FUNCTION__ << std::endl ;
|
||||
|
@ -1521,15 +1521,27 @@ void RsTurtleStringSearchRequestItem::performLocalSearch(std::list<TurtleFileInf
|
||||
// to do: split search string into words.
|
||||
words.push_back(match_string) ;
|
||||
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << "Performing rsFiles->search()" << std::endl ;
|
||||
#endif
|
||||
// now, search!
|
||||
rsFiles->SearchKeywords(words, initialResults,DIR_FLAGS_LOCAL | DIR_FLAGS_NETWORK_WIDE);
|
||||
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << initialResults.size() << " matches found." << std::endl ;
|
||||
#endif
|
||||
result.clear() ;
|
||||
|
||||
for(std::list<DirDetails>::const_iterator it(initialResults.begin());it!=initialResults.end();++it)
|
||||
{
|
||||
// retain only file type
|
||||
if (it->type == DIR_TYPE_DIR) continue;
|
||||
if (it->type == DIR_TYPE_DIR)
|
||||
{
|
||||
#ifdef P3TURTLE_DEBUG
|
||||
std::cerr << " Skipping directory " << it->name << std::endl ;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
TurtleFileInfo i ;
|
||||
i.hash = it->hash ;
|
||||
|
@ -964,6 +964,8 @@ void RemoteDirModel::getFileInfoFromIndexList(const QModelIndexList& list, std::
|
||||
std::cerr << "Size: " << details.count << std::endl;
|
||||
std::cerr << "Path: " << details.path << std::endl;
|
||||
#endif
|
||||
// Note: for directories, the returned hash, is the peer id, so if we collect
|
||||
// dirs, we need to be a bit more conservative for the
|
||||
|
||||
if(already_in.find(details.hash+details.name) == already_in.end())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user