-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 a378170..e3ab76b 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -737,257 +737,257 @@ QString fs; | |||
737 | curFile = currentDir.canonicalPath()+"/"+curFile; | 737 | curFile = currentDir.canonicalPath()+"/"+curFile; |
738 | DocLnk nf(curFile); | 738 | DocLnk nf(curFile); |
739 | QString execStr = nf.exec(); | 739 | QString execStr = nf.exec(); |
740 | qDebug( execStr); | 740 | qDebug( execStr); |
741 | if( execStr.isEmpty() ) { | 741 | if( execStr.isEmpty() ) { |
742 | } else { | 742 | } else { |
743 | nf.execute(); | 743 | nf.execute(); |
744 | } | 744 | } |
745 | } | 745 | } |
746 | // MimeType mt( curFile); | 746 | // MimeType mt( curFile); |
747 | } else { | 747 | } else { |
748 | QString curFile = Remote_View->currentItem()->text(0); | 748 | QString curFile = Remote_View->currentItem()->text(0); |
749 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 749 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
750 | qDebug("Filesystemtype is "+fs); | 750 | qDebug("Filesystemtype is "+fs); |
751 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 751 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
752 | if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { | 752 | if(fileInfo.isExecutable() || fs == "vfat" && fileInfo.filePath().contains("/bin") ) { |
753 | QCopEnvelope e("QPE/System", "execute(QString)" ); | 753 | QCopEnvelope e("QPE/System", "execute(QString)" ); |
754 | e << curFile; | 754 | e << curFile; |
755 | } else { | 755 | } else { |
756 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 756 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
757 | DocLnk nf(curFile); | 757 | DocLnk nf(curFile); |
758 | QString execStr = nf.exec(); | 758 | QString execStr = nf.exec(); |
759 | qDebug(execStr); | 759 | qDebug(execStr); |
760 | if( execStr.isEmpty() ) { | 760 | if( execStr.isEmpty() ) { |
761 | } else { | 761 | } else { |
762 | nf.execute(); | 762 | nf.execute(); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | // MimeType mt( curFile); | 765 | // MimeType mt( curFile); |
766 | } | 766 | } |
767 | } | 767 | } |
768 | 768 | ||
769 | void AdvancedFm::runText() { | 769 | void AdvancedFm::runText() { |
770 | if (TabWidget->currentPageIndex() == 0) { | 770 | if (TabWidget->currentPageIndex() == 0) { |
771 | QString curFile = Local_View->currentItem()->text(0); | 771 | QString curFile = Local_View->currentItem()->text(0); |
772 | curFile = currentDir.canonicalPath()+"/"+curFile; | 772 | curFile = currentDir.canonicalPath()+"/"+curFile; |
773 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 773 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
774 | e << curFile; | 774 | e << curFile; |
775 | } else { | 775 | } else { |
776 | QString curFile = Remote_View->currentItem()->text(0); | 776 | QString curFile = Remote_View->currentItem()->text(0); |
777 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 777 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
778 | DocLnk nf(curFile); | 778 | DocLnk nf(curFile); |
779 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 779 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
780 | e << curFile; | 780 | e << curFile; |
781 | } | 781 | } |
782 | } | 782 | } |
783 | 783 | ||
784 | void AdvancedFm::localMakDir() | 784 | void AdvancedFm::localMakDir() |
785 | { | 785 | { |
786 | InputDialog *fileDlg; | 786 | InputDialog *fileDlg; |
787 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 787 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
788 | fileDlg->exec(); | 788 | fileDlg->exec(); |
789 | if( fileDlg->result() == 1 ) { | 789 | if( fileDlg->result() == 1 ) { |
790 | QString filename = fileDlg->LineEdit1->text(); | 790 | QString filename = fileDlg->LineEdit1->text(); |
791 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); | 791 | currentDir.mkdir( currentDir.canonicalPath()+"/"+filename); |
792 | } | 792 | } |
793 | populateLocalView(); | 793 | populateLocalView(); |
794 | } | 794 | } |
795 | 795 | ||
796 | void AdvancedFm::remoteMakDir() | 796 | void AdvancedFm::remoteMakDir() |
797 | { | 797 | { |
798 | InputDialog *fileDlg; | 798 | InputDialog *fileDlg; |
799 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); | 799 | fileDlg = new InputDialog(this,tr("Make Directory"),TRUE, 0); |
800 | fileDlg->exec(); | 800 | fileDlg->exec(); |
801 | if( fileDlg->result() == 1 ) { | 801 | if( fileDlg->result() == 1 ) { |
802 | QString filename = fileDlg->LineEdit1->text(); | 802 | QString filename = fileDlg->LineEdit1->text(); |
803 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); | 803 | currentRemoteDir.mkdir( currentRemoteDir.canonicalPath()+"/"+filename); |
804 | } | 804 | } |
805 | populateRemoteView(); | 805 | populateRemoteView(); |
806 | } | 806 | } |
807 | 807 | ||
808 | void AdvancedFm::localDelete() | 808 | void AdvancedFm::localDelete() |
809 | { | 809 | { |
810 | QStringList curFileList = getPath(); | 810 | QStringList curFileList = getPath(); |
811 | QString myFile; | 811 | QString myFile; |
812 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 812 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
813 | myFile = (*it); | 813 | myFile = (*it); |
814 | if( myFile.find(" -> ",0,TRUE) != -1) | 814 | if( myFile.find(" -> ",0,TRUE) != -1) |
815 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); | 815 | myFile = myFile.left( myFile.find(" -> ",0,TRUE)); |
816 | 816 | ||
817 | QString f = currentDir.canonicalPath(); | 817 | QString f = currentDir.canonicalPath(); |
818 | if(f.right(1).find("/",0,TRUE) == -1) | 818 | if(f.right(1).find("/",0,TRUE) == -1) |
819 | f+="/"; | 819 | f+="/"; |
820 | f+=myFile; | 820 | f+=myFile; |
821 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 821 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
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 | "\nand all it's contents ?" | 823 | "\nand all it's contents ?" |
824 | ,tr("Yes"),tr("No"),0,0,1) ) { | 824 | ,tr("Yes"),tr("No"),0,0,1) ) { |
825 | case 0: { | 825 | case 0: { |
826 | f=f.left(f.length()-1); | 826 | f=f.left(f.length()-1); |
827 | QString cmd="rm -rf "+f; | 827 | QString cmd="rm -rf "+f; |
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 | } else { | 837 | } else { |
838 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 838 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
839 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 839 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
840 | case 0: { | 840 | case 0: { |
841 | QString cmd="rm "+f; | 841 | QString cmd="rm "+f; |
842 | QFile file(f); | 842 | QFile file(f); |
843 | file.remove(); | 843 | file.remove(); |
844 | // system( cmd.latin1()); | 844 | // system( cmd.latin1()); |
845 | populateLocalView(); | 845 | populateLocalView(); |
846 | } | 846 | } |
847 | break; | 847 | break; |
848 | case 1: | 848 | case 1: |
849 | // exit | 849 | // exit |
850 | break; | 850 | break; |
851 | }; | 851 | }; |
852 | } | 852 | } |
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | void AdvancedFm::remoteDelete() | 856 | void AdvancedFm::remoteDelete() |
857 | { | 857 | { |
858 | QStringList curFileList = getPath(); | 858 | QStringList curFileList = getPath(); |
859 | QString myFile; | 859 | QString myFile; |
860 | 860 | ||
861 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 861 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
862 | myFile = (*it); | 862 | myFile = (*it); |
863 | if(myFile.find(" -> ",0,TRUE) != -1) | 863 | if(myFile.find(" -> ",0,TRUE) != -1) |
864 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 864 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
865 | QString f = currentDir.canonicalPath(); | 865 | QString f = currentRemoteDir.canonicalPath(); |
866 | if(f.right(1).find("/",0,TRUE) == -1) | 866 | if(f.right(1).find("/",0,TRUE) == -1) |
867 | f+="/"; | 867 | f+="/"; |
868 | f+=myFile; | 868 | f+=myFile; |
869 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 869 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
870 | 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+ |
871 | "\nand all it's contents ?", | 871 | "\nand all it's contents ?", |
872 | tr("Yes"),tr("No"),0,0,1) ) { | 872 | tr("Yes"),tr("No"),0,0,1) ) { |
873 | case 0: { | 873 | case 0: { |
874 | f=f.left(f.length()-1); | 874 | f=f.left(f.length()-1); |
875 | QString cmd="rm -rf "+f; | 875 | QString cmd="rm -rf "+f; |
876 | system( cmd.latin1()); | 876 | system( cmd.latin1()); |
877 | populateRemoteView(); | 877 | populateRemoteView(); |
878 | } | 878 | } |
879 | break; | 879 | break; |
880 | case 1: | 880 | case 1: |
881 | // exit | 881 | // exit |
882 | break; | 882 | break; |
883 | }; | 883 | }; |
884 | 884 | ||
885 | } else { | 885 | } else { |
886 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 886 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
887 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 887 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
888 | case 0: { | 888 | case 0: { |
889 | QString cmd="rm "+f; | 889 | QString cmd="rm "+f; |
890 | QFile file(f); | 890 | QFile file(f); |
891 | file.remove(); | 891 | file.remove(); |
892 | // system( cmd.latin1()); | 892 | // system( cmd.latin1()); |
893 | populateRemoteView(); | 893 | populateRemoteView(); |
894 | } | 894 | } |
895 | break; | 895 | break; |
896 | case 1: | 896 | case 1: |
897 | // exit | 897 | // exit |
898 | break; | 898 | break; |
899 | }; | 899 | }; |
900 | } | 900 | } |
901 | } | 901 | } |
902 | } | 902 | } |
903 | 903 | ||
904 | void AdvancedFm::localRename() | 904 | void AdvancedFm::localRename() |
905 | { | 905 | { |
906 | QString curFile = Local_View->currentItem()->text(0); | 906 | QString curFile = Local_View->currentItem()->text(0); |
907 | InputDialog *fileDlg; | 907 | InputDialog *fileDlg; |
908 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 908 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
909 | fileDlg->setInputText((const QString &)curFile); | 909 | fileDlg->setInputText((const QString &)curFile); |
910 | fileDlg->exec(); | 910 | fileDlg->exec(); |
911 | if( fileDlg->result() == 1 ) { | 911 | if( fileDlg->result() == 1 ) { |
912 | QString oldname = currentDir.canonicalPath() + "/" + curFile; | 912 | QString oldname = currentDir.canonicalPath() + "/" + curFile; |
913 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 913 | QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
914 | if( rename(oldname.latin1(), newName.latin1())== -1) | 914 | if( rename(oldname.latin1(), newName.latin1())== -1) |
915 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 915 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
916 | } | 916 | } |
917 | populateLocalView(); | 917 | populateLocalView(); |
918 | } | 918 | } |
919 | 919 | ||
920 | void AdvancedFm::remoteRename() | 920 | void AdvancedFm::remoteRename() |
921 | { | 921 | { |
922 | QString curFile = Local_View->currentItem()->text(0); | 922 | QString curFile = Local_View->currentItem()->text(0); |
923 | InputDialog *fileDlg; | 923 | InputDialog *fileDlg; |
924 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); | 924 | fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); |
925 | fileDlg->setInputText((const QString &)curFile); | 925 | fileDlg->setInputText((const QString &)curFile); |
926 | fileDlg->exec(); | 926 | fileDlg->exec(); |
927 | if( fileDlg->result() == 1 ) { | 927 | if( fileDlg->result() == 1 ) { |
928 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; | 928 | QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; |
929 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; | 929 | QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; |
930 | if( rename(oldname.latin1(), newName.latin1())== -1) | 930 | if( rename(oldname.latin1(), newName.latin1())== -1) |
931 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 931 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
932 | } | 932 | } |
933 | populateRemoteView(); | 933 | populateRemoteView(); |
934 | } | 934 | } |
935 | 935 | ||
936 | void AdvancedFm::switchToLocalTab() | 936 | void AdvancedFm::switchToLocalTab() |
937 | { | 937 | { |
938 | TabWidget->setCurrentPage(0); | 938 | TabWidget->setCurrentPage(0); |
939 | Local_View->setFocus(); | 939 | Local_View->setFocus(); |
940 | } | 940 | } |
941 | 941 | ||
942 | void AdvancedFm::switchToRemoteTab() | 942 | void AdvancedFm::switchToRemoteTab() |
943 | { | 943 | { |
944 | TabWidget->setCurrentPage(1); | 944 | TabWidget->setCurrentPage(1); |
945 | Remote_View->setFocus(); | 945 | Remote_View->setFocus(); |
946 | } | 946 | } |
947 | 947 | ||
948 | void AdvancedFm::readConfig() | 948 | void AdvancedFm::readConfig() |
949 | { | 949 | { |
950 | Config cfg("AdvancedFm"); | 950 | Config cfg("AdvancedFm"); |
951 | } | 951 | } |
952 | 952 | ||
953 | void AdvancedFm::writeConfig() | 953 | void AdvancedFm::writeConfig() |
954 | { | 954 | { |
955 | Config cfg("AdvancedFm"); | 955 | Config cfg("AdvancedFm"); |
956 | } | 956 | } |
957 | 957 | ||
958 | void AdvancedFm::currentPathComboChanged() | 958 | void AdvancedFm::currentPathComboChanged() |
959 | { | 959 | { |
960 | if (TabWidget->currentPageIndex() == 0) { | 960 | if (TabWidget->currentPageIndex() == 0) { |
961 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 961 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
962 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); | 962 | currentDir.setPath( currentPathCombo->lineEdit()->text() ); |
963 | populateLocalView(); | 963 | populateLocalView(); |
964 | } else { | 964 | } else { |
965 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 965 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
966 | } | 966 | } |
967 | } | 967 | } |
968 | if (TabWidget->currentPageIndex() == 0) { | 968 | if (TabWidget->currentPageIndex() == 0) { |
969 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 969 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { |
970 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); | 970 | currentRemoteDir.setPath( currentPathCombo->lineEdit()->text() ); |
971 | populateRemoteView(); | 971 | populateRemoteView(); |
972 | } else { | 972 | } else { |
973 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); | 973 | QMessageBox::message(tr("Note"),tr("That directory does not exist")); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | } | 976 | } |
977 | 977 | ||
978 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 978 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
979 | 979 | ||
980 | if (TabWidget->currentPageIndex() == 0) { | 980 | if (TabWidget->currentPageIndex() == 0) { |
981 | currentPathCombo->lineEdit()->setText( currentPath); | 981 | currentPathCombo->lineEdit()->setText( currentPath); |
982 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { | 982 | if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) { |
983 | currentPathCombo->clear(); | 983 | currentPathCombo->clear(); |
984 | localDirPathStringList.prepend( currentPath ); | 984 | localDirPathStringList.prepend( currentPath ); |
985 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 985 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
986 | } | 986 | } |
987 | } else { | 987 | } else { |
988 | currentPathCombo->lineEdit()->setText( currentPath); | 988 | currentPathCombo->lineEdit()->setText( currentPath); |
989 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 989 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
990 | currentPathCombo->clear(); | 990 | currentPathCombo->clear(); |
991 | remoteDirPathStringList.prepend( currentPath ); | 991 | remoteDirPathStringList.prepend( currentPath ); |
992 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 992 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
993 | } | 993 | } |