-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 18952c3..9606269 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -684,513 +684,513 @@ void AdvancedFm::showLocalMenu(QListViewItem * item) | |||
684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 684 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
685 | m.insertSeparator(); | 685 | m.insertSeparator(); |
686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 686 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
687 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 687 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
688 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 688 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
689 | m.setCheckable(TRUE); | 689 | m.setCheckable(TRUE); |
690 | if (!b) | 690 | if (!b) |
691 | m.setItemChecked(m.idAt(0),TRUE); | 691 | m.setItemChecked(m.idAt(0),TRUE); |
692 | else | 692 | else |
693 | m.setItemChecked(m.idAt(0),FALSE); | 693 | m.setItemChecked(m.idAt(0),FALSE); |
694 | m.exec( QCursor::pos() ); | 694 | m.exec( QCursor::pos() ); |
695 | } | 695 | } |
696 | } | 696 | } |
697 | 697 | ||
698 | void AdvancedFm::showRemoteMenu(QListViewItem * item) | 698 | void AdvancedFm::showRemoteMenu(QListViewItem * item) |
699 | { | 699 | { |
700 | if(item) { | 700 | if(item) { |
701 | QPopupMenu m; | 701 | QPopupMenu m; |
702 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); | 702 | m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showRemoteHidden() )); |
703 | m.insertSeparator(); | 703 | m.insertSeparator(); |
704 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) | 704 | if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) |
705 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); | 705 | m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); |
706 | else | 706 | else |
707 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); | 707 | m.insertItem( tr( "Open / Execute" ), this, SLOT( runThis() )); |
708 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); | 708 | m.insertItem( tr( "Open as Text" ), this, SLOT( runText() )); |
709 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 709 | m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
710 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); | 710 | m.insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() )); |
711 | m.insertSeparator(); | 711 | m.insertSeparator(); |
712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 712 | m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
713 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); | 713 | m.insertItem( tr( "Copy" ), this, SLOT( copy() )); |
714 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); | 714 | m.insertItem( tr( "Copy As" ), this, SLOT( copyAs() )); |
715 | m.insertItem( tr( "Move" ), this, SLOT( move() )); | 715 | m.insertItem( tr( "Move" ), this, SLOT( move() )); |
716 | m.insertSeparator(); | 716 | m.insertSeparator(); |
717 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); | 717 | m.insertItem( tr( "Rescan" ), this, SLOT( populateRemoteView() )); |
718 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); | 718 | m.insertItem( tr( "Run Command" ), this, SLOT( runCommand() )); |
719 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); | 719 | m.insertItem( tr( "File Info" ), this, SLOT( fileStatus() )); |
720 | m.insertSeparator(); | 720 | m.insertSeparator(); |
721 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); | 721 | m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); |
722 | m.insertSeparator(); | 722 | m.insertSeparator(); |
723 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); | 723 | m.insertItem( tr( "Set Permissions" ), this, SLOT( filePerms() )); |
724 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings | 724 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) //bad hack for Sharp zaurus failings |
725 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); | 725 | m.insertItem( tr( "Properties" ), this, SLOT( doProperties() )); |
726 | m.setCheckable(TRUE); | 726 | m.setCheckable(TRUE); |
727 | if (!b) | 727 | if (!b) |
728 | m.setItemChecked(m.idAt(0),TRUE); | 728 | m.setItemChecked(m.idAt(0),TRUE); |
729 | else | 729 | else |
730 | m.setItemChecked(m.idAt(0),FALSE); | 730 | m.setItemChecked(m.idAt(0),FALSE); |
731 | m.exec( QCursor::pos() ); | 731 | m.exec( QCursor::pos() ); |
732 | } | 732 | } |
733 | } | 733 | } |
734 | 734 | ||
735 | void AdvancedFm::runThis() { | 735 | void AdvancedFm::runThis() { |
736 | // QFileInfo *fi; | 736 | // QFileInfo *fi; |
737 | QString fs; | 737 | QString fs; |
738 | if (TabWidget->currentPageIndex() == 0) { | 738 | if (TabWidget->currentPageIndex() == 0) { |
739 | QString curFile = Local_View->currentItem()->text(0); | 739 | QString curFile = Local_View->currentItem()->text(0); |
740 | 740 | ||
741 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 741 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
742 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 742 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
743 | qDebug( fileInfo.owner()); | 743 | qDebug( fileInfo.owner()); |
744 | if( (fileInfo.permission( QFileInfo::ExeUser) | 744 | if( (fileInfo.permission( QFileInfo::ExeUser) |
745 | | fileInfo.permission( QFileInfo::ExeGroup) | 745 | | fileInfo.permission( QFileInfo::ExeGroup) |
746 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 746 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
747 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 747 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
748 | // if( fileInfo.isExecutable() | | 748 | // if( fileInfo.isExecutable() | |
749 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 749 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
750 | e << curFile; | 750 | e << curFile; |
751 | } else { | 751 | } else { |
752 | curFile = currentDir.canonicalPath()+"/"+curFile; | 752 | curFile = currentDir.canonicalPath()+"/"+curFile; |
753 | DocLnk nf(curFile); | 753 | DocLnk nf(curFile); |
754 | QString execStr = nf.exec(); | 754 | QString execStr = nf.exec(); |
755 | qDebug( execStr); | 755 | qDebug( execStr); |
756 | if( execStr.isEmpty() ) { | 756 | if( execStr.isEmpty() ) { |
757 | } else { | 757 | } else { |
758 | nf.execute(); | 758 | nf.execute(); |
759 | } | 759 | } |
760 | } | 760 | } |
761 | // MimeType mt( curFile); | 761 | // MimeType mt( curFile); |
762 | } else { | 762 | } else { |
763 | QString curFile = Remote_View->currentItem()->text(0); | 763 | QString curFile = Remote_View->currentItem()->text(0); |
764 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 764 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
765 | qDebug("Filesystemtype is "+fs); | 765 | qDebug("Filesystemtype is "+fs); |
766 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 766 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
767 | if( (fileInfo.permission( QFileInfo::ExeUser) | 767 | if( (fileInfo.permission( QFileInfo::ExeUser) |
768 | | fileInfo.permission( QFileInfo::ExeGroup) | 768 | | fileInfo.permission( QFileInfo::ExeGroup) |
769 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { | 769 | | fileInfo.permission( QFileInfo::ExeOther)) // & fs.find("vfat",0,TRUE) == -1) { |
770 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 770 | | fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
771 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 771 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
772 | e << curFile; | 772 | e << curFile; |
773 | } else { | 773 | } else { |
774 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 774 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
775 | DocLnk nf(curFile); | 775 | DocLnk nf(curFile); |
776 | QString execStr = nf.exec(); | 776 | QString execStr = nf.exec(); |
777 | qDebug(execStr); | 777 | qDebug(execStr); |
778 | if( execStr.isEmpty() ) { | 778 | if( execStr.isEmpty() ) { |
779 | } else { | 779 | } else { |
780 | nf.execute(); | 780 | nf.execute(); |
781 | } | 781 | } |
782 | } | 782 | } |
783 | // MimeType mt( curFile); | 783 | // MimeType mt( curFile); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | 786 | ||
787 | void AdvancedFm::runText() { | 787 | void AdvancedFm::runText() { |
788 | if (TabWidget->currentPageIndex() == 0) { | 788 | if (TabWidget->currentPageIndex() == 0) { |
789 | QString curFile = Local_View->currentItem()->text(0); | 789 | QString curFile = Local_View->currentItem()->text(0); |
790 | curFile = currentDir.canonicalPath()+"/"+curFile; | 790 | curFile = currentDir.canonicalPath()+"/"+curFile; |
791 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 791 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
792 | e << curFile; | 792 | e << curFile; |
793 | } else { | 793 | } else { |
794 | QString curFile = Remote_View->currentItem()->text(0); | 794 | QString curFile = Remote_View->currentItem()->text(0); |
795 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 795 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
796 | DocLnk nf(curFile); | 796 | DocLnk nf(curFile); |
797 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 797 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
798 | e << curFile; | 798 | e << curFile; |
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||
802 | void AdvancedFm::localMakDir() | 802 | void AdvancedFm::localMakDir() |
803 | { | 803 | { |
804 | InputDialog *fileDlg; | 804 | InputDialog *fileDlg; |
805 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 805 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
806 | fileDlg->exec(); | 806 | fileDlg->exec(); |
807 | if( fileDlg->result() == 1 ) { | 807 | if( fileDlg->result() == 1 ) { |
808 | QString filename = fileDlg->LineEdit1->text(); | 808 | QString filename = fileDlg->LineEdit1->text(); |
809 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 809 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
810 | } | 810 | } |
811 | populateLocalView(); | 811 | populateLocalView(); |
812 | } | 812 | } |
813 | 813 | ||
814 | void AdvancedFm::remoteMakDir() | 814 | void AdvancedFm::remoteMakDir() |
815 | { | 815 | { |
816 | InputDialog *fileDlg; | 816 | InputDialog *fileDlg; |
817 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 817 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
818 | fileDlg->exec(); | 818 | fileDlg->exec(); |
819 | if( fileDlg->result() == 1 ) { | 819 | if( fileDlg->result() == 1 ) { |
820 | QString filename = fileDlg->LineEdit1->text(); | 820 | QString filename = fileDlg->LineEdit1->text(); |
821 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 821 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
822 | } | 822 | } |
823 | populateRemoteView(); | 823 | populateRemoteView(); |
824 | } | 824 | } |
825 | 825 | ||
826 | void AdvancedFm::localDelete() | 826 | void AdvancedFm::localDelete() |
827 | { | 827 | { |
828 | QStringList curFileList = getPath(); | 828 | QStringList curFileList = getPath(); |
829 | QString myFile; | 829 | QString myFile; |
830 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 830 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
831 | myFile = (*it); | 831 | myFile = (*it); |
832 | if( myFile.find(" -> ",0,TRUE) != -1) | 832 | if( myFile.find(" -> ",0,TRUE) != -1) |
833 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 833 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
834 | 834 | ||
835 | QString f = currentDir.canonicalPath(); | 835 | QString f = currentDir.canonicalPath(); |
836 | if(f.right(1).find("/",0,TRUE) == -1) | 836 | if(f.right(1).find("/",0,TRUE) == -1) |
837 | f+="/"; | 837 | f+="/"; |
838 | f+=myFile; | 838 | f+=myFile; |
839 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 839 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
840 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 840 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
841 | "\nand all it's contents ?" | 841 | "\nand all it's contents ?" |
842 | ,tr("Yes"),tr("No"),0,0,1) ) { | 842 | ,tr("Yes"),tr("No"),0,0,1) ) { |
843 | case 0: { | 843 | case 0: { |
844 | f=f.left(f.length()-1); | 844 | f=f.left(f.length()-1); |
845 | QString cmd="rm -rf "+f; | 845 | QString cmd="rm -rf "+f; |
846 | system( cmd.latin1()); | 846 | system( cmd.latin1()); |
847 | populateLocalView(); | 847 | populateLocalView(); |
848 | } | 848 | } |
849 | break; | 849 | break; |
850 | case 1: | 850 | case 1: |
851 | // exit | 851 | // exit |
852 | break; | 852 | break; |
853 | }; | 853 | }; |
854 | 854 | ||
855 | } else { | 855 | } else { |
856 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 856 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
857 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 857 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
858 | case 0: { | 858 | case 0: { |
859 | QString cmd="rm "+f; | 859 | QString cmd="rm "+f; |
860 | QFile file(f); | 860 | QFile file(f); |
861 | file.remove(); | 861 | file.remove(); |
862 | // system( cmd.latin1()); | 862 | // system( cmd.latin1()); |
863 | populateLocalView(); | 863 | populateLocalView(); |
864 | } | 864 | } |
865 | break; | 865 | break; |
866 | case 1: | 866 | case 1: |
867 | // exit | 867 | // exit |
868 | break; | 868 | break; |
869 | }; | 869 | }; |
870 | } | 870 | } |
871 | } | 871 | } |
872 | } | 872 | } |
873 | 873 | ||
874 | void AdvancedFm::remoteDelete() | 874 | void AdvancedFm::remoteDelete() |
875 | { | 875 | { |
876 | QStringList curFileList = getPath(); | 876 | QStringList curFileList = getPath(); |
877 | QString myFile; | 877 | QString myFile; |
878 | 878 | ||
879 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 879 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
880 | myFile = (*it); | 880 | myFile = (*it); |
881 | if(myFile.find(" -> ",0,TRUE) != -1) | 881 | if(myFile.find(" -> ",0,TRUE) != -1) |
882 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 882 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
883 | QString f = currentRemoteDir.canonicalPath(); | 883 | QString f = currentRemoteDir.canonicalPath(); |
884 | if(f.right(1).find("/",0,TRUE) == -1) | 884 | if(f.right(1).find("/",0,TRUE) == -1) |
885 | f+="/"; | 885 | f+="/"; |
886 | f+=myFile; | 886 | f+=myFile; |
887 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 887 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
888 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ | 888 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
889 | "\nand all it's contents ?", | 889 | "\nand all it's contents ?", |
890 | tr("Yes"),tr("No"),0,0,1) ) { | 890 | tr("Yes"),tr("No"),0,0,1) ) { |
891 | case 0: { | 891 | case 0: { |
892 | f=f.left(f.length()-1); | 892 | f=f.left(f.length()-1); |
893 | QString cmd="rm -rf "+f; | 893 | QString cmd="rm -rf "+f; |
894 | system( cmd.latin1()); | 894 | system( cmd.latin1()); |
895 | populateRemoteView(); | 895 | populateRemoteView(); |
896 | } | 896 | } |
897 | break; | 897 | break; |
898 | case 1: | 898 | case 1: |
899 | // exit | 899 | // exit |
900 | break; | 900 | break; |
901 | }; | 901 | }; |
902 | 902 | ||
903 | } else { | 903 | } else { |
904 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 904 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
905 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 905 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
906 | case 0: { | 906 | case 0: { |
907 | QString cmd="rm "+f; | 907 | QString cmd="rm "+f; |
908 | QFile file(f); | 908 | QFile file(f); |
909 | file.remove(); | 909 | file.remove(); |
910 | // system( cmd.latin1()); | 910 | // system( cmd.latin1()); |
911 | populateRemoteView(); | 911 | populateRemoteView(); |
912 | } | 912 | } |
913 | break; | 913 | break; |
914 | case 1: | 914 | case 1: |
915 | // exit | 915 | // exit |
916 | break; | 916 | break; |
917 | }; | 917 | }; |
918 | } | 918 | } |
919 | } | 919 | } |
920 | } | 920 | } |
921 | 921 | ||
922 | void AdvancedFm::localRename() | 922 | void AdvancedFm::localRename() |
923 | { | 923 | { |
924 | QString curFile = Local_View->currentItem()->text(0); | 924 | QString curFile = Local_View->currentItem()->text(0); |
925 | InputDialog *fileDlg; | 925 | InputDialog *fileDlg; |
926 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 926 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
927 | fileDlg->setInputText((const QString &)curFile); | 927 | fileDlg->setInputText((const QString &)curFile); |
928 | fileDlg->exec(); | 928 | fileDlg->exec(); |
929 | if( fileDlg->result() == 1 ) { | 929 | if( fileDlg->result() == 1 ) { |
930 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 930 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
931 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 931 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
932 | if( rename(oldname.latin1(), newName.latin1())== -1) | 932 | if( rename(oldname.latin1(), newName.latin1())== -1) |
933 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 933 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
934 | } | 934 | } |
935 | populateLocalView(); | 935 | populateLocalView(); |
936 | } | 936 | } |
937 | 937 | ||
938 | void AdvancedFm::remoteRename() | 938 | void AdvancedFm::remoteRename() |
939 | { | 939 | { |
940 | QString curFile = Local_View->currentItem()->text(0); | 940 | QString curFile = remote_View->currentItem()->text(0); |
941 | InputDialog *fileDlg; | 941 | InputDialog *fileDlg; |
942 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 942 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
943 | fileDlg->setInputText((const QString &)curFile); | 943 | fileDlg->setInputText((const QString &)curFile); |
944 | fileDlg->exec(); | 944 | fileDlg->exec(); |
945 | if( fileDlg->result() == 1 ) { | 945 | if( fileDlg->result() == 1 ) { |
946 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 946 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
947 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 947 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
948 | if( rename(oldname.latin1(), newName.latin1())== -1) | 948 | if( rename(oldname.latin1(), newName.latin1())== -1) |
949 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 949 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
950 | } | 950 | } |
951 | populateRemoteView(); | 951 | populateRemoteView(); |
952 | } | 952 | } |
953 | 953 | ||
954 | void AdvancedFm::switchToLocalTab() | 954 | void AdvancedFm::switchToLocalTab() |
955 | { | 955 | { |
956 | TabWidget->setCurrentPage(0); | 956 | TabWidget->setCurrentPage(0); |
957 | Local_View->setFocus(); | 957 | Local_View->setFocus(); |
958 | } | 958 | } |
959 | 959 | ||
960 | void AdvancedFm::switchToRemoteTab() | 960 | void AdvancedFm::switchToRemoteTab() |
961 | { | 961 | { |
962 | TabWidget->setCurrentPage(1); | 962 | TabWidget->setCurrentPage(1); |
963 | Remote_View->setFocus(); | 963 | Remote_View->setFocus(); |
964 | } | 964 | } |
965 | 965 | ||
966 | void AdvancedFm::readConfig() | 966 | void AdvancedFm::readConfig() |
967 | { | 967 | { |
968 | Config cfg("AdvancedFm"); | 968 | Config cfg("AdvancedFm"); |
969 | } | 969 | } |
970 | 970 | ||
971 | void AdvancedFm::writeConfig() | 971 | void AdvancedFm::writeConfig() |
972 | { | 972 | { |
973 | Config cfg("AdvancedFm"); | 973 | Config cfg("AdvancedFm"); |
974 | } | 974 | } |
975 | 975 | ||
976 | void AdvancedFm::currentPathComboChanged() | 976 | void AdvancedFm::currentPathComboChanged() |
977 | { | 977 | { |
978 | if (TabWidget->currentPageIndex() == 0) { | 978 | if (TabWidget->currentPageIndex() == 0) { |
979 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 979 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
980 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 980 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
981 | populateLocalView(); | 981 | populateLocalView(); |
982 | } else { | 982 | } else { |
983 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 983 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
984 | } | 984 | } |
985 | } | 985 | } |
986 | if (TabWidget->currentPageIndex() == 0) { | 986 | if (TabWidget->currentPageIndex() == 0) { |
987 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 987 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
988 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 988 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
989 | populateRemoteView(); | 989 | populateRemoteView(); |
990 | } else { | 990 | } else { |
991 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 991 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
992 | } | 992 | } |
993 | } | 993 | } |
994 | } | 994 | } |
995 | 995 | ||
996 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 996 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
997 | 997 | ||
998 | if (TabWidget->currentPageIndex() == 0) { | 998 | if (TabWidget->currentPageIndex() == 0) { |
999 | currentPathCombo->lineEdit()->setText( currentPath); | 999 | currentPathCombo->lineEdit()->setText( currentPath); |
1000 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 1000 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
1001 | currentPathCombo->clear(); | 1001 | currentPathCombo->clear(); |
1002 | localDirPathStringList.prepend( currentPath ); | 1002 | localDirPathStringList.prepend( currentPath ); |
1003 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 1003 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
1004 | } | 1004 | } |
1005 | } else { | 1005 | } else { |
1006 | currentPathCombo->lineEdit()->setText( currentPath); | 1006 | currentPathCombo->lineEdit()->setText( currentPath); |
1007 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 1007 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
1008 | currentPathCombo->clear(); | 1008 | currentPathCombo->clear(); |
1009 | remoteDirPathStringList.prepend( currentPath ); | 1009 | remoteDirPathStringList.prepend( currentPath ); |
1010 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 1010 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
1011 | } | 1011 | } |
1012 | } | 1012 | } |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { | 1015 | void AdvancedFm::currentPathComboActivated(const QString & currentPath) { |
1016 | if (TabWidget->currentPageIndex() == 0) { | 1016 | if (TabWidget->currentPageIndex() == 0) { |
1017 | chdir( currentPath.latin1() ); | 1017 | chdir( currentPath.latin1() ); |
1018 | currentDir.cd( currentPath, TRUE); | 1018 | currentDir.cd( currentPath, TRUE); |
1019 | populateLocalView(); | 1019 | populateLocalView(); |
1020 | update(); | 1020 | update(); |
1021 | } else { | 1021 | } else { |
1022 | chdir( currentPath.latin1() ); | 1022 | chdir( currentPath.latin1() ); |
1023 | currentRemoteDir.cd( currentPath, TRUE); | 1023 | currentRemoteDir.cd( currentPath, TRUE); |
1024 | populateRemoteView(); | 1024 | populateRemoteView(); |
1025 | update(); | 1025 | update(); |
1026 | } | 1026 | } |
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | void AdvancedFm::filePerms() { | 1029 | void AdvancedFm::filePerms() { |
1030 | 1030 | ||
1031 | QStringList curFileList = getPath(); | 1031 | QStringList curFileList = getPath(); |
1032 | QString filePath; | 1032 | QString filePath; |
1033 | 1033 | ||
1034 | if (TabWidget->currentPageIndex() == 0) { | 1034 | if (TabWidget->currentPageIndex() == 0) { |
1035 | filePath = currentDir.canonicalPath()+"/"; | 1035 | filePath = currentDir.canonicalPath()+"/"; |
1036 | } else { | 1036 | } else { |
1037 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1037 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1040 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1041 | filePermissions *filePerm; | 1041 | filePermissions *filePerm; |
1042 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); | 1042 | filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); |
1043 | filePerm->showMaximized(); | 1043 | filePerm->showMaximized(); |
1044 | filePerm->exec(); | 1044 | filePerm->exec(); |
1045 | if( filePerm) | 1045 | if( filePerm) |
1046 | delete filePerm; | 1046 | delete filePerm; |
1047 | } | 1047 | } |
1048 | if (TabWidget->currentPageIndex() == 0) { | 1048 | if (TabWidget->currentPageIndex() == 0) { |
1049 | populateLocalView(); | 1049 | populateLocalView(); |
1050 | } else { | 1050 | } else { |
1051 | populateRemoteView(); | 1051 | populateRemoteView(); |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | 1054 | ||
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | void AdvancedFm::doProperties() { | 1057 | void AdvancedFm::doProperties() { |
1058 | QStringList curFileList = getPath(); | 1058 | QStringList curFileList = getPath(); |
1059 | QString filePath; | 1059 | QString filePath; |
1060 | if (TabWidget->currentPageIndex() == 0) { | 1060 | if (TabWidget->currentPageIndex() == 0) { |
1061 | 1061 | ||
1062 | filePath = currentDir.canonicalPath()+"/"; | 1062 | filePath = currentDir.canonicalPath()+"/"; |
1063 | } else { | 1063 | } else { |
1064 | filePath= currentRemoteDir.canonicalPath()+"/"; | 1064 | filePath= currentRemoteDir.canonicalPath()+"/"; |
1065 | } | 1065 | } |
1066 | // qDebug("%d",curFileList.count()); | 1066 | // qDebug("%d",curFileList.count()); |
1067 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1067 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1068 | qDebug((filePath+*it)); | 1068 | qDebug((filePath+*it)); |
1069 | DocLnk lnk( (filePath+*it)); | 1069 | DocLnk lnk( (filePath+*it)); |
1070 | LnkProperties prop( &lnk ); | 1070 | LnkProperties prop( &lnk ); |
1071 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 1071 | // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
1072 | prop.showMaximized(); | 1072 | prop.showMaximized(); |
1073 | prop.exec(); | 1073 | prop.exec(); |
1074 | } | 1074 | } |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | QStringList AdvancedFm::getPath() { | 1077 | QStringList AdvancedFm::getPath() { |
1078 | QStringList strList; | 1078 | QStringList strList; |
1079 | if (TabWidget->currentPageIndex() == 0) { | 1079 | if (TabWidget->currentPageIndex() == 0) { |
1080 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); | 1080 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
1081 | QListViewItemIterator it( Local_View ); | 1081 | QListViewItemIterator it( Local_View ); |
1082 | for ( ; it.current(); ++it ) { | 1082 | for ( ; it.current(); ++it ) { |
1083 | if ( it.current()->isSelected() ) { | 1083 | if ( it.current()->isSelected() ) { |
1084 | strList << it.current()->text(0); | 1084 | strList << it.current()->text(0); |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | return strList; | 1087 | return strList; |
1088 | } else { | 1088 | } else { |
1089 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | 1089 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
1090 | QListViewItemIterator it( Remote_View ); | 1090 | QListViewItemIterator it( Remote_View ); |
1091 | for ( ; it.current(); ++it ) { | 1091 | for ( ; it.current(); ++it ) { |
1092 | if ( it.current()->isSelected() ) { | 1092 | if ( it.current()->isSelected() ) { |
1093 | strList << it.current()->text(0); | 1093 | strList << it.current()->text(0); |
1094 | } | 1094 | } |
1095 | } | 1095 | } |
1096 | return strList; | 1096 | return strList; |
1097 | } | 1097 | } |
1098 | return ""; | 1098 | return ""; |
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void AdvancedFm::homeButtonPushed() { | 1101 | void AdvancedFm::homeButtonPushed() { |
1102 | QString current = QDir::homeDirPath(); | 1102 | QString current = QDir::homeDirPath(); |
1103 | chdir( current.latin1() ); | 1103 | chdir( current.latin1() ); |
1104 | if (TabWidget->currentPageIndex() == 0) { | 1104 | if (TabWidget->currentPageIndex() == 0) { |
1105 | currentDir.cd( current, TRUE); | 1105 | currentDir.cd( current, TRUE); |
1106 | populateLocalView(); | 1106 | populateLocalView(); |
1107 | } else { | 1107 | } else { |
1108 | currentRemoteDir.cd( current, TRUE); | 1108 | currentRemoteDir.cd( current, TRUE); |
1109 | populateRemoteView(); | 1109 | populateRemoteView(); |
1110 | } | 1110 | } |
1111 | update(); | 1111 | update(); |
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | void AdvancedFm::docButtonPushed() { | 1114 | void AdvancedFm::docButtonPushed() { |
1115 | QString current = QPEApplication::documentDir(); | 1115 | QString current = QPEApplication::documentDir(); |
1116 | chdir( current.latin1() ); | 1116 | chdir( current.latin1() ); |
1117 | if (TabWidget->currentPageIndex() == 0) { | 1117 | if (TabWidget->currentPageIndex() == 0) { |
1118 | currentDir.cd( current, TRUE); | 1118 | currentDir.cd( current, TRUE); |
1119 | populateLocalView(); | 1119 | populateLocalView(); |
1120 | } else { | 1120 | } else { |
1121 | currentRemoteDir.cd( current, TRUE); | 1121 | currentRemoteDir.cd( current, TRUE); |
1122 | populateRemoteView(); | 1122 | populateRemoteView(); |
1123 | } | 1123 | } |
1124 | update(); | 1124 | update(); |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | void AdvancedFm::SDButtonPushed() { | 1127 | void AdvancedFm::SDButtonPushed() { |
1128 | QString current = "/mnt/card"; | 1128 | QString current = "/mnt/card"; |
1129 | chdir( current.latin1() ); | 1129 | chdir( current.latin1() ); |
1130 | if (TabWidget->currentPageIndex() == 0) { | 1130 | if (TabWidget->currentPageIndex() == 0) { |
1131 | currentDir.cd( current, TRUE); | 1131 | currentDir.cd( current, TRUE); |
1132 | populateLocalView(); | 1132 | populateLocalView(); |
1133 | } else { | 1133 | } else { |
1134 | currentRemoteDir.cd( current, TRUE); | 1134 | currentRemoteDir.cd( current, TRUE); |
1135 | populateRemoteView(); | 1135 | populateRemoteView(); |
1136 | } | 1136 | } |
1137 | update(); | 1137 | update(); |
1138 | 1138 | ||
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | void AdvancedFm::CFButtonPushed() { | 1141 | void AdvancedFm::CFButtonPushed() { |
1142 | QString current = "/mnt/cf"; | 1142 | QString current = "/mnt/cf"; |
1143 | chdir( current.latin1() ); | 1143 | chdir( current.latin1() ); |
1144 | if (TabWidget->currentPageIndex() == 0) { | 1144 | if (TabWidget->currentPageIndex() == 0) { |
1145 | currentDir.cd( current, TRUE); | 1145 | currentDir.cd( current, TRUE); |
1146 | populateLocalView(); | 1146 | populateLocalView(); |
1147 | } else { | 1147 | } else { |
1148 | currentRemoteDir.cd( current, TRUE); | 1148 | currentRemoteDir.cd( current, TRUE); |
1149 | populateRemoteView(); | 1149 | populateRemoteView(); |
1150 | } | 1150 | } |
1151 | update(); | 1151 | update(); |
1152 | 1152 | ||
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | 1155 | ||
1156 | void AdvancedFm::upDir() | 1156 | void AdvancedFm::upDir() |
1157 | { | 1157 | { |
1158 | if (TabWidget->currentPageIndex() == 0) { | 1158 | if (TabWidget->currentPageIndex() == 0) { |
1159 | QString current = currentDir.canonicalPath(); | 1159 | QString current = currentDir.canonicalPath(); |
1160 | QDir dir(current); | 1160 | QDir dir(current); |
1161 | dir.cdUp(); | 1161 | dir.cdUp(); |
1162 | current = dir.canonicalPath(); | 1162 | current = dir.canonicalPath(); |
1163 | chdir( current.latin1() ); | 1163 | chdir( current.latin1() ); |
1164 | currentDir.cd( current, TRUE); | 1164 | currentDir.cd( current, TRUE); |
1165 | populateLocalView(); | 1165 | populateLocalView(); |
1166 | update(); | 1166 | update(); |
1167 | } else { | 1167 | } else { |
1168 | QString current = currentRemoteDir.canonicalPath(); | 1168 | QString current = currentRemoteDir.canonicalPath(); |
1169 | QDir dir(current); | 1169 | QDir dir(current); |
1170 | dir.cdUp(); | 1170 | dir.cdUp(); |
1171 | current = dir.canonicalPath(); | 1171 | current = dir.canonicalPath(); |
1172 | chdir( current.latin1() ); | 1172 | chdir( current.latin1() ); |
1173 | currentRemoteDir.cd( current, TRUE); | 1173 | currentRemoteDir.cd( current, TRUE); |
1174 | populateRemoteView(); | 1174 | populateRemoteView(); |
1175 | update(); | 1175 | update(); |
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | void AdvancedFm::copy() | 1179 | void AdvancedFm::copy() |
1180 | { | 1180 | { |
1181 | QStringList curFileList = getPath(); | 1181 | QStringList curFileList = getPath(); |
1182 | QString curFile; | 1182 | QString curFile; |
1183 | if (TabWidget->currentPageIndex() == 0) { | 1183 | if (TabWidget->currentPageIndex() == 0) { |
1184 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 1184 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
1185 | 1185 | ||
1186 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 1186 | QString destFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
1187 | // if(destFile.right(1).find("/",0,TRUE) == -1) | 1187 | // if(destFile.right(1).find("/",0,TRUE) == -1) |
1188 | // destFile+="/"; | 1188 | // destFile+="/"; |
1189 | // destFile +=(*it); | 1189 | // destFile +=(*it); |
1190 | 1190 | ||
1191 | curFile = currentDir.canonicalPath()+"/"+(*it); | 1191 | curFile = currentDir.canonicalPath()+"/"+(*it); |
1192 | // if(curFile.right(1).find("/",0,TRUE) == -1) | 1192 | // if(curFile.right(1).find("/",0,TRUE) == -1) |
1193 | // curFile +="/"; | 1193 | // curFile +="/"; |
1194 | // curFile +=(*it); | 1194 | // curFile +=(*it); |
1195 | 1195 | ||
1196 | QFile f(destFile); | 1196 | QFile f(destFile); |