- Allow dragging one file from Windows (server) to Mac (client), --filetransfer-des needs to be specified in client side's command line.

This commit is contained in:
jerry 2013-08-23 15:36:23 +00:00
parent 012fe6ddd8
commit 031a84ca84
17 changed files with 95 additions and 23 deletions

View file

@ -85,6 +85,10 @@ CClient::CClient(IEventQueue* events,
this,
new TMethodEventJob<CClient>(this,
&CClient::handleFileChunkSending));
m_events->adoptHandler(m_events->forIScreen().fileRecieveComplete(),
this,
new TMethodEventJob<CClient>(this,
&CClient::handleFileRecieveComplete));
}
CClient::~CClient()
@ -706,6 +710,29 @@ CClient::handleFileChunkSending(const CEvent& event, void*)
sendFileChunk(event.getData());
}
void
CClient::handleFileRecieveComplete(const CEvent& event, void*)
{
onFileRecieveComplete();
}
void
CClient::onFileRecieveComplete()
{
if (isReceivedFileSizeValid()) {
if (!m_fileTransferDes.empty()) {
std::fstream file;
file.open(m_fileTransferDes.c_str(), std::ios::out | std::ios::binary);
if (!file.is_open()) {
// TODO: file open failed
}
file.write(m_receivedFileData.c_str(), m_receivedFileData.size());
file.close();
}
}
}
void
CClient::clearReceivedFileData()
{