mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 07:59:29 -05:00
added file moving utility to rsFile interface to channels file save consistent
msgs now save from field in received msgs also allowed user to delete file added in createChanMsg dialog git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3727 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6d173b7c8e
commit
618cc702a8
@ -571,6 +571,13 @@ bool ftServer::InDirectoryCheck()
|
||||
return mFiMon->inDirectoryCheck();
|
||||
}
|
||||
|
||||
bool ftServer::CopyFile(const std::string& source, const std::string& dest)
|
||||
{
|
||||
|
||||
mFtController->copyFile(source, dest);
|
||||
|
||||
}
|
||||
|
||||
bool ftServer::getSharedDirectories(std::list<SharedDirInfo> &dirs)
|
||||
{
|
||||
mFiMon->getSharedDirectories(dirs);
|
||||
|
@ -181,6 +181,7 @@ virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint3
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath);
|
||||
virtual void ForceDirectoryCheck();
|
||||
virtual bool InDirectoryCheck();
|
||||
virtual bool CopyFile(const std::string& source, const std::string& dest);
|
||||
|
||||
/***
|
||||
* Directory Handling
|
||||
|
@ -170,6 +170,7 @@ class RsFiles
|
||||
virtual bool ConvertSharedFilePath(std::string path, std::string &fullpath) = 0;
|
||||
virtual void ForceDirectoryCheck() = 0;
|
||||
virtual bool InDirectoryCheck() = 0;
|
||||
virtual bool CopyFile(const std::string& source,const std::string& dest) = 0;
|
||||
|
||||
/***
|
||||
* Directory Control
|
||||
|
@ -169,6 +169,10 @@ int p3MsgService::incomingMsgs()
|
||||
}
|
||||
|
||||
imsg[mi->msgId] = mi;
|
||||
RsMsgSrcId* msi = new RsMsgSrcId();
|
||||
msi->msgId = mi->msgId;
|
||||
msi->srcId = mi->PeerId();
|
||||
mSrcIdList.push_back(msi);
|
||||
msgChanged.IndicateChanged();
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
@ -200,7 +204,6 @@ int p3MsgService::checkOutgoingMessages()
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
std::list<uint32_t> toErase;
|
||||
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
@ -281,8 +284,9 @@ std::list<RsItem*> p3MsgService::saveList(bool& cleanup)
|
||||
std::map<uint32_t, RsMsgItem *>::iterator mit;
|
||||
std::map<uint32_t, RsMsgTagType* >::iterator mit2;
|
||||
std::map<uint32_t, RsMsgTags* >::iterator mit3;
|
||||
std::list<RsMsgSrcId* >::iterator lit;
|
||||
|
||||
MsgTagType stdTags;
|
||||
MsgTagType stdTags;
|
||||
|
||||
cleanup = false;
|
||||
|
||||
@ -291,6 +295,10 @@ std::list<RsItem*> p3MsgService::saveList(bool& cleanup)
|
||||
for(mit = imsg.begin(); mit != imsg.end(); mit++)
|
||||
itemList.push_back(mit->second);
|
||||
|
||||
for(lit = mSrcIdList.begin(); lit != mSrcIdList.end(); lit++)
|
||||
itemList.push_back(*lit);
|
||||
|
||||
|
||||
for(mit = msgOutgoing.begin(); mit != msgOutgoing.end(); mit++)
|
||||
itemList.push_back(mit->second) ;
|
||||
|
||||
@ -362,11 +370,14 @@ bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
RsMsgItem *mitem;
|
||||
RsMsgTagType* mtt;
|
||||
RsMsgTags* mti;
|
||||
|
||||
RsMsgSrcId* msi;
|
||||
|
||||
std::list<RsMsgItem*> items;
|
||||
std::list<RsItem*>::iterator it;
|
||||
std::map<uint32_t, RsMsgTagType*>::iterator tagIt;
|
||||
std::map<uint32_t, std::string> srcIdMsgMap;
|
||||
std::map<uint32_t, std::string>::iterator srcIt;
|
||||
|
||||
|
||||
// load items and calculate next unique msgId
|
||||
for(it = load.begin(); it != load.end(); it++)
|
||||
@ -399,6 +410,11 @@ bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
{
|
||||
mMsgTags.insert(std::pair<uint32_t, RsMsgTags* >(mti->msgId, mti));
|
||||
}
|
||||
else if(NULL != (msi = dynamic_cast<RsMsgSrcId *>(*it)))
|
||||
{
|
||||
srcIdMsgMap.insert(std::pair<uint32_t, std::string>(msi->msgId, msi->srcId));
|
||||
mSrcIdList.push_back(msi); // does not need to be kept
|
||||
}
|
||||
}
|
||||
|
||||
// sort items into lists
|
||||
@ -428,6 +444,10 @@ bool p3MsgService::loadList(std::list<RsItem*> load)
|
||||
else
|
||||
{
|
||||
RsStackMutex stack(mMsgMtx); /********** STACK LOCKED MTX ******/
|
||||
srcIt = srcIdMsgMap.find(mitem->msgId);
|
||||
|
||||
if(srcIt != srcIdMsgMap.end())
|
||||
mitem->PeerId(srcIt->second);
|
||||
|
||||
imsg[mitem->msgId] = mitem;
|
||||
}
|
||||
|
@ -131,6 +131,9 @@ void initStandardTagTypes();
|
||||
Indicator msgChanged;
|
||||
uint32_t mMsgUniqueId;
|
||||
|
||||
// used delete msgSrcIds after config save
|
||||
std::list<RsMsgSrcId*> mSrcIdList;
|
||||
|
||||
std::string config_dir;
|
||||
};
|
||||
|
||||
|
@ -227,7 +227,7 @@ void SubFileItem::updateItemStatic()
|
||||
|
||||
playButton->setEnabled(false);
|
||||
downloadButton->setEnabled(false);
|
||||
cancelButton->setEnabled(false);
|
||||
cancelButton->setEnabled(true);
|
||||
|
||||
progressBar->setValue(0);
|
||||
filename = "[" + tr("EXTRA") + "] " + filename;
|
||||
@ -281,6 +281,7 @@ void SubFileItem::updateItemStatic()
|
||||
if (mMode == SFI_STATE_LOCAL)
|
||||
{
|
||||
saveButton->setEnabled(true);
|
||||
cancelButton->setEnabled(true); // channel files which are extra files are removed
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -538,9 +539,11 @@ void SubFileItem::cancel()
|
||||
mMode = SFI_STATE_ERROR;
|
||||
|
||||
/* Only occurs - if it is downloading */
|
||||
if (mType == SFI_TYPE_ATTACH)
|
||||
if ((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL))
|
||||
{
|
||||
hide();
|
||||
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA);
|
||||
mPath = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -624,6 +627,8 @@ void SubFileItem::save()
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
FileInfo fInfo;
|
||||
|
||||
if (mType == SFI_TYPE_CHANNEL)
|
||||
{
|
||||
/* only enable these function for Channels. */
|
||||
@ -639,7 +644,19 @@ void SubFileItem::save()
|
||||
|
||||
if (destpath != "")
|
||||
{
|
||||
rsFiles->ExtraFileMove(mFileName, mFileHash, mFileSize, destpath);
|
||||
bool copied = rsFiles->ExtraFileMove(mFileName, mFileHash, mFileSize, destpath);
|
||||
|
||||
// may be manually downloaded channel file
|
||||
if(!copied){
|
||||
rsFiles->FileDetails(mFileHash, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA, fInfo);
|
||||
|
||||
if(fInfo.path != "")
|
||||
{
|
||||
|
||||
destpath += "/" + fInfo.fname;
|
||||
rsFiles->CopyFile(fInfo.path, destpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -668,3 +685,4 @@ bool SubFileItem::isPlayable(bool &startable)
|
||||
|
||||
return visible;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user