MCPcopy Create free account
hub / github.com/ON4QZ/QSSTV / downloadFile

Method downloadFile

src/utils/ftpthread.cpp:292–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290
291
292void ftpThread::downloadFile(QString source,QString destination)
293{
294 addToLog("FTP downloadFile",LOGFTPTHREAD);
295 if(destFn) delete destFn;
296 destFn=new QFile(destination);
297 if(!destFn->open(QIODevice::WriteOnly))
298 {
299 addToLog(QString("Can't open %1 for writing").arg(destination),LOGFTPTHREAD);
300 lastError=FTPERROR;
301 lastErrorStr=QString("Can't open %1 for writing").arg(destination);
302 destroy();
303 emit commandsDone((int)lastError,lastErrorStr);
304 return;
305 }
306 if (source.isNull() )
307 {
308 addToLog("Invalid source",LOGFTPTHREAD);
309 lastError=FTPERROR;
310 lastErrorStr="Invalid source";
311 destroy();
312 emit commandsDone((int)lastError,lastErrorStr);
313 return;
314 }
315 ftpDone=false;
316 doConnect();
317 addToLog(QString("'%1' get '%2' destination '%3'").arg(idName).arg(source).arg(destination),LOGFTPTHREAD);
318 qftpPtr->get( source, destFn,QFtp::Binary);
319 addToLog(QString("FTP file: %1 bytes: %2").arg(destination).arg(destFn->size()),LOGFTPTHREAD);
320}
321
322
323void ftpThread::remove(QString source)

Callers 1

saveImageMethod · 0.45

Calls 3

openMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected