summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 151be84..e1dd582 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -400,97 +400,106 @@ void OpieFtp::populateLocalView()
400} 400}
401 401
402bool OpieFtp::populateRemoteView() 402bool OpieFtp::populateRemoteView()
403{ 403{
404 Remote_View->clear(); 404 Remote_View->clear();
405 QFile tmp("./._temp"); 405 QFile tmp("./._temp");
406 QString s, File_Name; 406 QString s, File_Name;
407 QString fileL, fileS, fileDate; 407 QString fileL, fileS, fileDate;
408 new QListViewItem( Remote_View, "../"); 408 new QListViewItem( Remote_View, "../");
409 if (tmp.open(IO_ReadOnly)) { 409 if (tmp.open(IO_ReadOnly)) {
410 QTextStream t( &tmp ); // use a text stream 410 QTextStream t( &tmp ); // use a text stream
411 while ( !t.eof()) { 411 while ( !t.eof()) {
412 s = t.readLine(); 412 s = t.readLine();
413 fileL = s.right(s.length()-55); 413 fileL = s.right(s.length()-55);
414 fileL = fileL.stripWhiteSpace(); 414 fileL = fileL.stripWhiteSpace();
415 if(s.left(1) == "d") 415 if(s.left(1) == "d")
416 fileL = fileL+"/"; 416 fileL = fileL+"/";
417 fileS = s.mid( 30, 42-30); 417 fileS = s.mid( 30, 42-30);
418 fileS = fileS.stripWhiteSpace(); 418 fileS = fileS.stripWhiteSpace();
419 fileDate = s.mid( 42, 55-42); 419 fileDate = s.mid( 42, 55-42);
420 fileDate = fileDate.stripWhiteSpace(); 420 fileDate = fileDate.stripWhiteSpace();
421 if(fileL.find("total",0,TRUE) == -1) 421 if(fileL.find("total",0,TRUE) == -1)
422 new QListViewItem( Remote_View, fileL, fileS, fileDate); 422 new QListViewItem( Remote_View, fileL, fileS, fileDate);
423 } 423 }
424 tmp.close(); 424 tmp.close();
425 } 425 }
426 return true; 426 return true;
427} 427}
428 428
429void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 429void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
430{ 430{
431 QCopEnvelope ( "QPE/System", "busy()" ); 431 QCopEnvelope ( "QPE/System", "busy()" );
432 QString strItem=selectedItem->text(0); 432 QString strItem=selectedItem->text(0);
433 strItem=strItem.simplifyWhiteSpace(); 433 strItem=strItem.simplifyWhiteSpace();
434 if(strItem == "../") { 434 if(strItem == "../") {
435 if( FtpCDUp( conn) == 0) { 435 if( FtpCDUp( conn) == 0) {
436 QString msg; 436 QString msg;
437 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); 437 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn));
438 QMessageBox::message("Note",msg); 438 QMessageBox::message("Note",msg);
439 } 439 }
440 char path[256]; 440 char path[256];
441 if( FtpPwd( path,sizeof(path),conn) == 0) { 441 if( FtpPwd( path,sizeof(path),conn) == 0) {
442 QString msg; 442 QString msg;
443 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn)); 443 msg.sprintf("Unable to get working dir\n%s",FtpLastResponse(conn));
444 QMessageBox::message("Note",msg); 444 QMessageBox::message("Note",msg);
445 } 445 }
446 currentRemoteDir=path; 446 currentRemoteDir=path;
447 } else { 447 } else {
448 if(strItem.find("/",0,TRUE) != -1) { 448 if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
449 strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE)-3 );
450 strItem = strItem.stripWhiteSpace();
451 currentRemoteDir = strItem;
452 if( remoteChDir( (const QString &)strItem) ==0) {
453 QString msg;
454 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn));
455 QMessageBox::message("Note",msg);
456 }
457 } else if(strItem.find("/",0,TRUE) != -1) {
449 if( remoteChDir( (const QString &)currentRemoteDir+strItem) ==0) { 458 if( remoteChDir( (const QString &)currentRemoteDir+strItem) ==0) {
450 QString msg; 459 QString msg;
451 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn)); 460 msg.sprintf("Unable to change directories \n%s",FtpLastResponse(conn));
452 QMessageBox::message("Note",msg); 461 QMessageBox::message("Note",msg);
453 } 462 }
454 currentRemoteDir = currentRemoteDir+strItem; 463 currentRemoteDir = currentRemoteDir+strItem;
455 } else { 464 } else {
456 qDebug("download "+strItem); 465 qDebug("download "+strItem);
457 } 466 }
458 } 467 }
459 if(currentRemoteDir.right(1) !="/") 468 if(currentRemoteDir.right(1) !="/")
460 currentRemoteDir +="/"; 469 currentRemoteDir +="/";
461 currentPathEdit->setText( currentRemoteDir ); 470 currentPathEdit->setText( currentRemoteDir );
462 remoteDirList( (const QString &)currentRemoteDir); 471 remoteDirList( (const QString &)currentRemoteDir);
463 QCopEnvelope ( "QPE/System", "notBusy()" ); 472 QCopEnvelope ( "QPE/System", "notBusy()" );
464} 473}
465 474
466 void OpieFtp::localListClicked(QListViewItem *selectedItem) 475 void OpieFtp::localListClicked(QListViewItem *selectedItem)
467{ 476{
468 QString strItem=selectedItem->text(0); 477 QString strItem=selectedItem->text(0);
469 QString strSize=selectedItem->text(1); 478 QString strSize=selectedItem->text(1);
470 strSize=strSize.stripWhiteSpace(); 479 strSize=strSize.stripWhiteSpace();
471 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 480 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
472 // is symlink 481 // is symlink
473 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4); 482 QString strItem2=strItem.right( (strItem.length()-strItem.find("->",0,TRUE)) -4);
474 if(QDir(strItem2).exists() ) { 483 if(QDir(strItem2).exists() ) {
475 currentDir.cd(strItem2, TRUE); 484 currentDir.cd(strItem2, TRUE);
476 populateLocalView(); 485 populateLocalView();
477 } 486 }
478 } else { // not a symlink 487 } else { // not a symlink
479 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { 488 if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
480 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { 489 if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
481 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 490 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
482 currentDir.cd(strItem,FALSE); 491 currentDir.cd(strItem,FALSE);
483 populateLocalView(); 492 populateLocalView();
484 } else { 493 } else {
485 currentDir.cdUp(); 494 currentDir.cdUp();
486 populateLocalView(); 495 populateLocalView();
487 } 496 }
488 if(QDir(strItem).exists()){ 497 if(QDir(strItem).exists()){
489 currentDir.cd(strItem, TRUE); 498 currentDir.cd(strItem, TRUE);
490 populateLocalView(); 499 populateLocalView();
491 } 500 }
492 } else { 501 } else {
493 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 502 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
494 if( QFile::exists(strItem ) ) { 503 if( QFile::exists(strItem ) ) {
495 qDebug("upload "+strItem); 504 qDebug("upload "+strItem);
496 } 505 }