-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 | |||
@@ -789,30 +789,35 @@ void AdvancedFm::remoteMakDir() | |||
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) ) { |
@@ -833,30 +838,35 @@ void AdvancedFm::localDelete() | |||
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) ) { |