| 290 | |
| 291 | |
| 292 | void 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 | |
| 323 | void ftpThread::remove(QString source) |