-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 0b88a35..7ca3fff 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -513,193 +513,193 @@ void OpieFtp::remoteDownload() | |||
513 | for ( ; it.current(); ++it ) { | 513 | for ( ; it.current(); ++it ) { |
514 | if ( it.current()->isSelected() ) { | 514 | if ( it.current()->isSelected() ) { |
515 | QString strItem = it.current()->text(0); | 515 | QString strItem = it.current()->text(0); |
516 | // strItem=strItem.right(strItem.length()-1); | 516 | // strItem=strItem.right(strItem.length()-1); |
517 | QString localFile = currentDir.canonicalPath(); | 517 | QString localFile = currentDir.canonicalPath(); |
518 | if(localFile.right(1).find("/",0,TRUE) == -1) | 518 | if(localFile.right(1).find("/",0,TRUE) == -1) |
519 | localFile += "/"; | 519 | localFile += "/"; |
520 | localFile += strItem; | 520 | localFile += strItem; |
521 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 521 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
522 | QString remoteFile= currentRemoteDir+strItem; | 522 | QString remoteFile= currentRemoteDir+strItem; |
523 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 523 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
524 | fsz = 0; | 524 | fsz = 0; |
525 | QString temp; | 525 | QString temp; |
526 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 526 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
527 | 527 | ||
528 | ProgressBar->setTotalSteps(fsz); | 528 | ProgressBar->setTotalSteps(fsz); |
529 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 529 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
530 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 530 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
531 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 531 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
532 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 532 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
533 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 533 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
534 | 534 | ||
535 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 535 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
536 | QString msg; | 536 | QString msg; |
537 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 537 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
538 | msg.replace(QRegExp(":"),"\n"); | 538 | msg.replace(QRegExp(":"),"\n"); |
539 | QMessageBox::message(tr("Note"),msg); | 539 | QMessageBox::message(tr("Note"),msg); |
540 | } | 540 | } |
541 | ProgressBar->reset(); | 541 | ProgressBar->reset(); |
542 | nullifyCallBack(); | 542 | nullifyCallBack(); |
543 | it.current()->setSelected(FALSE); | 543 | it.current()->setSelected(FALSE); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | for ( ; it.current(); ++it ) { | 546 | for ( ; it.current(); ++it ) { |
547 | Remote_View->clearSelection(); | 547 | Remote_View->clearSelection(); |
548 | } | 548 | } |
549 | Remote_View->setFocus(); | 549 | Remote_View->setFocus(); |
550 | TabWidget->setCurrentPage(0); | 550 | TabWidget->setCurrentPage(0); |
551 | populateLocalView(); | 551 | populateLocalView(); |
552 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 552 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
553 | } | 553 | } |
554 | 554 | ||
555 | bool OpieFtp::remoteDirList(const QString &dir) | 555 | bool OpieFtp::remoteDirList(const QString &dir) |
556 | { | 556 | { |
557 | QString tmp = QDir::homeDirPath(); | 557 | QString tmp = QDir::homeDirPath(); |
558 | if(tmp.right(1) != "/") | 558 | if(tmp.right(1) != "/") |
559 | tmp+="/._temp"; | 559 | tmp+="/._temp"; |
560 | else | 560 | else |
561 | tmp+="._temp"; | 561 | tmp+="._temp"; |
562 | // qDebug("Listing remote dir "+tmp); | 562 | // qDebug("Listing remote dir "+tmp); |
563 | // QCopEnvelope ( "QPE/System", "busy()" ); | 563 | // QCopEnvelope ( "QPE/System", "busy()" ); |
564 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { | 564 | if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { |
565 | QString msg; | 565 | QString msg; |
566 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); | 566 | msg.sprintf(tr("Unable to list the directory\n")+dir+"\n%s",FtpLastResponse(conn) ); |
567 | msg.replace(QRegExp(":"),"\n"); | 567 | msg.replace(QRegExp(":"),"\n"); |
568 | QMessageBox::message(tr("Note"),msg); | 568 | QMessageBox::message(tr("Note"),msg); |
569 | return false; | 569 | return false; |
570 | } | 570 | } |
571 | populateRemoteView() ; | 571 | populateRemoteView() ; |
572 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 572 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
573 | return true; | 573 | return true; |
574 | } | 574 | } |
575 | 575 | ||
576 | bool OpieFtp::remoteChDir(const QString &dir) | 576 | bool OpieFtp::remoteChDir(const QString &dir) |
577 | { | 577 | { |
578 | // QCopEnvelope ( "QPE/System", "busy()" ); | 578 | // QCopEnvelope ( "QPE/System", "busy()" ); |
579 | if (!FtpChdir( dir.latin1(), conn )) { | 579 | if (!FtpChdir( dir.latin1(), conn )) { |
580 | QString msg; | 580 | QString msg; |
581 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); | 581 | msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); |
582 | msg.replace(QRegExp(":"),"\n"); | 582 | msg.replace(QRegExp(":"),"\n"); |
583 | QMessageBox::message(tr("Note"),msg); | 583 | QMessageBox::message(tr("Note"),msg); |
584 | // qDebug(msg); | 584 | // qDebug(msg); |
585 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 585 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
586 | return FALSE; | 586 | return FALSE; |
587 | } | 587 | } |
588 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 588 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
589 | return TRUE; | 589 | return TRUE; |
590 | } | 590 | } |
591 | 591 | ||
592 | void OpieFtp::populateLocalView() | 592 | void OpieFtp::populateLocalView() |
593 | { | 593 | { |
594 | Local_View->clear(); | 594 | Local_View->clear(); |
595 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 595 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
596 | currentDir.setMatchAllDirs(TRUE); | 596 | currentDir.setMatchAllDirs(TRUE); |
597 | currentDir.setNameFilter(filterStr); | 597 | currentDir.setNameFilter(filterStr); |
598 | QString fileL, fileS, fileDate; | 598 | QString fileL, fileS, fileDate; |
599 | bool isDir=FALSE; | 599 | bool isDir=FALSE; |
600 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 600 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
601 | QFileInfoListIterator it(*list); | 601 | QFileInfoListIterator it(*list); |
602 | QFileInfo *fi; | 602 | QFileInfo *fi; |
603 | while ( (fi=it.current()) ) { | 603 | while ( (fi=it.current()) ) { |
604 | if (fi->isSymLink() ){ | 604 | if (fi->isSymLink() ){ |
605 | QString symLink=fi->readLink(); | 605 | QString symLink=fi->readLink(); |
606 | // qDebug("Symlink detected "+symLink); | 606 | // qDebug("Symlink detected "+symLink); |
607 | QFileInfo sym( symLink); | 607 | QFileInfo sym( symLink); |
608 | fileS.sprintf( "%10li", sym.size() ); | 608 | fileS.sprintf( "%10li", sym.size() ); |
609 | fileL.sprintf( "%s -> %s", sym.fileName().data(),sym.absFilePath().data() ); | 609 | fileL.sprintf( "%s -> %s", fi->fileName().data(),sym.absFilePath().data() ); |
610 | fileDate = sym.lastModified().toString(); | 610 | fileDate = sym.lastModified().toString(); |
611 | } else { | 611 | } else { |
612 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 612 | // qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); |
613 | fileS.sprintf( "%10li", fi->size() ); | 613 | fileS.sprintf( "%10li", fi->size() ); |
614 | fileL.sprintf( "%s",fi->fileName().data() ); | 614 | fileL.sprintf( "%s",fi->fileName().data() ); |
615 | fileDate= fi->lastModified().toString(); | 615 | fileDate= fi->lastModified().toString(); |
616 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 616 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
617 | fileL+="/"; | 617 | fileL+="/"; |
618 | isDir=TRUE; | 618 | isDir=TRUE; |
619 | // qDebug( fileL); | 619 | // qDebug( fileL); |
620 | } | 620 | } |
621 | } | 621 | } |
622 | if(fileL !="./" && fi->exists()) { | 622 | if(fileL !="./" && fi->exists()) { |
623 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); | 623 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); |
624 | QPixmap pm; | 624 | QPixmap pm; |
625 | 625 | ||
626 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 626 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
627 | if( !QDir( fi->filePath() ).isReadable()) | 627 | if( !QDir( fi->filePath() ).isReadable()) |
628 | pm = Resource::loadPixmap( "lockedfolder" ); | 628 | pm = Resource::loadPixmap( "lockedfolder" ); |
629 | else | 629 | else |
630 | pm= Resource::loadPixmap( "folder" ); | 630 | pm= Resource::loadPixmap( "folder" ); |
631 | item->setPixmap( 0,pm ); | 631 | item->setPixmap( 0,pm ); |
632 | } else { | 632 | } else { |
633 | if( !fi->isReadable() ) | 633 | if( !fi->isReadable() ) |
634 | pm = Resource::loadPixmap( "locked" ); | 634 | pm = Resource::loadPixmap( "locked" ); |
635 | else { | 635 | else { |
636 | MimeType mt(fi->filePath()); | 636 | MimeType mt(fi->filePath()); |
637 | pm=mt.pixmap(); //sets the correct pixmap for mimetype | 637 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
638 | if(pm.isNull()) | 638 | if(pm.isNull()) |
639 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 639 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
640 | item->setPixmap( 0,pm); | 640 | item->setPixmap( 0,pm); |
641 | } | 641 | } |
642 | } | 642 | } |
643 | if( fileL.find("->",0,TRUE) != -1) { | 643 | if( fileL.find("->",0,TRUE) != -1) { |
644 | // overlay link image | 644 | // overlay link image |
645 | pm= Resource::loadPixmap( "folder" ); | 645 | pm= Resource::loadPixmap( "folder" ); |
646 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 646 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
647 | QPainter painter( &pm ); | 647 | QPainter painter( &pm ); |
648 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 648 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
649 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 649 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
650 | item->setPixmap( 0, pm); | 650 | item->setPixmap( 0, pm); |
651 | } | 651 | } |
652 | } | 652 | } |
653 | isDir=FALSE; | 653 | isDir=FALSE; |
654 | ++it; | 654 | ++it; |
655 | } | 655 | } |
656 | Local_View->setSorting( 3,FALSE); | 656 | Local_View->setSorting( 3,FALSE); |
657 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 657 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
658 | fillCombo( (const QString &)currentDir); | 658 | fillCombo( (const QString &)currentDir); |
659 | } | 659 | } |
660 | 660 | ||
661 | bool OpieFtp::populateRemoteView( ) | 661 | bool OpieFtp::populateRemoteView( ) |
662 | { | 662 | { |
663 | // qDebug("populate remoteview"); | 663 | // qDebug("populate remoteview"); |
664 | QString sfile=QDir::homeDirPath(); | 664 | QString sfile=QDir::homeDirPath(); |
665 | if(sfile.right(1) != "/") | 665 | if(sfile.right(1) != "/") |
666 | sfile+="/._temp"; | 666 | sfile+="/._temp"; |
667 | else | 667 | else |
668 | sfile+="._temp"; | 668 | sfile+="._temp"; |
669 | QFile file( sfile); | 669 | QFile file( sfile); |
670 | Remote_View->clear(); | 670 | Remote_View->clear(); |
671 | QString s, File_Name; | 671 | QString s, File_Name; |
672 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 672 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
673 | QString fileL, fileS, fileDate; | 673 | QString fileL, fileS, fileDate; |
674 | if ( file.open(IO_ReadOnly)) { | 674 | if ( file.open(IO_ReadOnly)) { |
675 | QTextStream t( &file ); // use a text stream | 675 | QTextStream t( &file ); // use a text stream |
676 | while ( !t.eof()) { | 676 | while ( !t.eof()) { |
677 | s = t.readLine(); | 677 | s = t.readLine(); |
678 | fileL = s.right(s.length()-55); | 678 | fileL = s.right(s.length()-55); |
679 | fileL = fileL.stripWhiteSpace(); | 679 | fileL = fileL.stripWhiteSpace(); |
680 | if(s.left(1) == "d") | 680 | if(s.left(1) == "d") |
681 | fileL = fileL+"/"; | 681 | fileL = fileL+"/"; |
682 | // fileL = "/"+fileL+"/"; | 682 | // fileL = "/"+fileL+"/"; |
683 | fileS = s.mid( 30, 42-30); | 683 | fileS = s.mid( 30, 42-30); |
684 | fileS = fileS.stripWhiteSpace(); | 684 | fileS = fileS.stripWhiteSpace(); |
685 | fileDate = s.mid( 42, 55-42); | 685 | fileDate = s.mid( 42, 55-42); |
686 | fileDate = fileDate.stripWhiteSpace(); | 686 | fileDate = fileDate.stripWhiteSpace(); |
687 | if(fileL.find("total",0,TRUE) == -1) { | 687 | if(fileL.find("total",0,TRUE) == -1) { |
688 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 688 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
689 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 689 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
690 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 690 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
691 | // if(itemDir) | 691 | // if(itemDir) |
692 | item->moveItem(itemDir); | 692 | item->moveItem(itemDir); |
693 | itemDir=item; | 693 | itemDir=item; |
694 | } else { | 694 | } else { |
695 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); | 695 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"f"); |
696 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | 696 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); |
697 | // if(itemFile) | 697 | // if(itemFile) |
698 | item->moveItem(itemDir); | 698 | item->moveItem(itemDir); |
699 | item->moveItem(itemFile); | 699 | item->moveItem(itemFile); |
700 | itemFile=item; | 700 | itemFile=item; |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } | 703 | } |
704 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 704 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
705 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 705 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |