-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4722d70..e2a6cad 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -240,298 +240,298 @@ OpieFtp::OpieFtp( ) | |||
240 | currentPathEdit->setText( currentDir.canonicalPath()); | 240 | currentPathEdit->setText( currentDir.canonicalPath()); |
241 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 241 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); |
242 | 242 | ||
243 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 243 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
244 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 244 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
245 | 245 | ||
246 | serverComboSelected(0); | 246 | serverComboSelected(0); |
247 | fillCombos(); | 247 | fillCombos(); |
248 | 248 | ||
249 | #ifdef DEVELOPERS_VERSION | 249 | #ifdef DEVELOPERS_VERSION |
250 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 250 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); |
251 | UsernameComboBox->lineEdit()->setText("root"); | 251 | UsernameComboBox->lineEdit()->setText("root"); |
252 | PortSpinBox->setValue( 4242); | 252 | PortSpinBox->setValue( 4242); |
253 | remotePath->setText( currentRemoteDir = "/"); | 253 | remotePath->setText( currentRemoteDir = "/"); |
254 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 254 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); |
255 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | 255 | // UsernameComboBox->lineEdit()->setText("llornkcor"); |
256 | // PortSpinBox->setValue( 21); | 256 | // PortSpinBox->setValue( 21); |
257 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); | 257 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); |
258 | PasswordEdit->setText( tr( "" ) ); | 258 | PasswordEdit->setText( tr( "" ) ); |
259 | #endif | 259 | #endif |
260 | filterStr="*"; | 260 | filterStr="*"; |
261 | b=FALSE; | 261 | b=FALSE; |
262 | populateLocalView(); | 262 | populateLocalView(); |
263 | TabWidget->setCurrentPage(2); | 263 | TabWidget->setCurrentPage(2); |
264 | } | 264 | } |
265 | 265 | ||
266 | OpieFtp::~OpieFtp() | 266 | OpieFtp::~OpieFtp() |
267 | { | 267 | { |
268 | } | 268 | } |
269 | 269 | ||
270 | void OpieFtp::cleanUp() | 270 | void OpieFtp::cleanUp() |
271 | { | 271 | { |
272 | if(conn) | 272 | if(conn) |
273 | FtpQuit(conn); | 273 | FtpQuit(conn); |
274 | QString sfile=QDir::homeDirPath(); | 274 | QString sfile=QDir::homeDirPath(); |
275 | if(sfile.right(1) != "/") | 275 | if(sfile.right(1) != "/") |
276 | sfile+="/._temp"; | 276 | sfile+="/._temp"; |
277 | else | 277 | else |
278 | sfile+="._temp"; | 278 | sfile+="._temp"; |
279 | QFile file( sfile); | 279 | QFile file( sfile); |
280 | if(file.exists()) | 280 | if(file.exists()) |
281 | file.remove(); | 281 | file.remove(); |
282 | } | 282 | } |
283 | 283 | ||
284 | void OpieFtp::tabChanged(QWidget *w) | 284 | void OpieFtp::tabChanged(QWidget *w) |
285 | { | 285 | { |
286 | if (TabWidget->currentPageIndex() == 0) { | 286 | if (TabWidget->currentPageIndex() == 0) { |
287 | currentPathEdit->setText( currentDir.canonicalPath()); | 287 | currentPathEdit->setText( currentDir.canonicalPath()); |
288 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); | 288 | tabMenu->setItemChecked(tabMenu->idAt(0),TRUE); |
289 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 289 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
290 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 290 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
291 | } | 291 | } |
292 | if (TabWidget->currentPageIndex() == 1) { | 292 | if (TabWidget->currentPageIndex() == 1) { |
293 | currentPathEdit->setText( currentRemoteDir ); | 293 | currentPathEdit->setText( currentRemoteDir ); |
294 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); | 294 | tabMenu->setItemChecked(tabMenu->idAt(1),TRUE); |
295 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 295 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
296 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); | 296 | tabMenu->setItemChecked(tabMenu->idAt(2),FALSE); |
297 | } | 297 | } |
298 | if (TabWidget->currentPageIndex() == 2) { | 298 | if (TabWidget->currentPageIndex() == 2) { |
299 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); | 299 | tabMenu->setItemChecked(tabMenu->idAt(2),TRUE); |
300 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); | 300 | tabMenu->setItemChecked(tabMenu->idAt(0),FALSE); |
301 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); | 301 | tabMenu->setItemChecked(tabMenu->idAt(1),FALSE); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | 304 | ||
305 | void OpieFtp::newConnection() | 305 | void OpieFtp::newConnection() |
306 | { | 306 | { |
307 | UsernameComboBox->lineEdit()->setText(""); | 307 | UsernameComboBox->lineEdit()->setText(""); |
308 | PasswordEdit->setText( "" ); | 308 | PasswordEdit->setText( "" ); |
309 | ServerComboBox->lineEdit()->setText( ""); | 309 | ServerComboBox->lineEdit()->setText( ""); |
310 | remotePath->setText( currentRemoteDir = "/"); | 310 | remotePath->setText( currentRemoteDir = "/"); |
311 | PortSpinBox->setValue( 21); | 311 | PortSpinBox->setValue( 21); |
312 | TabWidget->setCurrentPage(2); | 312 | TabWidget->setCurrentPage(2); |
313 | currentServerConfig = -1; | 313 | currentServerConfig = -1; |
314 | } | 314 | } |
315 | 315 | ||
316 | void OpieFtp::serverComboEdited(const QString & edit) { | 316 | void OpieFtp::serverComboEdited(const QString & edit) { |
317 | if( !edit.isEmpty() ) { | 317 | if( !edit.isEmpty() ) { |
318 | currentServerConfig = -1; | 318 | currentServerConfig = -1; |
319 | qDebug("comboedited"); | 319 | qDebug("comboedited"); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | void OpieFtp::connectorBtnToggled(bool On) | 323 | void OpieFtp::connectorBtnToggled(bool On) |
324 | { | 324 | { |
325 | if(On) { | 325 | if(On) { |
326 | connector(); | 326 | connector(); |
327 | } else { | 327 | } else { |
328 | disConnector(); | 328 | disConnector(); |
329 | } | 329 | } |
330 | 330 | ||
331 | } | 331 | } |
332 | 332 | ||
333 | void OpieFtp::connector() | 333 | void OpieFtp::connector() |
334 | { | 334 | { |
335 | QCopEnvelope ( "QPE/System", "busy()" ); | 335 | QCopEnvelope ( "QPE/System", "busy()" ); |
336 | qApp->processEvents(); | 336 | // qApp->processEvents(); |
337 | currentRemoteDir=remotePath->text(); | 337 | currentRemoteDir=remotePath->text(); |
338 | if(ServerComboBox->currentText().isEmpty()) { | 338 | if(ServerComboBox->currentText().isEmpty()) { |
339 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 339 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
340 | TabWidget->setCurrentPage(2); | 340 | TabWidget->setCurrentPage(2); |
341 | ServerComboBox->setFocus(); | 341 | ServerComboBox->setFocus(); |
342 | connectServerBtn->setOn(FALSE); | 342 | connectServerBtn->setOn(FALSE); |
343 | connectServerBtn->setText( tr("Connect")); | 343 | connectServerBtn->setText( tr("Connect")); |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | FtpInit(); | 346 | FtpInit(); |
347 | TabWidget->setCurrentPage(1); | 347 | TabWidget->setCurrentPage(1); |
348 | QString ftp_host = ServerComboBox->currentText(); | 348 | QString ftp_host = ServerComboBox->currentText(); |
349 | QString ftp_user = UsernameComboBox->currentText(); | 349 | QString ftp_user = UsernameComboBox->currentText(); |
350 | QString ftp_pass = PasswordEdit->text(); | 350 | QString ftp_pass = PasswordEdit->text(); |
351 | QString port=PortSpinBox->cleanText(); | 351 | QString port=PortSpinBox->cleanText(); |
352 | port.stripWhiteSpace(); | 352 | port.stripWhiteSpace(); |
353 | 353 | ||
354 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 354 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
355 | ftp_host=ftp_host.right(ftp_host.length()-6); | 355 | ftp_host=ftp_host.right(ftp_host.length()-6); |
356 | ftp_host+=":"+port; | 356 | ftp_host+=":"+port; |
357 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 357 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
358 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | 358 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); |
359 | connectServerBtn->setOn(FALSE); | 359 | connectServerBtn->setOn(FALSE); |
360 | connectServerBtn->setText( tr("Connect")); | 360 | connectServerBtn->setText( tr("Connect")); |
361 | return ; | 361 | return ; |
362 | } | 362 | } |
363 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 363 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
364 | QString msg; | 364 | QString msg; |
365 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 365 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
366 | msg.replace(QRegExp(":"),"\n"); | 366 | msg.replace(QRegExp(":"),"\n"); |
367 | QMessageBox::message(tr("Note"),msg); | 367 | QMessageBox::message(tr("Note"),msg); |
368 | if(conn) | 368 | if(conn) |
369 | FtpQuit(conn); | 369 | FtpQuit(conn); |
370 | connectServerBtn->setOn(FALSE); | 370 | connectServerBtn->setOn(FALSE); |
371 | connectServerBtn->setText( tr("Connect")); | 371 | connectServerBtn->setText( tr("Connect")); |
372 | return ; | 372 | return ; |
373 | } | 373 | } |
374 | remoteDirList("/") ; | 374 | remoteDirList("/") ; |
375 | setCaption(ftp_host); | 375 | setCaption(ftp_host); |
376 | writeConfig(); | 376 | writeConfig(); |
377 | connectServerBtn->setText( tr("Disconnect")); | 377 | connectServerBtn->setText( tr("Disconnect")); |
378 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 378 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
379 | } | 379 | } |
380 | 380 | ||
381 | void OpieFtp::disConnector() | 381 | void OpieFtp::disConnector() |
382 | { | 382 | { |
383 | if(conn) | 383 | if(conn) |
384 | FtpQuit(conn); | 384 | FtpQuit(conn); |
385 | setCaption("OpieFtp"); | 385 | setCaption("OpieFtp"); |
386 | currentRemoteDir="/"; | 386 | currentRemoteDir="/"; |
387 | Remote_View->clear(); | 387 | Remote_View->clear(); |
388 | connectServerBtn->setText( tr("Connect")); | 388 | connectServerBtn->setText( tr("Connect")); |
389 | connectServerBtn->setOn(FALSE); | 389 | connectServerBtn->setOn(FALSE); |
390 | 390 | ||
391 | } | 391 | } |
392 | 392 | ||
393 | void OpieFtp::localUpload() | 393 | void OpieFtp::localUpload() |
394 | { | 394 | { |
395 | int fsz; | 395 | int fsz; |
396 | QCopEnvelope ( "QPE/System", "busy()" ); | 396 | QCopEnvelope ( "QPE/System", "busy()" ); |
397 | qApp->processEvents(); | 397 | // qApp->processEvents(); |
398 | QString strItem = Local_View->currentItem()->text(0); | 398 | QString strItem = Local_View->currentItem()->text(0); |
399 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 399 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
400 | QString remoteFile= currentRemoteDir+strItem; | 400 | QString remoteFile= currentRemoteDir+strItem; |
401 | QFileInfo fi(localFile); | 401 | QFileInfo fi(localFile); |
402 | if( !fi.isDir()) { | 402 | if( !fi.isDir()) { |
403 | fsz=fi.size(); | 403 | fsz=fi.size(); |
404 | ProgressBar->setTotalSteps(fsz); | 404 | ProgressBar->setTotalSteps(fsz); |
405 | 405 | ||
406 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 406 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
407 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 407 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
408 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 408 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
409 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 409 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
410 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 410 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
411 | 411 | ||
412 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 412 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
413 | QString msg; | 413 | QString msg; |
414 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 414 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
415 | msg.replace(QRegExp(":"),"\n"); | 415 | msg.replace(QRegExp(":"),"\n"); |
416 | QMessageBox::message(tr("Note"),msg); | 416 | QMessageBox::message(tr("Note"),msg); |
417 | } | 417 | } |
418 | ProgressBar->reset(); | 418 | ProgressBar->reset(); |
419 | nullifyCallBack(); | 419 | nullifyCallBack(); |
420 | } else { | 420 | } else { |
421 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 421 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
422 | } | 422 | } |
423 | TabWidget->setCurrentPage(1); | 423 | TabWidget->setCurrentPage(1); |
424 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 424 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
425 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 425 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
426 | } | 426 | } |
427 | 427 | ||
428 | void OpieFtp::nullifyCallBack() | 428 | void OpieFtp::nullifyCallBack() |
429 | { | 429 | { |
430 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); | 430 | FtpOptions(FTPLIB_CALLBACK, NULL, conn); |
431 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 431 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
432 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 432 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
433 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 433 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
434 | 434 | ||
435 | } | 435 | } |
436 | 436 | ||
437 | void OpieFtp::remoteDownload() | 437 | void OpieFtp::remoteDownload() |
438 | { | 438 | { |
439 | // qApp->processEvents(); | ||
439 | int fsz; | 440 | int fsz; |
440 | QCopEnvelope ( "QPE/System", "busy()" ); | 441 | QCopEnvelope ( "QPE/System", "busy()" ); |
441 | qApp->processEvents(); | ||
442 | QString strItem = Remote_View->currentItem()->text(0); | 442 | QString strItem = Remote_View->currentItem()->text(0); |
443 | // strItem=strItem.right(strItem.length()-1); | 443 | // strItem=strItem.right(strItem.length()-1); |
444 | 444 | ||
445 | QString localFile = currentDir.canonicalPath(); | 445 | QString localFile = currentDir.canonicalPath(); |
446 | if(localFile.right(1).find("/",0,TRUE) == -1) | 446 | if(localFile.right(1).find("/",0,TRUE) == -1) |
447 | localFile += "/"; | 447 | localFile += "/"; |
448 | localFile += strItem; | 448 | localFile += strItem; |
449 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 449 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
450 | QString remoteFile= currentRemoteDir+strItem; | 450 | QString remoteFile= currentRemoteDir+strItem; |
451 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 451 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
452 | fsz = 0; | 452 | fsz = 0; |
453 | QString temp; | 453 | QString temp; |
454 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 454 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
455 | 455 | ||
456 | ProgressBar->setTotalSteps(fsz); | 456 | ProgressBar->setTotalSteps(fsz); |
457 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 457 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
458 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 458 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
459 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 459 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
460 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 460 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
461 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 461 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
462 | 462 | ||
463 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 463 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
464 | QString msg; | 464 | QString msg; |
465 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 465 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
466 | msg.replace(QRegExp(":"),"\n"); | 466 | msg.replace(QRegExp(":"),"\n"); |
467 | QMessageBox::message(tr("Note"),msg); | 467 | QMessageBox::message(tr("Note"),msg); |
468 | } | 468 | } |
469 | ProgressBar->reset(); | 469 | ProgressBar->reset(); |
470 | nullifyCallBack(); | 470 | nullifyCallBack(); |
471 | TabWidget->setCurrentPage(0); | 471 | TabWidget->setCurrentPage(0); |
472 | populateLocalView(); | 472 | populateLocalView(); |
473 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 473 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
474 | } | 474 | } |
475 | 475 | ||
476 | bool OpieFtp::remoteDirList(const QString &dir) | 476 | bool OpieFtp::remoteDirList(const QString &dir) |
477 | { | 477 | { |
478 | QString tmp = QDir::homeDirPath(); | 478 | QString tmp = QDir::homeDirPath(); |
479 | if(tmp.right(1) != "/") | 479 | if(tmp.right(1) != "/") |
480 | tmp+="/._temp"; | 480 | tmp+="/._temp"; |
481 | else | 481 | else |
482 | tmp+="._temp"; | 482 | tmp+="._temp"; |
483 | // qDebug("Listing remote dir "+tmp); | 483 | // qDebug("Listing remote dir "+tmp); |
484 | QCopEnvelope ( "QPE/System", "busy()" ); | 484 | QCopEnvelope ( "QPE/System", "busy()" ); |
485 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 485 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
486 | QString msg; | 486 | QString msg; |
487 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 487 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
488 | msg.replace(QRegExp(":"),"\n"); | 488 | msg.replace(QRegExp(":"),"\n"); |
489 | QMessageBox::message(tr("Note"),msg); | 489 | QMessageBox::message(tr("Note"),msg); |
490 | return false; | 490 | return false; |
491 | } | 491 | } |
492 | populateRemoteView() ; | 492 | populateRemoteView() ; |
493 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 493 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
494 | return true; | 494 | return true; |
495 | } | 495 | } |
496 | 496 | ||
497 | bool OpieFtp::remoteChDir(const QString &dir) | 497 | bool OpieFtp::remoteChDir(const QString &dir) |
498 | { | 498 | { |
499 | QCopEnvelope ( "QPE/System", "busy()" ); | 499 | QCopEnvelope ( "QPE/System", "busy()" ); |
500 | if (!FtpChdir( dir.latin1(), conn )) { | 500 | if (!FtpChdir( dir.latin1(), conn )) { |
501 | QString msg; | 501 | QString msg; |
502 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 502 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
503 | msg.replace(QRegExp(":"),"\n"); | 503 | msg.replace(QRegExp(":"),"\n"); |
504 | QMessageBox::message(tr("Note"),msg); | 504 | QMessageBox::message(tr("Note"),msg); |
505 | qDebug(msg); | 505 | qDebug(msg); |
506 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 506 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
507 | return FALSE; | 507 | return FALSE; |
508 | } | 508 | } |
509 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 509 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
510 | return TRUE; | 510 | return TRUE; |
511 | } | 511 | } |
512 | 512 | ||
513 | void OpieFtp::populateLocalView() | 513 | void OpieFtp::populateLocalView() |
514 | { | 514 | { |
515 | Local_View->clear(); | 515 | Local_View->clear(); |
516 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 516 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
517 | currentDir.setMatchAllDirs(TRUE); | 517 | currentDir.setMatchAllDirs(TRUE); |
518 | currentDir.setNameFilter(filterStr); | 518 | currentDir.setNameFilter(filterStr); |
519 | QString fileL, fileS, fileDate; | 519 | QString fileL, fileS, fileDate; |
520 | bool isDir=FALSE; | 520 | bool isDir=FALSE; |
521 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 521 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
522 | QFileInfoListIterator it(*list); | 522 | QFileInfoListIterator it(*list); |
523 | QFileInfo *fi; | 523 | QFileInfo *fi; |
524 | while ( (fi=it.current()) ) { | 524 | while ( (fi=it.current()) ) { |
525 | if (fi->isSymLink() ){ | 525 | if (fi->isSymLink() ){ |
526 | QString symLink=fi->readLink(); | 526 | QString symLink=fi->readLink(); |
527 | // qDebug("Symlink detected "+symLink); | 527 | // qDebug("Symlink detected "+symLink); |
528 | QFileInfo sym( symLink); | 528 | QFileInfo sym( symLink); |
529 | fileS.sprintf( "%10li", sym.size() ); | 529 | fileS.sprintf( "%10li", sym.size() ); |
530 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 530 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); |
531 | fileDate = sym.lastModified().toString(); | 531 | fileDate = sym.lastModified().toString(); |
532 | } else { | 532 | } else { |
533 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 533 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
534 | fileS.sprintf( "%10li", fi->size() ); | 534 | fileS.sprintf( "%10li", fi->size() ); |
535 | fileL.sprintf( "%s",fi->fileName().data() ); | 535 | fileL.sprintf( "%s",fi->fileName().data() ); |
536 | fileDate= fi->lastModified().toString(); | 536 | fileDate= fi->lastModified().toString(); |
537 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 537 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |