-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index f70011b..f1b159c 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -602,209 +602,209 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | |||
602 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 602 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
603 | if(currentRemoteDir.right(1) !="/") | 603 | if(currentRemoteDir.right(1) !="/") |
604 | currentRemoteDir +="/"; | 604 | currentRemoteDir +="/"; |
605 | currentPathEdit->setText( currentRemoteDir ); | 605 | currentPathEdit->setText( currentRemoteDir ); |
606 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 606 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
607 | } | 607 | } |
608 | 608 | ||
609 | void OpieFtp::localListClicked(QListViewItem *selectedItem) | 609 | void OpieFtp::localListClicked(QListViewItem *selectedItem) |
610 | { | 610 | { |
611 | QString strItem=selectedItem->text(0); | 611 | QString strItem=selectedItem->text(0); |
612 | QString strSize=selectedItem->text(1); | 612 | QString strSize=selectedItem->text(1); |
613 | strSize=strSize.stripWhiteSpace(); | 613 | strSize=strSize.stripWhiteSpace(); |
614 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink | 614 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink |
615 | // is symlink | 615 | // is symlink |
616 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | 616 | QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); |
617 | if(QDir(strItem2).exists() ) { | 617 | if(QDir(strItem2).exists() ) { |
618 | currentDir.cd(strItem2, TRUE); | 618 | currentDir.cd(strItem2, TRUE); |
619 | populateLocalView(); | 619 | populateLocalView(); |
620 | } | 620 | } |
621 | } else { // not a symlink | 621 | } else { // not a symlink |
622 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 622 | if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
623 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { | 623 | if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { |
624 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 624 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
625 | currentDir.cd(strItem,FALSE); | 625 | currentDir.cd(strItem,FALSE); |
626 | populateLocalView(); | 626 | populateLocalView(); |
627 | } else { | 627 | } else { |
628 | currentDir.cdUp(); | 628 | currentDir.cdUp(); |
629 | populateLocalView(); | 629 | populateLocalView(); |
630 | } | 630 | } |
631 | if(QDir(strItem).exists()){ | 631 | if(QDir(strItem).exists()){ |
632 | currentDir.cd(strItem, TRUE); | 632 | currentDir.cd(strItem, TRUE); |
633 | populateLocalView(); | 633 | populateLocalView(); |
634 | } | 634 | } |
635 | } else { | 635 | } else { |
636 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 636 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
637 | if( QFile::exists(strItem ) ) { | 637 | if( QFile::exists(strItem ) ) { |
638 | qDebug("upload "+strItem); | 638 | qDebug("upload "+strItem); |
639 | } | 639 | } |
640 | } //end not symlink | 640 | } //end not symlink |
641 | chdir(strItem.latin1()); | 641 | chdir(strItem.latin1()); |
642 | } | 642 | } |
643 | } | 643 | } |
644 | 644 | ||
645 | void OpieFtp::doLocalCd() | 645 | void OpieFtp::doLocalCd() |
646 | { | 646 | { |
647 | localListClicked( Local_View->currentItem()); | 647 | localListClicked( Local_View->currentItem()); |
648 | } | 648 | } |
649 | 649 | ||
650 | void OpieFtp:: doRemoteCd() | 650 | void OpieFtp:: doRemoteCd() |
651 | { | 651 | { |
652 | remoteListClicked( Remote_View->currentItem()); | 652 | remoteListClicked( Remote_View->currentItem()); |
653 | 653 | ||
654 | } | 654 | } |
655 | 655 | ||
656 | void OpieFtp::showHidden() | 656 | void OpieFtp::showHidden() |
657 | { | 657 | { |
658 | if (!b) { | 658 | if (!b) { |
659 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 659 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
660 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 660 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
661 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 661 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
662 | b=TRUE; | 662 | b=TRUE; |
663 | 663 | ||
664 | } else { | 664 | } else { |
665 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 665 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
666 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 666 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
667 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 667 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
668 | b=FALSE; | 668 | b=FALSE; |
669 | } | 669 | } |
670 | populateLocalView(); | 670 | populateLocalView(); |
671 | } | 671 | } |
672 | 672 | ||
673 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 673 | void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
674 | { | 674 | { |
675 | switch (mouse) { | 675 | switch (mouse) { |
676 | case 1: | 676 | case 1: |
677 | break; | 677 | break; |
678 | case 2: | 678 | case 2: |
679 | showLocalMenu(item); | 679 | showLocalMenu(item); |
680 | break; | 680 | break; |
681 | }; | 681 | }; |
682 | } | 682 | } |
683 | 683 | ||
684 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 684 | void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
685 | { | 685 | { |
686 | switch (mouse) { | 686 | switch (mouse) { |
687 | case 1: | 687 | case 1: |
688 | break; | 688 | break; |
689 | case 2: | 689 | case 2: |
690 | showRemoteMenu(item); | 690 | showRemoteMenu(item); |
691 | break; | 691 | break; |
692 | }; | 692 | }; |
693 | } | 693 | } |
694 | 694 | ||
695 | void OpieFtp::showRemoteMenu(QListViewItem * item) | 695 | void OpieFtp::showRemoteMenu(QListViewItem * item) |
696 | { | 696 | { |
697 | QPopupMenu m;// = new QPopupMenu( Local_View ); | 697 | QPopupMenu m;// = new QPopupMenu( Local_View ); |
698 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE)) | 698 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) |
699 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 699 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
700 | else | 700 | else |
701 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 701 | m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
702 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 702 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
703 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 703 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
704 | m.insertSeparator(); | 704 | m.insertSeparator(); |
705 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 705 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
706 | m.exec( QCursor::pos() ); | 706 | m.exec( QCursor::pos() ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void OpieFtp::showLocalMenu(QListViewItem * item) | 709 | void OpieFtp::showLocalMenu(QListViewItem * item) |
710 | { | 710 | { |
711 | QPopupMenu m; | 711 | QPopupMenu m; |
712 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 712 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
713 | m.insertSeparator(); | 713 | m.insertSeparator(); |
714 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE)) | 714 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
715 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 715 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
716 | else | 716 | else |
717 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 717 | m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
718 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 718 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
719 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 719 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
720 | m.insertSeparator(); | 720 | m.insertSeparator(); |
721 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 721 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
722 | m.setCheckable(TRUE); | 722 | m.setCheckable(TRUE); |
723 | if (b) | 723 | if (b) |
724 | m.setItemChecked(m.idAt(0),TRUE); | 724 | m.setItemChecked(m.idAt(0),TRUE); |
725 | else | 725 | else |
726 | m.setItemChecked(m.idAt(0),FALSE); | 726 | m.setItemChecked(m.idAt(0),FALSE); |
727 | 727 | ||
728 | m.exec( QCursor::pos() ); | 728 | m.exec( QCursor::pos() ); |
729 | } | 729 | } |
730 | 730 | ||
731 | void OpieFtp::localMakDir() | 731 | void OpieFtp::localMakDir() |
732 | { | 732 | { |
733 | InputDialog *fileDlg; | 733 | InputDialog *fileDlg; |
734 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 734 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
735 | fileDlg->exec(); | 735 | fileDlg->exec(); |
736 | if( fileDlg->result() == 1 ) { | 736 | if( fileDlg->result() == 1 ) { |
737 | QString filename = fileDlg->LineEdit1->text(); | 737 | QString filename = fileDlg->LineEdit1->text(); |
738 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 738 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
739 | } | 739 | } |
740 | populateLocalView(); | 740 | populateLocalView(); |
741 | } | 741 | } |
742 | 742 | ||
743 | void OpieFtp::localDelete() | 743 | void OpieFtp::localDelete() |
744 | { | 744 | { |
745 | QString f = Local_View->currentItem()->text(0); | 745 | QString f = Local_View->currentItem()->text(0); |
746 | if(QDir(f).exists() ) { | 746 | if(QDir(f).exists() ) { |
747 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 747 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
748 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { | 748 | tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { |
749 | case 0: { | 749 | case 0: { |
750 | f=currentDir.canonicalPath()+"/"+f; | 750 | f=currentDir.canonicalPath()+"/"+f; |
751 | QString cmd="rmdir "+f; | 751 | QString cmd="rmdir "+f; |
752 | system( cmd.latin1()); | 752 | system( cmd.latin1()); |
753 | populateLocalView(); | 753 | populateLocalView(); |
754 | } | 754 | } |
755 | break; | 755 | break; |
756 | case 1: | 756 | case 1: |
757 | // exit | 757 | // exit |
758 | break; | 758 | break; |
759 | }; | 759 | }; |
760 | 760 | ||
761 | } else { | 761 | } else { |
762 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 762 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
763 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 763 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
764 | case 0: { | 764 | case 0: { |
765 | f=currentDir.canonicalPath()+"/"+f; | 765 | f=currentDir.canonicalPath()+"/"+f; |
766 | QString cmd="rm "+f; | 766 | QString cmd="rm "+f; |
767 | system( cmd.latin1()); | 767 | system( cmd.latin1()); |
768 | populateLocalView(); | 768 | populateLocalView(); |
769 | } | 769 | } |
770 | break; | 770 | break; |
771 | case 1: | 771 | case 1: |
772 | // exit | 772 | // exit |
773 | break; | 773 | break; |
774 | }; | 774 | }; |
775 | } | 775 | } |
776 | } | 776 | } |
777 | 777 | ||
778 | void OpieFtp::remoteMakDir() | 778 | void OpieFtp::remoteMakDir() |
779 | { | 779 | { |
780 | InputDialog *fileDlg; | 780 | InputDialog *fileDlg; |
781 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 781 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
782 | fileDlg->exec(); | 782 | fileDlg->exec(); |
783 | if( fileDlg->result() == 1 ) { | 783 | if( fileDlg->result() == 1 ) { |
784 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; | 784 | QString filename = fileDlg->LineEdit1->text();//+".playlist"; |
785 | QString tmp=currentRemoteDir+filename; | 785 | QString tmp=currentRemoteDir+filename; |
786 | QCopEnvelope ( "QPE/System", "busy()" ); | 786 | QCopEnvelope ( "QPE/System", "busy()" ); |
787 | if(FtpMkdir( tmp.latin1(), conn) == 0) { | 787 | if(FtpMkdir( tmp.latin1(), conn) == 0) { |
788 | QString msg; | 788 | QString msg; |
789 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); | 789 | msg.sprintf(tr("Unable to make directory\n")+"%s",FtpLastResponse(conn)); |
790 | msg.replace(QRegExp(":"),"\n"); | 790 | msg.replace(QRegExp(":"),"\n"); |
791 | QMessageBox::message(tr("Note"),msg); | 791 | QMessageBox::message(tr("Note"),msg); |
792 | } | 792 | } |
793 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 793 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
794 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 794 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
795 | } | 795 | } |
796 | } | 796 | } |
797 | 797 | ||
798 | void OpieFtp::remoteDelete() | 798 | void OpieFtp::remoteDelete() |
799 | { | 799 | { |
800 | QString f = Remote_View->currentItem()->text(0); | 800 | QString f = Remote_View->currentItem()->text(0); |
801 | QCopEnvelope ( "QPE/System", "busy()" ); | 801 | QCopEnvelope ( "QPE/System", "busy()" ); |
802 | if( f.right(1) =="/") { | 802 | if( f.right(1) =="/") { |
803 | QString path= currentRemoteDir+f; | 803 | QString path= currentRemoteDir+f; |
804 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" | 804 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" |
805 | ,tr("Yes"),tr("No"),0,0,1) ) { | 805 | ,tr("Yes"),tr("No"),0,0,1) ) { |
806 | case 0: { | 806 | case 0: { |
807 | f=currentDir.canonicalPath()+"/"+f; | 807 | f=currentDir.canonicalPath()+"/"+f; |
808 | if(FtpRmdir( path.latin1(), conn) ==0) { | 808 | if(FtpRmdir( path.latin1(), conn) ==0) { |
809 | QString msg; | 809 | QString msg; |
810 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); | 810 | msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); |