author | llornkcor <llornkcor> | 2002-04-28 13:51:21 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-28 13:51:21 (UTC) |
commit | c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0 (patch) (unidiff) | |
tree | 479063624eb052aa80198c157a3acc5ea9e3ccac | |
parent | caae6c7deade10081709daa8a0de8ad548b6e30d (diff) | |
download | opie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.zip opie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.tar.gz opie-c55ffe32ced1ecbac991ca2e85c6993cf8a04ee0.tar.bz2 |
fixed functions for x86
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 65 |
1 files changed, 50 insertions, 15 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index faa03dc..bd513c0 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -581,927 +581,962 @@ void AdvancedFm::doRemoteCd() | |||
581 | } | 581 | } |
582 | 582 | ||
583 | void AdvancedFm::showHidden() | 583 | void AdvancedFm::showHidden() |
584 | { | 584 | { |
585 | if (b) { | 585 | if (b) { |
586 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 586 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
587 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 587 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
588 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); | 588 | // localMenu->setItemChecked(localMenu->idAt(0),TRUE); |
589 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 589 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
590 | b=FALSE; | 590 | b=FALSE; |
591 | 591 | ||
592 | } else { | 592 | } else { |
593 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 593 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
594 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 594 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
595 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 595 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
596 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 596 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
597 | b=TRUE; | 597 | b=TRUE; |
598 | } | 598 | } |
599 | populateLocalView(); | 599 | populateLocalView(); |
600 | 600 | ||
601 | } | 601 | } |
602 | 602 | ||
603 | void AdvancedFm::showRemoteHidden() | 603 | void AdvancedFm::showRemoteHidden() |
604 | { | 604 | { |
605 | if (b) { | 605 | if (b) { |
606 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 606 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
607 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); | 607 | // viewMenu->setItemChecked(localMenu->idAt(0),TRUE); |
608 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 608 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
609 | b=TRUE; | 609 | b=TRUE; |
610 | 610 | ||
611 | } else { | 611 | } else { |
612 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 612 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
613 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); | 613 | // localMenu->setItemChecked(localMenu->idAt(0),FALSE); |
614 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 614 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
615 | b=FALSE; | 615 | b=FALSE; |
616 | } | 616 | } |
617 | populateRemoteView(); | 617 | populateRemoteView(); |
618 | } | 618 | } |
619 | 619 | ||
620 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 620 | void AdvancedFm::localListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
621 | { | 621 | { |
622 | switch (mouse) { | 622 | switch (mouse) { |
623 | case 1: | 623 | case 1: |
624 | break; | 624 | break; |
625 | case 2: | 625 | case 2: |
626 | showLocalMenu(item); | 626 | showLocalMenu(item); |
627 | Local_View->clearSelection(); | 627 | Local_View->clearSelection(); |
628 | break; | 628 | break; |
629 | }; | 629 | }; |
630 | } | 630 | } |
631 | 631 | ||
632 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) | 632 | void AdvancedFm::remoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) |
633 | { | 633 | { |
634 | switch (mouse) { | 634 | switch (mouse) { |
635 | case 1: | 635 | case 1: |
636 | break; | 636 | break; |
637 | case 2: | 637 | case 2: |
638 | showRemoteMenu(item); | 638 | showRemoteMenu(item); |
639 | Remote_View->clearSelection(); | 639 | Remote_View->clearSelection(); |
640 | break; | 640 | break; |
641 | }; | 641 | }; |
642 | } | 642 | } |
643 | 643 | ||
644 | void AdvancedFm::showLocalMenu(QListViewItem * item) | 644 | void AdvancedFm::showLocalMenu(QListViewItem * item) |
645 | { | 645 | { |
646 | if(item) { | 646 | if(item) { |
647 | QPopupMenu m; | 647 | QPopupMenu m; |
648 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 648 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
649 | m.insertSeparator(); | 649 | m.insertSeparator(); |
650 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 650 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
651 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); | 651 | m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); |
652 | else | 652 | else |
653 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 653 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
654 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 654 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
655 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 655 | m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
656 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 656 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
657 | m.insertSeparator(); | 657 | m.insertSeparator(); |
658 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 658 | m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
659 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 659 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
660 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 660 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
661 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 661 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
662 | m.insertSeparator(); | 662 | m.insertSeparator(); |
663 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 663 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
664 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 664 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
665 | m.insertSeparator(); | 665 | m.insertSeparator(); |
666 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 666 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
667 | m.insertSeparator(); | 667 | m.insertSeparator(); |
668 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 668 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
669 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 669 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
670 | m.setCheckable(TRUE); | 670 | m.setCheckable(TRUE); |
671 | if (!b) | 671 | if (!b) |
672 | m.setItemChecked(m.idAt(0),TRUE); | 672 | m.setItemChecked(m.idAt(0),TRUE); |
673 | else | 673 | else |
674 | m.setItemChecked(m.idAt(0),FALSE); | 674 | m.setItemChecked(m.idAt(0),FALSE); |
675 | m.exec( QCursor::pos() ); | 675 | m.exec( QCursor::pos() ); |
676 | } | 676 | } |
677 | } | 677 | } |
678 | 678 | ||
679 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 679 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
680 | { | 680 | { |
681 | if(item) { | 681 | if(item) { |
682 | QPopupMenu m; | 682 | QPopupMenu m; |
683 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 683 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
684 | m.insertSeparator(); | 684 | m.insertSeparator(); |
685 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 685 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
686 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 686 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
687 | else | 687 | else |
688 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); | 688 | m.insertItem( tr( "Open" ), this, SLOT( runThis() )); |
689 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 689 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
690 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 690 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
691 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 691 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
692 | m.insertSeparator(); | 692 | m.insertSeparator(); |
693 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 693 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
694 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 694 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
695 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 695 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
696 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 696 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
697 | m.insertSeparator(); | 697 | m.insertSeparator(); |
698 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 698 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
699 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 699 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
700 | m.insertSeparator(); | 700 | m.insertSeparator(); |
701 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 701 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
702 | m.insertSeparator(); | 702 | m.insertSeparator(); |
703 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 703 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
704 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 704 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
705 | m.setCheckable(TRUE); | 705 | m.setCheckable(TRUE); |
706 | if (!b) | 706 | if (!b) |
707 | m.setItemChecked(m.idAt(0),TRUE); | 707 | m.setItemChecked(m.idAt(0),TRUE); |
708 | else | 708 | else |
709 | m.setItemChecked(m.idAt(0),FALSE); | 709 | m.setItemChecked(m.idAt(0),FALSE); |
710 | m.exec( QCursor::pos() ); | 710 | m.exec( QCursor::pos() ); |
711 | } | 711 | } |
712 | } | 712 | } |
713 | 713 | ||
714 | void AdvancedFm::runThis() { | 714 | void AdvancedFm::runThis() { |
715 | // QFileInfo *fi; | 715 | // QFileInfo *fi; |
716 | if (TabWidget->currentPageIndex() == 0) { | 716 | if (TabWidget->currentPageIndex() == 0) { |
717 | QString curFile = Local_View->currentItem()->text(0); | 717 | QString curFile = Local_View->currentItem()->text(0); |
718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 718 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
719 | if(fileInfo.isExecutable()) { | 719 | if(fileInfo.isExecutable()) { |
720 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 720 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
721 | e << curFile; | 721 | e << curFile; |
722 | } else { | 722 | } else { |
723 | curFile = currentDir.canonicalPath()+"/"+curFile; | 723 | curFile = currentDir.canonicalPath()+"/"+curFile; |
724 | DocLnk nf(curFile); | 724 | DocLnk nf(curFile); |
725 | QString execStr = nf.exec(); | 725 | QString execStr = nf.exec(); |
726 | qDebug( execStr); | 726 | qDebug( execStr); |
727 | if( execStr.isEmpty() ) { | 727 | if( execStr.isEmpty() ) { |
728 | } else { | 728 | } else { |
729 | nf.execute(); | 729 | nf.execute(); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | // MimeType mt( curFile); | 732 | // MimeType mt( curFile); |
733 | } else { | 733 | } else { |
734 | QString curFile = Remote_View->currentItem()->text(0); | 734 | QString curFile = Remote_View->currentItem()->text(0); |
735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 735 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
736 | if(fileInfo.isExecutable()) { | 736 | if(fileInfo.isExecutable()) { |
737 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 737 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
738 | e << curFile; | 738 | e << curFile; |
739 | } else { | 739 | } else { |
740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 740 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
741 | DocLnk nf(curFile); | 741 | DocLnk nf(curFile); |
742 | QString execStr = nf.exec(); | 742 | QString execStr = nf.exec(); |
743 | qDebug(execStr); | 743 | qDebug(execStr); |
744 | if( execStr.isEmpty() ) { | 744 | if( execStr.isEmpty() ) { |
745 | } else { | 745 | } else { |
746 | nf.execute(); | 746 | nf.execute(); |
747 | } | 747 | } |
748 | } | 748 | } |
749 | // MimeType mt( curFile); | 749 | // MimeType mt( curFile); |
750 | } | 750 | } |
751 | } | 751 | } |
752 | 752 | ||
753 | void AdvancedFm::runText() { | 753 | void AdvancedFm::runText() { |
754 | if (TabWidget->currentPageIndex() == 0) { | 754 | if (TabWidget->currentPageIndex() == 0) { |
755 | QString curFile = Local_View->currentItem()->text(0); | 755 | QString curFile = Local_View->currentItem()->text(0); |
756 | curFile = currentDir.canonicalPath()+"/"+curFile; | 756 | curFile = currentDir.canonicalPath()+"/"+curFile; |
757 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 757 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
758 | e << curFile; | 758 | e << curFile; |
759 | } else { | 759 | } else { |
760 | QString curFile = Remote_View->currentItem()->text(0); | 760 | QString curFile = Remote_View->currentItem()->text(0); |
761 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 761 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
762 | DocLnk nf(curFile); | 762 | DocLnk nf(curFile); |
763 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 763 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
764 | e << curFile; | 764 | e << curFile; |
765 | } | 765 | } |
766 | } | 766 | } |
767 | 767 | ||
768 | void AdvancedFm::localMakDir() | 768 | void AdvancedFm::localMakDir() |
769 | { | 769 | { |
770 | InputDialog *fileDlg; | 770 | InputDialog *fileDlg; |
771 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 771 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
772 | fileDlg->exec(); | 772 | fileDlg->exec(); |
773 | if( fileDlg->result() == 1 ) { | 773 | if( fileDlg->result() == 1 ) { |
774 | QString filename = fileDlg->LineEdit1->text(); | 774 | QString filename = fileDlg->LineEdit1->text(); |
775 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 775 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
776 | } | 776 | } |
777 | populateLocalView(); | 777 | populateLocalView(); |
778 | } | 778 | } |
779 | 779 | ||
780 | void AdvancedFm::remoteMakDir() | 780 | void AdvancedFm::remoteMakDir() |
781 | { | 781 | { |
782 | InputDialog *fileDlg; | 782 | InputDialog *fileDlg; |
783 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 783 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
784 | fileDlg->exec(); | 784 | fileDlg->exec(); |
785 | if( fileDlg->result() == 1 ) { | 785 | if( fileDlg->result() == 1 ) { |
786 | QString filename = fileDlg->LineEdit1->text(); | 786 | QString filename = fileDlg->LineEdit1->text(); |
787 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 787 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
788 | } | 788 | } |
789 | populateRemoteView(); | 789 | populateRemoteView(); |
790 | } | 790 | } |
791 | 791 | ||
792 | void AdvancedFm::localDelete() | 792 | void AdvancedFm::localDelete() |
793 | { | 793 | { |
794 | QStringList curFileList = getPath(); | 794 | QStringList curFileList = getPath(); |
795 | QString myFile; | 795 | QString myFile; |
796 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 796 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
797 | myFile = (*it); | 797 | myFile = (*it); |
798 | if( myFile.find(" -> ",0,TRUE) != -1) | 798 | if( myFile.find(" -> ",0,TRUE) != -1) |
799 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 799 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
800 | 800 | ||
801 | QString f = currentDir.canonicalPath(); | 801 | QString f = currentDir.canonicalPath(); |
802 | if(f.right(1).find("/",0,TRUE) == -1) | 802 | if(f.right(1).find("/",0,TRUE) == -1) |
803 | f+="/"; | 803 | f+="/"; |
804 | f+=myFile; | 804 | f+=myFile; |
805 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 805 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
806 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 806 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
807 | "\nand all it's contents ?" | 807 | "\nand all it's contents ?" |
808 | ,tr("Yes"),tr("No"),0,0,1) ) { | 808 | ,tr("Yes"),tr("No"),0,0,1) ) { |
809 | case 0: { | 809 | case 0: { |
810 | f=f.left(f.length()-1); | 810 | f=f.left(f.length()-1); |
811 | QString cmd="rm -rf "+f; | 811 | QString cmd="rm -rf "+f; |
812 | system( cmd.latin1()); | 812 | system( cmd.latin1()); |
813 | populateLocalView(); | 813 | populateLocalView(); |
814 | } | 814 | } |
815 | break; | 815 | break; |
816 | case 1: | 816 | case 1: |
817 | // exit | 817 | // exit |
818 | break; | 818 | break; |
819 | }; | 819 | }; |
820 | 820 | ||
821 | } else { | 821 | } else { |
822 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 822 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
823 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 823 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
824 | case 0: { | 824 | case 0: { |
825 | QString cmd="rm "+f; | 825 | QString cmd="rm "+f; |
826 | QFile file(f); | 826 | QFile file(f); |
827 | file.remove(); | 827 | file.remove(); |
828 | // system( cmd.latin1()); | 828 | // system( cmd.latin1()); |
829 | populateLocalView(); | 829 | populateLocalView(); |
830 | } | 830 | } |
831 | break; | 831 | break; |
832 | case 1: | 832 | case 1: |
833 | // exit | 833 | // exit |
834 | break; | 834 | break; |
835 | }; | 835 | }; |
836 | } | 836 | } |
837 | |||
838 | } | 837 | } |
839 | } | 838 | } |
840 | 839 | ||
841 | void AdvancedFm::remoteDelete() | 840 | void AdvancedFm::remoteDelete() |
842 | { | 841 | { |
843 | QStringList curFileList = getPath(); | 842 | QStringList curFileList = getPath(); |
844 | QString myFile; | 843 | QString myFile; |
845 | 844 | ||
846 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 845 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
847 | myFile = (*it); | 846 | myFile = (*it); |
848 | if(myFile.find(" -> ",0,TRUE) != -1) | 847 | if(myFile.find(" -> ",0,TRUE) != -1) |
849 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 848 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
850 | QString f = currentDir.canonicalPath(); | 849 | QString f = currentDir.canonicalPath(); |
851 | if(f.right(1).find("/",0,TRUE) == -1) | 850 | if(f.right(1).find("/",0,TRUE) == -1) |
852 | f+="/"; | 851 | f+="/"; |
853 | f+=myFile; | 852 | f+=myFile; |
854 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 853 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
855 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 854 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
856 | "\nand all it's contents ?", | 855 | "\nand all it's contents ?", |
857 | tr("Yes"),tr("No"),0,0,1) ) { | 856 | tr("Yes"),tr("No"),0,0,1) ) { |
858 | case 0: { | 857 | case 0: { |
859 | f=f.left(f.length()-1); | 858 | f=f.left(f.length()-1); |
860 | QString cmd="rm -rf "+f; | 859 | QString cmd="rm -rf "+f; |
861 | system( cmd.latin1()); | 860 | system( cmd.latin1()); |
862 | populateRemoteView(); | 861 | populateRemoteView(); |
863 | } | 862 | } |
864 | break; | 863 | break; |
865 | case 1: | 864 | case 1: |
866 | // exit | 865 | // exit |
867 | break; | 866 | break; |
868 | }; | 867 | }; |
869 | 868 | ||
870 | } else { | 869 | } else { |
871 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 870 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
872 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 871 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
873 | case 0: { | 872 | case 0: { |
874 | QString cmd="rm "+f; | 873 | QString cmd="rm "+f; |
875 | QFile file(f); | 874 | QFile file(f); |
876 | file.remove(); | 875 | file.remove(); |
877 | // system( cmd.latin1()); | 876 | // system( cmd.latin1()); |
878 | populateRemoteView(); | 877 | populateRemoteView(); |
879 | } | 878 | } |
880 | break; | 879 | break; |
881 | case 1: | 880 | case 1: |
882 | // exit | 881 | // exit |
883 | break; | 882 | break; |
884 | }; | 883 | }; |
885 | } | 884 | } |
886 | } | 885 | } |
887 | } | 886 | } |
888 | 887 | ||
889 | void AdvancedFm::localRename() | 888 | void AdvancedFm::localRename() |
890 | { | 889 | { |
891 | QString curFile = Local_View->currentItem()->text(0); | 890 | QString curFile = Local_View->currentItem()->text(0); |
892 | InputDialog *fileDlg; | 891 | InputDialog *fileDlg; |
893 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 892 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
894 | fileDlg->setInputText((const QString &)curFile); | 893 | fileDlg->setInputText((const QString &)curFile); |
895 | fileDlg->exec(); | 894 | fileDlg->exec(); |
896 | if( fileDlg->result() == 1 ) { | 895 | if( fileDlg->result() == 1 ) { |
897 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 896 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
898 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 897 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
899 | if( rename(oldname.latin1(), newName.latin1())== -1) | 898 | if( rename(oldname.latin1(), newName.latin1())== -1) |
900 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 899 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
901 | } | 900 | } |
902 | populateLocalView(); | 901 | populateLocalView(); |
903 | } | 902 | } |
904 | 903 | ||
905 | void AdvancedFm::remoteRename() | 904 | void AdvancedFm::remoteRename() |
906 | { | 905 | { |
907 | QString curFile = Local_View->currentItem()->text(0); | 906 | QString curFile = Local_View->currentItem()->text(0); |
908 | InputDialog *fileDlg; | 907 | InputDialog *fileDlg; |
909 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 908 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
910 | fileDlg->setInputText((const QString &)curFile); | 909 | fileDlg->setInputText((const QString &)curFile); |
911 | fileDlg->exec(); | 910 | fileDlg->exec(); |
912 | if( fileDlg->result() == 1 ) { | 911 | if( fileDlg->result() == 1 ) { |
913 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 912 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
914 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 913 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
915 | if( rename(oldname.latin1(), newName.latin1())== -1) | 914 | if( rename(oldname.latin1(), newName.latin1())== -1) |
916 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 915 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
917 | } | 916 | } |
918 | populateRemoteView(); | 917 | populateRemoteView(); |
919 | } | 918 | } |
920 | 919 | ||
921 | void AdvancedFm::switchToLocalTab() | 920 | void AdvancedFm::switchToLocalTab() |
922 | { | 921 | { |
923 | TabWidget->setCurrentPage(0); | 922 | TabWidget->setCurrentPage(0); |
924 | Local_View->setFocus(); | 923 | Local_View->setFocus(); |
925 | } | 924 | } |
926 | 925 | ||
927 | void AdvancedFm::switchToRemoteTab() | 926 | void AdvancedFm::switchToRemoteTab() |
928 | { | 927 | { |
929 | TabWidget->setCurrentPage(1); | 928 | TabWidget->setCurrentPage(1); |
930 | Remote_View->setFocus(); | 929 | Remote_View->setFocus(); |
931 | } | 930 | } |
932 | 931 | ||
933 | void AdvancedFm::readConfig() | 932 | void AdvancedFm::readConfig() |
934 | { | 933 | { |
935 | Config cfg("AdvancedFm"); | 934 | Config cfg("AdvancedFm"); |
936 | } | 935 | } |
937 | 936 | ||
938 | void AdvancedFm::writeConfig() | 937 | void AdvancedFm::writeConfig() |
939 | { | 938 | { |
940 | Config cfg("AdvancedFm"); | 939 | Config cfg("AdvancedFm"); |
941 | } | 940 | } |
942 | 941 | ||
943 | void AdvancedFm::currentPathComboChanged() | 942 | void AdvancedFm::currentPathComboChanged() |
944 | { | 943 | { |
945 | if (TabWidget->currentPageIndex() == 0) { | 944 | if (TabWidget->currentPageIndex() == 0) { |
946 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 945 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
947 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 946 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
948 | populateLocalView(); | 947 | populateLocalView(); |
949 | } else { | 948 | } else { |
950 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 949 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
951 | } | 950 | } |
952 | } | 951 | } |
953 | if (TabWidget->currentPageIndex() == 0) { | 952 | if (TabWidget->currentPageIndex() == 0) { |
954 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 953 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
955 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 954 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
956 | populateRemoteView(); | 955 | populateRemoteView(); |
957 | } else { | 956 | } else { |
958 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 957 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
959 | } | 958 | } |
960 | } | 959 | } |
961 | } | 960 | } |
962 | 961 | ||
963 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 962 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
964 | 963 | ||
965 | if (TabWidget->currentPageIndex() == 0) { | 964 | if (TabWidget->currentPageIndex() == 0) { |
966 | currentPathCombo->lineEdit()->setText( currentPath); | 965 | currentPathCombo->lineEdit()->setText( currentPath); |
967 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 966 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
968 | currentPathCombo->clear(); | 967 | currentPathCombo->clear(); |
969 | localDirPathStringList.prepend( currentPath ); | 968 | localDirPathStringList.prepend( currentPath ); |
970 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 969 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
971 | } | 970 | } |
972 | } else { | 971 | } else { |
973 | currentPathCombo->lineEdit()->setText( currentPath); | 972 | currentPathCombo->lineEdit()->setText( currentPath); |
974 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 973 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
975 | currentPathCombo->clear(); | 974 | currentPathCombo->clear(); |
976 | remoteDirPathStringList.prepend( currentPath ); | 975 | remoteDirPathStringList.prepend( currentPath ); |
977 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 976 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
978 | } | 977 | } |
979 | } | 978 | } |
980 | } | 979 | } |
981 | 980 | ||
982 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 981 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
983 | if (TabWidget->currentPageIndex() == 0) { | 982 | if (TabWidget->currentPageIndex() == 0) { |
984 | chdir( currentPath.latin1() ); | 983 | chdir( currentPath.latin1() ); |
985 | currentDir.cd( currentPath, TRUE); | 984 | currentDir.cd( currentPath, TRUE); |
986 | populateLocalView(); | 985 | populateLocalView(); |
987 | update(); | 986 | update(); |
988 | } else { | 987 | } else { |
989 | chdir( currentPath.latin1() ); | 988 | chdir( currentPath.latin1() ); |
990 | currentRemoteDir.cd( currentPath, TRUE); | 989 | currentRemoteDir.cd( currentPath, TRUE); |
991 | populateRemoteView(); | 990 | populateRemoteView(); |
992 | update(); | 991 | update(); |
993 | } | 992 | } |
994 | } | 993 | } |
995 | 994 | ||
996 | void AdvancedFm::filePerms() { | 995 | void AdvancedFm::filePerms() { |
997 | 996 | ||
998 | QStringList curFileList = getPath(); | 997 | QStringList curFileList = getPath(); |
999 | QString filePath; | 998 | QString filePath; |
1000 | 999 | ||
1001 | if (TabWidget->currentPageIndex() == 0) { | 1000 | if (TabWidget->currentPageIndex() == 0) { |
1002 | filePath = currentDir.canonicalPath()+"/"; | 1001 | filePath = currentDir.canonicalPath()+"/"; |
1003 | } else { | 1002 | } else { |
1004 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1003 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1005 | } | 1004 | } |
1006 | 1005 | ||
1007 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1006 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1008 | filePermissions *filePerm; | 1007 | filePermissions *filePerm; |
1009 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1008 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1010 | filePerm->showMaximized(); | 1009 | filePerm->showMaximized(); |
1011 | filePerm->exec(); | 1010 | filePerm->exec(); |
1012 | if( filePerm) | 1011 | if( filePerm) |
1013 | delete filePerm; | 1012 | delete filePerm; |
1014 | } | 1013 | } |
1015 | } | 1014 | } |
1016 | 1015 | ||
1017 | void AdvancedFm::doProperties() { | 1016 | void AdvancedFm::doProperties() { |
1018 | QStringList curFileList = getPath(); | 1017 | QStringList curFileList = getPath(); |
1019 | QString filePath; | 1018 | QString filePath; |
1020 | if (TabWidget->currentPageIndex() == 0) { | 1019 | if (TabWidget->currentPageIndex() == 0) { |
1021 | filePath = currentDir.canonicalPath()+"/"; | 1020 | filePath = currentDir.canonicalPath()+"/"; |
1022 | } else { | 1021 | } else { |
1023 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1022 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1024 | } | 1023 | } |
1025 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1024 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1026 | DocLnk lnk( (filePath+*it)); | 1025 | DocLnk lnk( (filePath+*it)); |
1027 | LnkProperties prop( &lnk ); | 1026 | LnkProperties prop( &lnk ); |
1028 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1027 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1029 | prop.showMaximized(); | 1028 | prop.showMaximized(); |
1030 | prop.exec(); | 1029 | prop.exec(); |
1031 | } | 1030 | } |
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | QStringList AdvancedFm::getPath() { | 1033 | QStringList AdvancedFm::getPath() { |
1035 | QStringList strList; | 1034 | QStringList strList; |
1036 | if (TabWidget->currentPageIndex() == 0) { | 1035 | if (TabWidget->currentPageIndex() == 0) { |
1037 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1036 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1038 | QListViewItemIterator it( Local_View ); | 1037 | QListViewItemIterator it( Local_View ); |
1039 | for ( ; it.current(); ++it ) { | 1038 | for ( ; it.current(); ++it ) { |
1040 | if ( it.current()->isSelected() ) { | 1039 | if ( it.current()->isSelected() ) { |
1041 | strList << it.current()->text(0); | 1040 | strList << it.current()->text(0); |
1042 | } | 1041 | } |
1043 | } | 1042 | } |
1044 | return strList; | 1043 | return strList; |
1045 | } else { | 1044 | } else { |
1046 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1045 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1047 | QListViewItemIterator it( Remote_View ); | 1046 | QListViewItemIterator it( Remote_View ); |
1048 | for ( ; it.current(); ++it ) { | 1047 | for ( ; it.current(); ++it ) { |
1049 | if ( it.current()->isSelected() ) { | 1048 | if ( it.current()->isSelected() ) { |
1050 | strList << currentDir.canonicalPath()+"/"+ it.current()->text(0); | 1049 | strList << currentDir.canonicalPath()+"/"+ it.current()->text(0); |
1051 | } | 1050 | } |
1052 | } | 1051 | } |
1053 | return strList; | 1052 | return strList; |
1054 | } | 1053 | } |
1055 | return ""; | 1054 | return ""; |
1056 | } | 1055 | } |
1057 | 1056 | ||
1058 | void AdvancedFm::homeButtonPushed() { | 1057 | void AdvancedFm::homeButtonPushed() { |
1059 | QString current = QDir::homeDirPath(); | 1058 | QString current = QDir::homeDirPath(); |
1060 | chdir( current.latin1() ); | 1059 | chdir( current.latin1() ); |
1061 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1062 | currentDir.cd( current, TRUE); | 1061 | currentDir.cd( current, TRUE); |
1063 | populateLocalView(); | 1062 | populateLocalView(); |
1064 | } else { | 1063 | } else { |
1065 | currentRemoteDir.cd( current, TRUE); | 1064 | currentRemoteDir.cd( current, TRUE); |
1066 | populateRemoteView(); | 1065 | populateRemoteView(); |
1067 | } | 1066 | } |
1068 | update(); | 1067 | update(); |
1069 | } | 1068 | } |
1070 | 1069 | ||
1071 | void AdvancedFm::docButtonPushed() { | 1070 | void AdvancedFm::docButtonPushed() { |
1072 | QString current = QPEApplication::documentDir(); | 1071 | QString current = QPEApplication::documentDir(); |
1073 | chdir( current.latin1() ); | 1072 | chdir( current.latin1() ); |
1074 | if (TabWidget->currentPageIndex() == 0) { | 1073 | if (TabWidget->currentPageIndex() == 0) { |
1075 | currentDir.cd( current, TRUE); | 1074 | currentDir.cd( current, TRUE); |
1076 | populateLocalView(); | 1075 | populateLocalView(); |
1077 | } else { | 1076 | } else { |
1078 | currentRemoteDir.cd( current, TRUE); | 1077 | currentRemoteDir.cd( current, TRUE); |
1079 | populateRemoteView(); | 1078 | populateRemoteView(); |
1080 | } | 1079 | } |
1081 | update(); | 1080 | update(); |
1082 | } | 1081 | } |
1083 | 1082 | ||
1084 | void AdvancedFm::SDButtonPushed() { | 1083 | void AdvancedFm::SDButtonPushed() { |
1085 | QString current = "/mnt/card"; | 1084 | QString current = "/mnt/card"; |
1086 | chdir( current.latin1() ); | 1085 | chdir( current.latin1() ); |
1087 | if (TabWidget->currentPageIndex() == 0) { | 1086 | if (TabWidget->currentPageIndex() == 0) { |
1088 | currentDir.cd( current, TRUE); | 1087 | currentDir.cd( current, TRUE); |
1089 | populateLocalView(); | 1088 | populateLocalView(); |
1090 | } else { | 1089 | } else { |
1091 | currentRemoteDir.cd( current, TRUE); | 1090 | currentRemoteDir.cd( current, TRUE); |
1092 | populateRemoteView(); | 1091 | populateRemoteView(); |
1093 | } | 1092 | } |
1094 | update(); | 1093 | update(); |
1095 | 1094 | ||
1096 | } | 1095 | } |
1097 | 1096 | ||
1098 | void AdvancedFm::CFButtonPushed() { | 1097 | void AdvancedFm::CFButtonPushed() { |
1099 | QString current = "/mnt/cf"; | 1098 | QString current = "/mnt/cf"; |
1100 | chdir( current.latin1() ); | 1099 | chdir( current.latin1() ); |
1101 | if (TabWidget->currentPageIndex() == 0) { | 1100 | if (TabWidget->currentPageIndex() == 0) { |
1102 | currentDir.cd( current, TRUE); | 1101 | currentDir.cd( current, TRUE); |
1103 | populateLocalView(); | 1102 | populateLocalView(); |
1104 | } else { | 1103 | } else { |
1105 | currentRemoteDir.cd( current, TRUE); | 1104 | currentRemoteDir.cd( current, TRUE); |
1106 | populateRemoteView(); | 1105 | populateRemoteView(); |
1107 | } | 1106 | } |
1108 | update(); | 1107 | update(); |
1109 | 1108 | ||
1110 | } | 1109 | } |
1111 | 1110 | ||
1112 | 1111 | ||
1113 | void AdvancedFm::upDir() | 1112 | void AdvancedFm::upDir() |
1114 | { | 1113 | { |
1115 | if (TabWidget->currentPageIndex() == 0) { | 1114 | if (TabWidget->currentPageIndex() == 0) { |
1116 | QString current = currentDir.canonicalPath(); | 1115 | QString current = currentDir.canonicalPath(); |
1117 | QDir dir(current); | 1116 | QDir dir(current); |
1118 | dir.cdUp(); | 1117 | dir.cdUp(); |
1119 | current = dir.canonicalPath(); | 1118 | current = dir.canonicalPath(); |
1120 | chdir( current.latin1() ); | 1119 | chdir( current.latin1() ); |
1121 | currentDir.cd( current, TRUE); | 1120 | currentDir.cd( current, TRUE); |
1122 | populateLocalView(); | 1121 | populateLocalView(); |
1123 | update(); | 1122 | update(); |
1124 | } else { | 1123 | } else { |
1125 | QString current = currentRemoteDir.canonicalPath(); | 1124 | QString current = currentRemoteDir.canonicalPath(); |
1126 | QDir dir(current); | 1125 | QDir dir(current); |
1127 | dir.cdUp(); | 1126 | dir.cdUp(); |
1128 | current = dir.canonicalPath(); | 1127 | current = dir.canonicalPath(); |
1129 | chdir( current.latin1() ); | 1128 | chdir( current.latin1() ); |
1130 | currentRemoteDir.cd( current, TRUE); | 1129 | currentRemoteDir.cd( current, TRUE); |
1131 | populateRemoteView(); | 1130 | populateRemoteView(); |
1132 | update(); | 1131 | update(); |
1133 | } | 1132 | } |
1134 | } | 1133 | } |
1135 | 1134 | ||
1136 | void AdvancedFm::copy() | 1135 | void AdvancedFm::copy() |
1137 | { | 1136 | { |
1138 | QStringList curFileList = getPath(); | 1137 | QStringList curFileList = getPath(); |
1139 | QString curFile; | 1138 | QString curFile; |
1140 | if (TabWidget->currentPageIndex() == 0) { | 1139 | if (TabWidget->currentPageIndex() == 0) { |
1141 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1140 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1142 | 1141 | ||
1143 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1142 | QString destFile = currentRemoteDir.canonicalPath(); |
1144 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1143 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1144 | destFile+="/"; | ||
1145 | destFile +=(*it); | ||
1146 | curFile = currentDir.canonicalPath(); | ||
1147 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1148 | curFile +="/"; | ||
1149 | curFile +=(*it); | ||
1145 | QFile f(destFile); | 1150 | QFile f(destFile); |
1146 | if( f.exists()) | 1151 | if( f.exists()) |
1147 | f.remove(); | 1152 | f.remove(); |
1148 | if(!copyFile(destFile, curFile) ) | 1153 | if(!copyFile(destFile, curFile) ) |
1149 | qWarning("nothin doing"); | 1154 | qWarning("nothin doing"); |
1150 | } | 1155 | } |
1151 | populateRemoteView(); | 1156 | populateRemoteView(); |
1152 | TabWidget->setCurrentPage(1); | 1157 | TabWidget->setCurrentPage(1); |
1153 | 1158 | ||
1154 | } else { | 1159 | } else { |
1155 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1160 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1156 | 1161 | ||
1157 | QString destFile = currentDir.canonicalPath()+"/"+(*it); | 1162 | QString destFile = currentDir.canonicalPath(); |
1158 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1163 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1164 | destFile+="/"; | ||
1165 | destFile +=(*it); | ||
1166 | curFile = currentRemoteDir.canonicalPath(); | ||
1167 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1168 | curFile +="/"; | ||
1169 | curFile +=(*it); | ||
1159 | QFile f(destFile); | 1170 | QFile f(destFile); |
1160 | if( f.exists()) | 1171 | if( f.exists()) |
1161 | f.remove(); | 1172 | f.remove(); |
1162 | if(!copyFile(destFile, curFile) ) | 1173 | if(!copyFile(destFile, curFile) ) |
1163 | qWarning("nothin doing"); | 1174 | qWarning("nothin doing"); |
1164 | } | 1175 | } |
1165 | populateLocalView(); | 1176 | populateLocalView(); |
1166 | TabWidget->setCurrentPage(0); | 1177 | TabWidget->setCurrentPage(0); |
1167 | } | 1178 | } |
1168 | } | 1179 | } |
1169 | 1180 | ||
1170 | void AdvancedFm::copyAs() | 1181 | void AdvancedFm::copyAs() |
1171 | { | 1182 | { |
1172 | QStringList curFileList = getPath(); | 1183 | QStringList curFileList = getPath(); |
1173 | QString curFile; | 1184 | QString curFile; |
1174 | InputDialog *fileDlg; | 1185 | InputDialog *fileDlg; |
1175 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1186 | fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1176 | 1187 | ||
1177 | if (TabWidget->currentPageIndex() == 0) { | 1188 | if (TabWidget->currentPageIndex() == 0) { |
1178 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1189 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1179 | QString destFile = *it; | 1190 | QString destFile; |
1180 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1191 | curFile = currentDir.canonicalPath(); |
1192 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1193 | curFile +="/"; | ||
1194 | curFile+=(*it); | ||
1181 | // InputDialog *fileDlg; | 1195 | // InputDialog *fileDlg; |
1182 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); | 1196 | // fileDlg = new InputDialog(this,tr("Copy As"),TRUE, 0); |
1183 | fileDlg->setInputText((const QString &) destFile ); | 1197 | fileDlg->setInputText((const QString &) destFile ); |
1184 | fileDlg->exec(); | 1198 | fileDlg->exec(); |
1185 | if( fileDlg->result() == 1 ) { | 1199 | if( fileDlg->result() == 1 ) { |
1186 | QString filename = fileDlg->LineEdit1->text(); | 1200 | QString filename = fileDlg->LineEdit1->text(); |
1187 | destFile = currentRemoteDir.canonicalPath()+"/"+destFile; | 1201 | destFile = currentRemoteDir.canonicalPath(); |
1202 | if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1203 | destFile+="/"; | ||
1204 | destFile +=(*it); | ||
1188 | 1205 | ||
1189 | QFile f(destFile); | 1206 | QFile f(destFile); |
1190 | if( f.exists()) | 1207 | if( f.exists()) |
1191 | f.remove(); | 1208 | f.remove(); |
1192 | if(!copyFile(destFile, curFile) ) | 1209 | if(!copyFile(destFile, curFile) ) |
1193 | qWarning("nothin doing"); | 1210 | qWarning("nothin doing"); |
1194 | } | 1211 | } |
1195 | } | 1212 | } |
1196 | 1213 | ||
1197 | populateRemoteView(); | 1214 | populateRemoteView(); |
1198 | TabWidget->setCurrentPage(1); | 1215 | TabWidget->setCurrentPage(1); |
1199 | } else { | 1216 | } else { |
1200 | if (TabWidget->currentPageIndex() == 0) { | 1217 | if (TabWidget->currentPageIndex() == 0) { |
1201 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1218 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1202 | 1219 | ||
1203 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1220 | curFile = currentDir.canonicalPath(); |
1204 | QString destFile = *it; | 1221 | if(curFile.right(1).find("/",0,TRUE) == -1) |
1222 | curFile +="/"; | ||
1223 | curFile+=(*it); | ||
1224 | QString destFile; | ||
1205 | fileDlg->setInputText((const QString &) destFile); | 1225 | fileDlg->setInputText((const QString &) destFile); |
1206 | fileDlg->exec(); | 1226 | fileDlg->exec(); |
1207 | if( fileDlg->result() == 1 ) { | 1227 | if( fileDlg->result() == 1 ) { |
1208 | QString filename = fileDlg->LineEdit1->text(); | 1228 | QString filename = fileDlg->LineEdit1->text(); |
1209 | destFile = currentDir.canonicalPath()+"/"+destFile; | 1229 | destFile = currentDir.canonicalPath(); |
1230 | if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1231 | destFile+="/"; | ||
1232 | destFile +=(*it); | ||
1210 | 1233 | ||
1211 | QFile f(destFile); | 1234 | QFile f(destFile); |
1212 | if( f.exists()) | 1235 | if( f.exists()) |
1213 | f.remove(); | 1236 | f.remove(); |
1214 | if(!copyFile(destFile, curFile) ) | 1237 | if(!copyFile(destFile, curFile) ) |
1215 | qWarning("nothin doing"); | 1238 | qWarning("nothin doing"); |
1216 | } | 1239 | } |
1217 | } | 1240 | } |
1218 | populateLocalView(); | 1241 | populateLocalView(); |
1219 | TabWidget->setCurrentPage(0); | 1242 | TabWidget->setCurrentPage(0); |
1220 | } | 1243 | } |
1221 | } | 1244 | } |
1222 | } | 1245 | } |
1223 | 1246 | ||
1224 | void AdvancedFm::move() { | 1247 | void AdvancedFm::move() { |
1225 | 1248 | ||
1226 | QStringList curFileList = getPath(); | 1249 | QStringList curFileList = getPath(); |
1227 | QString curFile; | 1250 | QString curFile; |
1228 | // qDebug(curFile); | 1251 | // qDebug(curFile); |
1229 | QString destFile; | 1252 | QString destFile; |
1230 | 1253 | ||
1231 | if (TabWidget->currentPageIndex() == 0) { | 1254 | if (TabWidget->currentPageIndex() == 0) { |
1232 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1255 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1233 | QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; | 1256 | QString destFile = currentRemoteDir.canonicalPath(); |
1234 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1257 | if(destFile.right(1).find("/",0,TRUE) == -1) |
1258 | destFile+="/"; | ||
1259 | destFile +=(*it); | ||
1260 | curFile = currentDir.canonicalPath(); | ||
1235 | qDebug("Destination file is "+destFile); | 1261 | qDebug("Destination file is "+destFile); |
1262 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1263 | curFile +="/"; | ||
1264 | curFile+=(*it); | ||
1236 | 1265 | ||
1237 | QFile f(destFile); | 1266 | QFile f(destFile); |
1238 | if( f.exists()) | 1267 | if( f.exists()) |
1239 | f.remove(); | 1268 | f.remove(); |
1240 | if(!copyFile( destFile, curFile) ) { | 1269 | if(!copyFile( destFile, curFile) ) { |
1241 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1270 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1242 | return; | 1271 | return; |
1243 | } | 1272 | } |
1244 | QFile::remove(curFile); | 1273 | QFile::remove(curFile); |
1245 | } | 1274 | } |
1246 | TabWidget->setCurrentPage(1); | 1275 | TabWidget->setCurrentPage(1); |
1247 | } else { | 1276 | } else { |
1248 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1277 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1249 | QString destFile = currentRemoteDir.canonicalPath() + "/" + *it; | 1278 | QString destFile = currentRemoteDir.canonicalPath(); |
1279 | if(destFile.right(1).find("/",0,TRUE) == -1) | ||
1280 | destFile+="/"; | ||
1281 | destFile +=(*it); | ||
1250 | qDebug("Destination file is "+destFile); | 1282 | qDebug("Destination file is "+destFile); |
1251 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1283 | curFile = currentDir.canonicalPath(); |
1284 | if(curFile.right(1).find("/",0,TRUE) == -1) | ||
1285 | curFile +="/"; | ||
1286 | curFile+=(*it); | ||
1252 | 1287 | ||
1253 | QFile f(destFile); | 1288 | QFile f(destFile); |
1254 | if( f.exists()) | 1289 | if( f.exists()) |
1255 | f.remove(); | 1290 | f.remove(); |
1256 | if(!copyFile(destFile, curFile) ) { | 1291 | if(!copyFile(destFile, curFile) ) { |
1257 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); | 1292 | QMessageBox::message(tr("Note"),tr("Could not move\n"+curFile)); |
1258 | return; | 1293 | return; |
1259 | } | 1294 | } |
1260 | QFile::remove(curFile); | 1295 | QFile::remove(curFile); |
1261 | TabWidget->setCurrentPage(0); | 1296 | TabWidget->setCurrentPage(0); |
1262 | } | 1297 | } |
1263 | } | 1298 | } |
1264 | populateRemoteView(); | 1299 | populateRemoteView(); |
1265 | populateLocalView(); | 1300 | populateLocalView(); |
1266 | } | 1301 | } |
1267 | 1302 | ||
1268 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) | 1303 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) |
1269 | { | 1304 | { |
1270 | char bf[ 50000 ]; | 1305 | char bf[ 50000 ]; |
1271 | int bytesRead; | 1306 | int bytesRead; |
1272 | bool success = TRUE; | 1307 | bool success = TRUE; |
1273 | struct stat status; | 1308 | struct stat status; |
1274 | 1309 | ||
1275 | QFile s( src ); | 1310 | QFile s( src ); |
1276 | QFile d( dest ); | 1311 | QFile d( dest ); |
1277 | 1312 | ||
1278 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 1313 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
1279 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 1314 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
1280 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 1315 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
1281 | success = FALSE; | 1316 | success = FALSE; |
1282 | break; | 1317 | break; |
1283 | } | 1318 | } |
1284 | } | 1319 | } |
1285 | if( success && (bytesRead > 0) ){ | 1320 | if( success && (bytesRead > 0) ){ |
1286 | d.writeBlock( bf, bytesRead ); | 1321 | d.writeBlock( bf, bytesRead ); |
1287 | } | 1322 | } |
1288 | } else { | 1323 | } else { |
1289 | success = FALSE; | 1324 | success = FALSE; |
1290 | } | 1325 | } |
1291 | 1326 | ||
1292 | // Set file permissions | 1327 | // Set file permissions |
1293 | if( stat( (const char *) src, &status ) == 0 ){ | 1328 | if( stat( (const char *) src, &status ) == 0 ){ |
1294 | chmod( (const char *) dest, status.st_mode ); | 1329 | chmod( (const char *) dest, status.st_mode ); |
1295 | } | 1330 | } |
1296 | 1331 | ||
1297 | return success; | 1332 | return success; |
1298 | } | 1333 | } |
1299 | 1334 | ||
1300 | void AdvancedFm::runCommand() { | 1335 | void AdvancedFm::runCommand() { |
1301 | QString curFile; | 1336 | QString curFile; |
1302 | if (TabWidget->currentPageIndex() == 0) { | 1337 | if (TabWidget->currentPageIndex() == 0) { |
1303 | if( Local_View->currentItem()) | 1338 | if( Local_View->currentItem()) |
1304 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1339 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1305 | } else { | 1340 | } else { |
1306 | if(Remote_View->currentItem()) | 1341 | if(Remote_View->currentItem()) |
1307 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1342 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1308 | } | 1343 | } |
1309 | 1344 | ||
1310 | InputDialog *fileDlg; | 1345 | InputDialog *fileDlg; |
1311 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1346 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1312 | fileDlg->setInputText(curFile); | 1347 | fileDlg->setInputText(curFile); |
1313 | fileDlg->exec(); | 1348 | fileDlg->exec(); |
1314 | QString command; | 1349 | QString command; |
1315 | if( fileDlg->result() == 1 ) { | 1350 | if( fileDlg->result() == 1 ) { |
1316 | command = fileDlg->LineEdit1->text(); | 1351 | command = fileDlg->LineEdit1->text(); |
1317 | 1352 | ||
1318 | int err=0; | 1353 | int err=0; |
1319 | Output *outDlg; | 1354 | Output *outDlg; |
1320 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1355 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1321 | outDlg->showMaximized(); | 1356 | outDlg->showMaximized(); |
1322 | outDlg->show(); | 1357 | outDlg->show(); |
1323 | qApp->processEvents(); | 1358 | qApp->processEvents(); |
1324 | FILE *fp; | 1359 | FILE *fp; |
1325 | char line[130]; | 1360 | char line[130]; |
1326 | sleep(1); | 1361 | sleep(1); |
1327 | // if(command.find("2>",0,TRUE) != -1) | 1362 | // if(command.find("2>",0,TRUE) != -1) |
1328 | command +=" 2>&1"; | 1363 | command +=" 2>&1"; |
1329 | fp = popen( (const char *) command, "r"); | 1364 | fp = popen( (const char *) command, "r"); |
1330 | if ( !fp ) { | 1365 | if ( !fp ) { |
1331 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1366 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1332 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1367 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1333 | pclose(fp); | 1368 | pclose(fp); |
1334 | return; | 1369 | return; |
1335 | } else { | 1370 | } else { |
1336 | while ( fgets( line, sizeof line, fp)) { | 1371 | while ( fgets( line, sizeof line, fp)) { |
1337 | QString lineStr = line; | 1372 | QString lineStr = line; |
1338 | lineStr=lineStr.left(lineStr.length()-1); | 1373 | lineStr=lineStr.left(lineStr.length()-1); |
1339 | outDlg->OutputEdit->append(lineStr); | 1374 | outDlg->OutputEdit->append(lineStr); |
1340 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1375 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1341 | } | 1376 | } |
1342 | } | 1377 | } |
1343 | } | 1378 | } |
1344 | } | 1379 | } |
1345 | 1380 | ||
1346 | void AdvancedFm::runCommandStd() { | 1381 | void AdvancedFm::runCommandStd() { |
1347 | QString curFile; | 1382 | QString curFile; |
1348 | if (TabWidget->currentPageIndex() == 0) { | 1383 | if (TabWidget->currentPageIndex() == 0) { |
1349 | if( Local_View->currentItem()) | 1384 | if( Local_View->currentItem()) |
1350 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); | 1385 | curFile = currentDir.canonicalPath() + Local_View->currentItem()->text(0); |
1351 | } else { | 1386 | } else { |
1352 | if(Remote_View->currentItem()) | 1387 | if(Remote_View->currentItem()) |
1353 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); | 1388 | curFile = currentRemoteDir.canonicalPath() + Remote_View->currentItem()->text(0); |
1354 | } | 1389 | } |
1355 | 1390 | ||
1356 | InputDialog *fileDlg; | 1391 | InputDialog *fileDlg; |
1357 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 1392 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
1358 | fileDlg->setInputText(curFile); | 1393 | fileDlg->setInputText(curFile); |
1359 | fileDlg->exec(); | 1394 | fileDlg->exec(); |
1360 | QString command; | 1395 | QString command; |
1361 | if( fileDlg->result() == 1 ) { | 1396 | if( fileDlg->result() == 1 ) { |
1362 | qApp->processEvents(); | 1397 | qApp->processEvents(); |
1363 | command = fileDlg->LineEdit1->text() + " &"; | 1398 | command = fileDlg->LineEdit1->text() + " &"; |
1364 | system(command.latin1()); | 1399 | system(command.latin1()); |
1365 | } | 1400 | } |
1366 | } | 1401 | } |
1367 | 1402 | ||
1368 | void AdvancedFm::fileStatus() { | 1403 | void AdvancedFm::fileStatus() { |
1369 | QString curFile; | 1404 | QString curFile; |
1370 | if (TabWidget->currentPageIndex() == 0) { | 1405 | if (TabWidget->currentPageIndex() == 0) { |
1371 | curFile = Local_View->currentItem()->text(0); | 1406 | curFile = Local_View->currentItem()->text(0); |
1372 | } else { | 1407 | } else { |
1373 | curFile = Remote_View->currentItem()->text(0); | 1408 | curFile = Remote_View->currentItem()->text(0); |
1374 | } | 1409 | } |
1375 | QString command = " stat -l "+ curFile +" 2>&1"; | 1410 | QString command = " stat -l "+ curFile +" 2>&1"; |
1376 | int err=0; | 1411 | int err=0; |
1377 | Output *outDlg; | 1412 | Output *outDlg; |
1378 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 1413 | outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
1379 | outDlg->showMaximized(); | 1414 | outDlg->showMaximized(); |
1380 | outDlg->show(); | 1415 | outDlg->show(); |
1381 | qApp->processEvents(); | 1416 | qApp->processEvents(); |
1382 | FILE *fp; | 1417 | FILE *fp; |
1383 | char line[130]; | 1418 | char line[130]; |
1384 | sleep(1); | 1419 | sleep(1); |
1385 | fp = popen( (const char *) command, "r"); | 1420 | fp = popen( (const char *) command, "r"); |
1386 | if ( !fp ) { | 1421 | if ( !fp ) { |
1387 | qDebug("Could not execute '" + command + "'! err=%d", fp); | 1422 | qDebug("Could not execute '" + command + "'! err=%d", fp); |
1388 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); | 1423 | QMessageBox::warning( this, tr("AdvancedFm"), tr("command failed!"), tr("&OK") ); |
1389 | pclose(fp); | 1424 | pclose(fp); |
1390 | return; | 1425 | return; |
1391 | } else { | 1426 | } else { |
1392 | while ( fgets( line, sizeof line, fp)) { | 1427 | while ( fgets( line, sizeof line, fp)) { |
1393 | outDlg->OutputEdit->append(line); | 1428 | outDlg->OutputEdit->append(line); |
1394 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 1429 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
1395 | 1430 | ||
1396 | } | 1431 | } |
1397 | 1432 | ||
1398 | } | 1433 | } |
1399 | } | 1434 | } |
1400 | 1435 | ||
1401 | void AdvancedFm::mkDir() { | 1436 | void AdvancedFm::mkDir() { |
1402 | if (TabWidget->currentPageIndex() == 0) | 1437 | if (TabWidget->currentPageIndex() == 0) |
1403 | localMakDir(); | 1438 | localMakDir(); |
1404 | else | 1439 | else |
1405 | remoteMakDir(); | 1440 | remoteMakDir(); |
1406 | 1441 | ||
1407 | } | 1442 | } |
1408 | 1443 | ||
1409 | void AdvancedFm::rn() { | 1444 | void AdvancedFm::rn() { |
1410 | if (TabWidget->currentPageIndex() == 0) | 1445 | if (TabWidget->currentPageIndex() == 0) |
1411 | localRename(); | 1446 | localRename(); |
1412 | else | 1447 | else |
1413 | remoteRename(); | 1448 | remoteRename(); |
1414 | 1449 | ||
1415 | } | 1450 | } |
1416 | 1451 | ||
1417 | void AdvancedFm::del() { | 1452 | void AdvancedFm::del() { |
1418 | if (TabWidget->currentPageIndex() == 0) | 1453 | if (TabWidget->currentPageIndex() == 0) |
1419 | localDelete(); | 1454 | localDelete(); |
1420 | else | 1455 | else |
1421 | remoteDelete(); | 1456 | remoteDelete(); |
1422 | } | 1457 | } |
1423 | 1458 | ||
1424 | void AdvancedFm::doAbout() { | 1459 | void AdvancedFm::doAbout() { |
1425 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" | 1460 | QMessageBox::message("AdvancedFm","Advanced FileManager\n" |
1426 | "is copyright 2002 by\n" | 1461 | "is copyright 2002 by\n" |
1427 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1462 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1428 | "and is licensed by the GPL"); | 1463 | "and is licensed by the GPL"); |
1429 | } | 1464 | } |
1430 | 1465 | ||
1431 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) | 1466 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) |
1432 | { | 1467 | { |
1433 | switch ( e->key() ) { | 1468 | switch ( e->key() ) { |
1434 | case Key_Delete: | 1469 | case Key_Delete: |
1435 | del(); | 1470 | del(); |
1436 | break; | 1471 | break; |
1437 | case Key_H: | 1472 | case Key_H: |
1438 | showHidden(); | 1473 | showHidden(); |
1439 | break; | 1474 | break; |
1440 | case Key_E: | 1475 | case Key_E: |
1441 | runThis(); | 1476 | runThis(); |
1442 | break; | 1477 | break; |
1443 | case Key_C: | 1478 | case Key_C: |
1444 | copy(); | 1479 | copy(); |
1445 | break; | 1480 | break; |
1446 | case Key_A: | 1481 | case Key_A: |
1447 | copyAs(); | 1482 | copyAs(); |
1448 | break; | 1483 | break; |
1449 | case Key_M: | 1484 | case Key_M: |
1450 | move(); | 1485 | move(); |
1451 | break; | 1486 | break; |
1452 | case Key_R: | 1487 | case Key_R: |
1453 | rn(); | 1488 | rn(); |
1454 | break; | 1489 | break; |
1455 | case Key_I: | 1490 | case Key_I: |
1456 | fileStatus(); | 1491 | fileStatus(); |
1457 | break; | 1492 | break; |
1458 | case Key_U: | 1493 | case Key_U: |
1459 | upDir(); | 1494 | upDir(); |
1460 | break; | 1495 | break; |
1461 | case Key_P: | 1496 | case Key_P: |
1462 | filePerms(); | 1497 | filePerms(); |
1463 | break; | 1498 | break; |
1464 | case Key_N: | 1499 | case Key_N: |
1465 | mkDir(); | 1500 | mkDir(); |
1466 | break; | 1501 | break; |
1467 | case Key_1: | 1502 | case Key_1: |
1468 | switchToLocalTab(); | 1503 | switchToLocalTab(); |
1469 | break; | 1504 | break; |
1470 | case Key_2: | 1505 | case Key_2: |
1471 | switchToRemoteTab(); | 1506 | switchToRemoteTab(); |
1472 | break; | 1507 | break; |
1473 | case Key_3: | 1508 | case Key_3: |
1474 | CFButtonPushed(); | 1509 | CFButtonPushed(); |
1475 | break; | 1510 | break; |
1476 | case Key_4: | 1511 | case Key_4: |
1477 | SDButtonPushed(); | 1512 | SDButtonPushed(); |
1478 | break; | 1513 | break; |
1479 | case Key_5: | 1514 | case Key_5: |
1480 | homeButtonPushed(); | 1515 | homeButtonPushed(); |
1481 | break; | 1516 | break; |
1482 | case Key_6: | 1517 | case Key_6: |
1483 | docButtonPushed(); | 1518 | docButtonPushed(); |
1484 | break; | 1519 | break; |
1485 | case Key_7: | 1520 | case Key_7: |
1486 | break; | 1521 | break; |
1487 | case Key_8: | 1522 | case Key_8: |
1488 | break; | 1523 | break; |
1489 | case Key_9: | 1524 | case Key_9: |
1490 | break; | 1525 | break; |
1491 | case Key_0: | 1526 | case Key_0: |
1492 | break; | 1527 | break; |
1493 | 1528 | ||
1494 | 1529 | ||
1495 | 1530 | ||
1496 | } | 1531 | } |
1497 | 1532 | ||
1498 | } | 1533 | } |
1499 | 1534 | ||
1500 | void AdvancedFm::mkSym() { | 1535 | void AdvancedFm::mkSym() { |
1501 | QString cmd; | 1536 | QString cmd; |
1502 | if (TabWidget->currentPageIndex() == 0) { | 1537 | if (TabWidget->currentPageIndex() == 0) { |
1503 | QString curFile = Local_View->currentItem()->text(0); | 1538 | QString curFile = Local_View->currentItem()->text(0); |
1504 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); | 1539 | if(curFile.right(1) == "/") curFile = curFile.left(curFile.length() - 1); |
1505 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; | 1540 | QString destName = currentRemoteDir.canonicalPath()+"/"+curFile; |
1506 | curFile = currentDir.canonicalPath()+"/"+curFile; | 1541 | curFile = currentDir.canonicalPath()+"/"+curFile; |
1507 | cmd = "ln -s "+curFile+" "+destName; | 1542 | cmd = "ln -s "+curFile+" "+destName; |