mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 16:39:29 -05:00
fixed proper display of file sharing flags
This commit is contained in:
parent
7c2ed3fca0
commit
1290aa8403
@ -207,7 +207,6 @@ public:
|
||||
f.file_modtime = it->second.modtime;
|
||||
f.file_size = it->second.size;
|
||||
}
|
||||
else
|
||||
new_files.erase(f.file_name) ;
|
||||
|
||||
++i;
|
||||
@ -881,7 +880,7 @@ void LocalDirectoryStorage::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
RS_STACK_MUTEX(mDirStorageMtx) ;
|
||||
|
||||
std::map<std::string,SharedDirInfo>::iterator it = mLocalDirs.find(info.virtualname) ;
|
||||
std::map<std::string,SharedDirInfo>::iterator it = mLocalDirs.find(info.filename) ;
|
||||
|
||||
if(it == mLocalDirs.end())
|
||||
{
|
||||
@ -944,8 +943,38 @@ bool LocalDirectoryStorage::extractData(const EntryIndex& indx,DirDetails& d)
|
||||
// here we should update the file sharing flags
|
||||
|
||||
d.flags.clear() ;
|
||||
d.parent_groups.clear();
|
||||
|
||||
/* find parent pointer, and row */
|
||||
std::string base_dir;
|
||||
|
||||
for(DirectoryStorage::EntryIndex i=((d.type==DIR_TYPE_FILE)?((intptr_t)d.parent):((intptr_t)d.ref));;)
|
||||
{
|
||||
const InternalFileHierarchyStorage::DirEntry *e = mFileHierarchy->getDirEntry(i) ;
|
||||
|
||||
if(e == NULL)
|
||||
break ;
|
||||
|
||||
if(e->parent_index == 0)
|
||||
{
|
||||
base_dir = e->dir_name ;
|
||||
break ;
|
||||
}
|
||||
i = e->parent_index ;
|
||||
}
|
||||
|
||||
if(!base_dir.empty())
|
||||
{
|
||||
std::map<std::string,SharedDirInfo>::const_iterator it = mLocalDirs.find(base_dir) ;
|
||||
|
||||
if(it == mLocalDirs.end())
|
||||
{
|
||||
std::cerr << "(EE) very weird bug: base directory \"" << base_dir << "\" not found in shared dir list." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
#warning we should use a NodeGroupId here
|
||||
d.flags = it->second.shareflags;
|
||||
d.parent_groups = it->second.parent_groups;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
return true ;
|
||||
}
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << "Not in cache. Sceduling for re-hash." << std::endl ;
|
||||
std::cerr << "Not in cache. Scheduling for re-hash." << std::endl ;
|
||||
#endif
|
||||
|
||||
// we need to schedule a re-hashing
|
||||
|
@ -63,11 +63,15 @@ void p3FileDatabase::getSharedDirectories(std::list<SharedDirInfo>& shared_dirs)
|
||||
mLocalSharedDirs->getSharedDirectoryList(shared_dirs) ;
|
||||
}
|
||||
void p3FileDatabase::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
mLocalSharedDirs->updateShareFlags(info) ;
|
||||
}
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
|
||||
p3FileDatabase::~p3FileDatabase()
|
||||
{
|
||||
RS_STACK_MUTEX(mFLSMtx) ;
|
||||
@ -135,7 +139,7 @@ int p3FileDatabase::tick()
|
||||
last_print_time = now ;
|
||||
|
||||
//#warning this should be removed, but it's necessary atm for updating the GUI
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
|
||||
if(mUpdateFlags)
|
||||
|
@ -250,8 +250,13 @@ void SharedFilesDialog::showEvent(QShowEvent *)
|
||||
{
|
||||
if(model!=NULL)
|
||||
{
|
||||
std::set<std::string> expanded_indexes ;
|
||||
saveExpandedPaths(expanded_indexes);
|
||||
|
||||
model->setVisible(true) ;
|
||||
model->update() ;
|
||||
|
||||
restoreExpandedPaths(expanded_indexes);
|
||||
}
|
||||
}
|
||||
RemoteSharedFilesDialog::~RemoteSharedFilesDialog()
|
||||
@ -348,9 +353,13 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
|
||||
|
||||
showProperColumns() ;
|
||||
|
||||
std::set<std::string> expanded_indexes ;
|
||||
saveExpandedPaths(expanded_indexes);
|
||||
|
||||
if(isVisible())
|
||||
{
|
||||
model->setVisible(true) ;
|
||||
|
||||
model->update() ;
|
||||
}
|
||||
|
||||
@ -360,6 +369,8 @@ void SharedFilesDialog::changeCurrentViewModel(int viewTypeIndex)
|
||||
ui.dirTreeView->setModel(proxyModel);
|
||||
ui.dirTreeView->update();
|
||||
|
||||
restoreExpandedPaths(expanded_indexes);
|
||||
|
||||
QHeaderView * header = ui.dirTreeView->header () ;
|
||||
QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Interactive);
|
||||
|
||||
@ -828,6 +839,10 @@ void SharedFilesDialog::preModDirectories(bool local)
|
||||
|
||||
void SharedFilesDialog::saveExpandedPaths(std::set<std::string>& expanded_indexes)
|
||||
{
|
||||
if(ui.dirTreeView->model() == NULL)
|
||||
return ;
|
||||
|
||||
std::cerr << "Saving expanded items. " << std::endl;
|
||||
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
|
||||
{
|
||||
std::string path = ui.dirTreeView->model()->index(row,0).data(Qt::DisplayRole).toString().toStdString();
|
||||
@ -837,6 +852,9 @@ void SharedFilesDialog::saveExpandedPaths(std::set<std::string>& expanded_indexe
|
||||
|
||||
void SharedFilesDialog::restoreExpandedPaths(const std::set<std::string>& expanded_indexes)
|
||||
{
|
||||
if(ui.dirTreeView->model() == NULL)
|
||||
return ;
|
||||
|
||||
std::cerr << "Restoring expanded items. " << std::endl;
|
||||
for(int row = 0; row < ui.dirTreeView->model()->rowCount(); ++row)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user