-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index ab31c91..faa03dc 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -777,98 +777,108 @@ void AdvancedFm::localMakDir() | |||
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()+"/"+myFile; | 801 | QString f = currentDir.canonicalPath(); |
802 | if(f.right(1).find("/",0,TRUE) == -1) | ||
803 | f+="/"; | ||
804 | f+=myFile; | ||
802 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 805 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
803 | 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 ?" | ||
804 | ,tr("Yes"),tr("No"),0,0,1) ) { | 808 | ,tr("Yes"),tr("No"),0,0,1) ) { |
805 | case 0: { | 809 | case 0: { |
806 | QString cmd="rmdir -rf "+f; | 810 | f=f.left(f.length()-1); |
811 | QString cmd="rm -rf "+f; | ||
807 | system( cmd.latin1()); | 812 | system( cmd.latin1()); |
808 | populateLocalView(); | 813 | populateLocalView(); |
809 | } | 814 | } |
810 | break; | 815 | break; |
811 | case 1: | 816 | case 1: |
812 | // exit | 817 | // exit |
813 | break; | 818 | break; |
814 | }; | 819 | }; |
815 | 820 | ||
816 | } else { | 821 | } else { |
817 | 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 |
818 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 823 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
819 | case 0: { | 824 | case 0: { |
820 | QString cmd="rm "+f; | 825 | QString cmd="rm "+f; |
821 | QFile file(f); | 826 | QFile file(f); |
822 | file.remove(); | 827 | file.remove(); |
823 | // system( cmd.latin1()); | 828 | // system( cmd.latin1()); |
824 | populateLocalView(); | 829 | populateLocalView(); |
825 | } | 830 | } |
826 | break; | 831 | break; |
827 | case 1: | 832 | case 1: |
828 | // exit | 833 | // exit |
829 | break; | 834 | break; |
830 | }; | 835 | }; |
831 | } | 836 | } |
832 | 837 | ||
833 | } | 838 | } |
834 | } | 839 | } |
835 | 840 | ||
836 | void AdvancedFm::remoteDelete() | 841 | void AdvancedFm::remoteDelete() |
837 | { | 842 | { |
838 | QStringList curFileList = getPath(); | 843 | QStringList curFileList = getPath(); |
839 | QString myFile; | 844 | QString myFile; |
840 | 845 | ||
841 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 846 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
842 | myFile = (*it); | 847 | myFile = (*it); |
843 | if(myFile.find(" -> ",0,TRUE) != -1) | 848 | if(myFile.find(" -> ",0,TRUE) != -1) |
844 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); | 849 | myFile = myFile.left(myFile.find(" -> ",0,TRUE)); |
845 | QString f = currentRemoteDir.canonicalPath()+"/"+myFile; | 850 | QString f = currentDir.canonicalPath(); |
851 | if(f.right(1).find("/",0,TRUE) == -1) | ||
852 | f+="/"; | ||
853 | f+=myFile; | ||
846 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { | 854 | if(QDir(f).exists() && !QFileInfo(f).isSymLink() ) { |
847 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+" ?", | 855 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ |
856 | "\nand all it's contents ?", | ||
848 | tr("Yes"),tr("No"),0,0,1) ) { | 857 | tr("Yes"),tr("No"),0,0,1) ) { |
849 | case 0: { | 858 | case 0: { |
850 | QString cmd="rmdir -rf "+f; | 859 | f=f.left(f.length()-1); |
860 | QString cmd="rm -rf "+f; | ||
851 | system( cmd.latin1()); | 861 | system( cmd.latin1()); |
852 | populateRemoteView(); | 862 | populateRemoteView(); |
853 | } | 863 | } |
854 | break; | 864 | break; |
855 | case 1: | 865 | case 1: |
856 | // exit | 866 | // exit |
857 | break; | 867 | break; |
858 | }; | 868 | }; |
859 | 869 | ||
860 | } else { | 870 | } else { |
861 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f | 871 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f |
862 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { | 872 | +" ?",tr("Yes"),tr("No"),0,0,1) ) { |
863 | case 0: { | 873 | case 0: { |
864 | QString cmd="rm "+f; | 874 | QString cmd="rm "+f; |
865 | QFile file(f); | 875 | QFile file(f); |
866 | file.remove(); | 876 | file.remove(); |
867 | // system( cmd.latin1()); | 877 | // system( cmd.latin1()); |
868 | populateRemoteView(); | 878 | populateRemoteView(); |
869 | } | 879 | } |
870 | break; | 880 | break; |
871 | case 1: | 881 | case 1: |
872 | // exit | 882 | // exit |
873 | break; | 883 | break; |
874 | }; | 884 | }; |