author | llornkcor <llornkcor> | 2002-03-20 23:58:17 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-20 23:58:17 (UTC) |
commit | e8f15a98c611b0c6030e8210672b249b42107526 (patch) (unidiff) | |
tree | b36e786dedd13a959cbae0cf6ee934a7fd373047 | |
parent | a766295804d76f06a7e47b1d5e02dd5a59676c7d (diff) | |
download | opie-e8f15a98c611b0c6030e8210672b249b42107526.zip opie-e8f15a98c611b0c6030e8210672b249b42107526.tar.gz opie-e8f15a98c611b0c6030e8210672b249b42107526.tar.bz2 |
fixed problem with remote download
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index f1b159c..6e9dc67 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -289,97 +289,100 @@ void OpieFtp::localUpload() | |||
289 | QString strItem = Local_View->currentItem()->text(0); | 289 | QString strItem = Local_View->currentItem()->text(0); |
290 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 290 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
291 | QString remoteFile= currentRemoteDir+strItem; | 291 | QString remoteFile= currentRemoteDir+strItem; |
292 | QFileInfo fi(localFile); | 292 | QFileInfo fi(localFile); |
293 | if( !fi.isDir()) { | 293 | if( !fi.isDir()) { |
294 | fsz=fi.size(); | 294 | fsz=fi.size(); |
295 | ProgressBar->setTotalSteps(fsz); | 295 | ProgressBar->setTotalSteps(fsz); |
296 | 296 | ||
297 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 297 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
298 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 298 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
299 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 299 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
300 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 300 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
301 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 301 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
302 | 302 | ||
303 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 303 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
304 | QString msg; | 304 | QString msg; |
305 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 305 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
306 | msg.replace(QRegExp(":"),"\n"); | 306 | msg.replace(QRegExp(":"),"\n"); |
307 | QMessageBox::message(tr("Note"),msg); | 307 | QMessageBox::message(tr("Note"),msg); |
308 | // FtpQuit(conn); | 308 | // FtpQuit(conn); |
309 | } | 309 | } |
310 | ProgressBar->reset(); | 310 | ProgressBar->reset(); |
311 | nullifyCallBack(); | 311 | nullifyCallBack(); |
312 | } else { | 312 | } else { |
313 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 313 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
314 | } | 314 | } |
315 | TabWidget->setCurrentPage(1); | 315 | TabWidget->setCurrentPage(1); |
316 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 316 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
317 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 317 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
318 | } | 318 | } |
319 | 319 | ||
320 | void OpieFtp::nullifyCallBack() | 320 | void OpieFtp::nullifyCallBack() |
321 | { | 321 | { |
322 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 322 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
323 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 323 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
324 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 324 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
325 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 325 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
326 | 326 | ||
327 | } | 327 | } |
328 | 328 | ||
329 | void OpieFtp::remoteDownload() | 329 | void OpieFtp::remoteDownload() |
330 | { | 330 | { |
331 | int fsz; | 331 | int fsz; |
332 | QCopEnvelope ( "QPE/System", "busy()" ); | 332 | QCopEnvelope ( "QPE/System", "busy()" ); |
333 | qApp->processEvents(); | 333 | qApp->processEvents(); |
334 | QString strItem = Remote_View->currentItem()->text(0); | 334 | QString strItem = Remote_View->currentItem()->text(0); |
335 | // strItem=strItem.right(strItem.length()-1); | 335 | // strItem=strItem.right(strItem.length()-1); |
336 | 336 | ||
337 | QString localFile = currentDir.canonicalPath()+strItem; | 337 | QString localFile = currentDir.canonicalPath(); |
338 | if(localFile.right(1).find("/",0,TRUE) == -1) | ||
339 | localFile += "/"; | ||
340 | localFile += strItem; | ||
338 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 341 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
339 | QString remoteFile= currentRemoteDir+strItem; | 342 | QString remoteFile= currentRemoteDir+strItem; |
340 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 343 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
341 | fsz = 0; | 344 | fsz = 0; |
342 | QString temp; | 345 | QString temp; |
343 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 346 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
344 | 347 | ||
345 | ProgressBar->setTotalSteps(fsz); | 348 | ProgressBar->setTotalSteps(fsz); |
346 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 349 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
347 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 350 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
348 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 351 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
349 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 352 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
350 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 353 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
351 | 354 | ||
352 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 355 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
353 | QString msg; | 356 | QString msg; |
354 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 357 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
355 | msg.replace(QRegExp(":"),"\n"); | 358 | msg.replace(QRegExp(":"),"\n"); |
356 | QMessageBox::message(tr("Note"),msg); | 359 | QMessageBox::message(tr("Note"),msg); |
357 | // FtpQuit(conn); | 360 | // FtpQuit(conn); |
358 | } | 361 | } |
359 | ProgressBar->reset(); | 362 | ProgressBar->reset(); |
360 | nullifyCallBack(); | 363 | nullifyCallBack(); |
361 | TabWidget->setCurrentPage(0); | 364 | TabWidget->setCurrentPage(0); |
362 | populateLocalView(); | 365 | populateLocalView(); |
363 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 366 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
364 | } | 367 | } |
365 | 368 | ||
366 | 369 | ||
367 | void OpieFtp::newConnection() | 370 | void OpieFtp::newConnection() |
368 | { | 371 | { |
369 | TabWidget->setCurrentPage(2); | 372 | TabWidget->setCurrentPage(2); |
370 | } | 373 | } |
371 | 374 | ||
372 | void OpieFtp::connector() | 375 | void OpieFtp::connector() |
373 | { | 376 | { |
374 | QCopEnvelope ( "QPE/System", "busy()" ); | 377 | QCopEnvelope ( "QPE/System", "busy()" ); |
375 | qApp->processEvents(); | 378 | qApp->processEvents(); |
376 | currentRemoteDir=remotePath->text(); | 379 | currentRemoteDir=remotePath->text(); |
377 | if(ServerComboBox->currentText().isEmpty()) { | 380 | if(ServerComboBox->currentText().isEmpty()) { |
378 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 381 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
379 | TabWidget->setCurrentPage(2); | 382 | TabWidget->setCurrentPage(2); |
380 | ServerComboBox->setFocus(); | 383 | ServerComboBox->setFocus(); |
381 | return; | 384 | return; |
382 | } | 385 | } |
383 | FtpInit(); | 386 | FtpInit(); |
384 | TabWidget->setCurrentPage(1); | 387 | TabWidget->setCurrentPage(1); |
385 | QString ftp_host = ServerComboBox->currentText(); | 388 | QString ftp_host = ServerComboBox->currentText(); |