summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp22
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
@@ -737,178 +737,188 @@ void AdvancedFm::runThis() {
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
753void AdvancedFm::runText() { 753void 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
768void AdvancedFm::localMakDir() 768void 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
780void AdvancedFm::remoteMakDir() 780void 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
792void AdvancedFm::localDelete() 792void 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
836void AdvancedFm::remoteDelete() 841void 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 };
875 } 885 }
876 } 886 }
877} 887}
878 888
879void AdvancedFm::localRename() 889void AdvancedFm::localRename()
880{ 890{
881 QString curFile = Local_View->currentItem()->text(0); 891 QString curFile = Local_View->currentItem()->text(0);
882 InputDialog *fileDlg; 892 InputDialog *fileDlg;
883 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 893 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
884 fileDlg->setInputText((const QString &)curFile); 894 fileDlg->setInputText((const QString &)curFile);
885 fileDlg->exec(); 895 fileDlg->exec();
886 if( fileDlg->result() == 1 ) { 896 if( fileDlg->result() == 1 ) {
887 QString oldname = currentDir.canonicalPath() + "/" + curFile; 897 QString oldname = currentDir.canonicalPath() + "/" + curFile;
888 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 898 QString newName = currentDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
889 if( rename(oldname.latin1(), newName.latin1())== -1) 899 if( rename(oldname.latin1(), newName.latin1())== -1)
890 QMessageBox::message(tr("Note"),tr("Could not rename")); 900 QMessageBox::message(tr("Note"),tr("Could not rename"));
891 } 901 }
892 populateLocalView(); 902 populateLocalView();
893} 903}
894 904
895void AdvancedFm::remoteRename() 905void AdvancedFm::remoteRename()
896{ 906{
897 QString curFile = Local_View->currentItem()->text(0); 907 QString curFile = Local_View->currentItem()->text(0);
898 InputDialog *fileDlg; 908 InputDialog *fileDlg;
899 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0); 909 fileDlg = new InputDialog(this,tr("Rename"),TRUE, 0);
900 fileDlg->setInputText((const QString &)curFile); 910 fileDlg->setInputText((const QString &)curFile);
901 fileDlg->exec(); 911 fileDlg->exec();
902 if( fileDlg->result() == 1 ) { 912 if( fileDlg->result() == 1 ) {
903 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile; 913 QString oldname = currentRemoteDir.canonicalPath() + "/" + curFile;
904 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist"; 914 QString newName = currentRemoteDir.canonicalPath() + "/" + fileDlg->LineEdit1->text();//+".playlist";
905 if( rename(oldname.latin1(), newName.latin1())== -1) 915 if( rename(oldname.latin1(), newName.latin1())== -1)
906 QMessageBox::message(tr("Note"),tr("Could not rename")); 916 QMessageBox::message(tr("Note"),tr("Could not rename"));
907 } 917 }
908 populateRemoteView(); 918 populateRemoteView();
909} 919}
910 920
911void AdvancedFm::switchToLocalTab() 921void AdvancedFm::switchToLocalTab()
912{ 922{
913 TabWidget->setCurrentPage(0); 923 TabWidget->setCurrentPage(0);
914 Local_View->setFocus(); 924 Local_View->setFocus();