mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-11-25 18:16:30 -05:00
Started implementing flags to handle the sharing mode.
What works: - the gui shows the flags in ShareManager - the flags are loaded/saved to ft_shared.cfg and passed on to FileIndexMonitor What does not work yet: - the flags are not accounted for yet by FileIndexMonitor In addition: - simplified the directories dialog in Preferences, so that it calls the ShareManager instead of dupplicating the directories management code that becomes larger. - setup the ShareManager to be a singleton, so as to coherently call it from different places. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1486 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
aa1658245c
commit
f9dc3b223b
19 changed files with 512 additions and 313 deletions
|
|
@ -136,7 +136,10 @@ bool ftFiMonitor::search(std::string hash, uint64_t size, uint32_t hintflags, Fi
|
|||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
if (findLocalFile(hash, path, fsize))
|
||||
// setup search flags according to hintflags
|
||||
uint32_t flags = 0;
|
||||
|
||||
if(findLocalFile(hash, flags, path, fsize))
|
||||
{
|
||||
/* fill in details */
|
||||
#ifdef DB_DEBUG
|
||||
|
|
@ -184,15 +187,16 @@ std::list<RsItem *> ftFiMonitor::saveList(bool &cleanup)
|
|||
#endif
|
||||
|
||||
/* get list of directories */
|
||||
std::list<std::string> dirList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
|
||||
getSharedDirectories(dirList);
|
||||
|
||||
for(it = dirList.begin(); it != dirList.end(); it++)
|
||||
{
|
||||
RsFileConfigItem *fi = new RsFileConfigItem();
|
||||
fi->file.path = *it;
|
||||
fi->file.path = (*it).filename ;
|
||||
fi->flags = (*it).shareflags ;
|
||||
|
||||
sList.push_back(fi);
|
||||
}
|
||||
|
|
@ -214,7 +218,7 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
|
||||
time_t ts = time(NULL);
|
||||
|
||||
std::list<std::string> dirList;
|
||||
std::list<SharedDirInfo> dirList;
|
||||
|
||||
std::list<RsItem *>::iterator it;
|
||||
for(it = load.begin(); it != load.end(); it++)
|
||||
|
|
@ -228,7 +232,11 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
|
||||
/* ensure that it exists? */
|
||||
|
||||
dirList.push_back(fi->file.path);
|
||||
SharedDirInfo info ;
|
||||
info.filename = fi->file.path;
|
||||
info.shareflags = fi->flags & (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE) ;
|
||||
|
||||
dirList.push_back(info) ;
|
||||
}
|
||||
|
||||
/* set directories */
|
||||
|
|
@ -236,7 +244,15 @@ bool ftFiMonitor::loadList(std::list<RsItem *> load)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ftFiMonitor::setSharedDirectories(std::list<std::string> dirList)
|
||||
void ftFiMonitor::updateShareFlags(const SharedDirInfo& info)
|
||||
{
|
||||
FileIndexMonitor::updateShareFlags(info);
|
||||
|
||||
/* flag for config */
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
void ftFiMonitor::setSharedDirectories(std::list<SharedDirInfo> dirList)
|
||||
{
|
||||
FileIndexMonitor::setSharedDirectories(dirList);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue