Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 0a9f921..f77554a 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -100,16 +100,24 @@ void AdvancedFm::showRemoteHidden() { | |||
100 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 100 | currentRemoteDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
101 | // b=FALSE; | 101 | // b=FALSE; |
102 | } | 102 | } |
103 | populateRemoteView(); | 103 | populateRemoteView(); |
104 | } | 104 | } |
105 | 105 | ||
106 | QString AdvancedFm::dealWithSymName(const QString &fileName) { | ||
107 | QString strItem = fileName; | ||
108 | return strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); | ||
109 | } | ||
110 | |||
106 | void AdvancedFm::runThis() { | 111 | void AdvancedFm::runThis() { |
107 | QString fs; | 112 | QString fs; |
108 | if (TabWidget->getCurrentTab() == 0) { | 113 | if (TabWidget->getCurrentTab() == 0) { |
109 | QString curFile = Local_View->currentItem()->text(0); | 114 | QString curFile = Local_View->currentItem()->text(0); |
115 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | ||
116 | curFile = dealWithSymName((const QString&)curFile); | ||
117 | |||
110 | if(curFile != "../") { | 118 | if(curFile != "../") { |
111 | 119 | ||
112 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); | 120 | fs= getFileSystemType((const QString &) currentDir.canonicalPath()); |
113 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); | 121 | QFileInfo fileInfo( currentDir.canonicalPath()+"/"+curFile); |
114 | qDebug( fileInfo.owner()); | 122 | qDebug( fileInfo.owner()); |
115 | if( (fileInfo.permission( QFileInfo::ExeUser) | 123 | if( (fileInfo.permission( QFileInfo::ExeUser) |
@@ -129,12 +137,14 @@ void AdvancedFm::runThis() { | |||
129 | } | 137 | } |
130 | } | 138 | } |
131 | } | 139 | } |
132 | } else { | 140 | } else { |
133 | QString curFile = Remote_View->currentItem()->text(0); | 141 | QString curFile = Remote_View->currentItem()->text(0); |
134 | if(curFile != "../") { | 142 | if(curFile != "../") { |
143 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | ||
144 | curFile = dealWithSymName((const QString&)curFile); | ||
135 | 145 | ||
136 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); | 146 | fs= getFileSystemType((const QString &) currentRemoteDir.canonicalPath()); |
137 | qDebug("Filesystemtype is "+fs); | 147 | qDebug("Filesystemtype is "+fs); |
138 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); | 148 | QFileInfo fileInfo( currentRemoteDir.canonicalPath()+"/"+curFile); |
139 | if( (fileInfo.permission( QFileInfo::ExeUser) | 149 | if( (fileInfo.permission( QFileInfo::ExeUser) |
140 | | fileInfo.permission( QFileInfo::ExeGroup) | 150 | | fileInfo.permission( QFileInfo::ExeGroup) |
@@ -157,20 +167,24 @@ void AdvancedFm::runThis() { | |||
157 | } | 167 | } |
158 | 168 | ||
159 | void AdvancedFm::runText() { | 169 | void AdvancedFm::runText() { |
160 | if (TabWidget->getCurrentTab() == 0) { | 170 | if (TabWidget->getCurrentTab() == 0) { |
161 | QString curFile = Local_View->currentItem()->text(0); | 171 | QString curFile = Local_View->currentItem()->text(0); |
162 | if(curFile != "../") { | 172 | if(curFile != "../") { |
173 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | ||
174 | curFile = dealWithSymName((const QString&)curFile); | ||
163 | curFile = currentDir.canonicalPath()+"/"+curFile; | 175 | curFile = currentDir.canonicalPath()+"/"+curFile; |
164 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 176 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
165 | e << curFile; | 177 | e << curFile; |
166 | } | 178 | } |
167 | } else { | 179 | } else { |
168 | QString curFile = Remote_View->currentItem()->text(0); | 180 | QString curFile = Remote_View->currentItem()->text(0); |
169 | if(curFile != "../") { | 181 | if(curFile != "../") { |
170 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; | 182 | curFile = currentRemoteDir.canonicalPath()+"/"+curFile; |
183 | if( curFile.find("@",0,TRUE) !=-1 || curFile.find("->",0,TRUE) !=-1 ) //if symlink | ||
184 | curFile = dealWithSymName((const QString&)curFile); | ||
171 | DocLnk nf(curFile); | 185 | DocLnk nf(curFile); |
172 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); | 186 | QCopEnvelope e("QPE/Application/textedit", "setDocument(QString)" ); |
173 | e << curFile; | 187 | e << curFile; |
174 | } | 188 | } |
175 | } | 189 | } |
176 | } | 190 | } |
@@ -479,13 +493,13 @@ void AdvancedFm::copy() { | |||
479 | return; | 493 | return; |
480 | break; | 494 | break; |
481 | }; | 495 | }; |
482 | } | 496 | } |
483 | f.remove(); | 497 | f.remove(); |
484 | } | 498 | } |
485 | if(!copyFile(destFile, curFile) ) { | 499 | if(!copyFile( curFile, destFile) ) { |
486 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 500 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
487 | return; | 501 | return; |
488 | } | 502 | } |
489 | } | 503 | } |
490 | populateRemoteView(); | 504 | populateRemoteView(); |
491 | TabWidget->setCurrentTab(1); | 505 | TabWidget->setCurrentTab(1); |
@@ -510,13 +524,13 @@ void AdvancedFm::copy() { | |||
510 | case 1: | 524 | case 1: |
511 | return; | 525 | return; |
512 | break; | 526 | break; |
513 | }; | 527 | }; |
514 | f.remove(); | 528 | f.remove(); |
515 | } | 529 | } |
516 | if(!copyFile(destFile, curFile) ) { | 530 | if(!copyFile( curFile, destFile) ) { |
517 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 531 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
518 | +curFile +tr("to\n")+destFile); | 532 | +curFile +tr("to\n")+destFile); |
519 | return; | 533 | return; |
520 | 534 | ||
521 | } | 535 | } |
522 | } | 536 | } |
@@ -558,13 +572,13 @@ void AdvancedFm::copyAs() { | |||
558 | break; | 572 | break; |
559 | case 1: | 573 | case 1: |
560 | return; | 574 | return; |
561 | break; | 575 | break; |
562 | }; | 576 | }; |
563 | } | 577 | } |
564 | if(!copyFile(destFile, curFile) ) { | 578 | if(!copyFile( curFile,destFile) ) { |
565 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 579 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
566 | +curFile +tr("to\n")+destFile); | 580 | +curFile +tr("to\n")+destFile); |
567 | return; | 581 | return; |
568 | } | 582 | } |
569 | } | 583 | } |
570 | delete fileDlg; | 584 | delete fileDlg; |
@@ -598,13 +612,13 @@ void AdvancedFm::copyAs() { | |||
598 | break; | 612 | break; |
599 | case 1: | 613 | case 1: |
600 | return; | 614 | return; |
601 | break; | 615 | break; |
602 | }; | 616 | }; |
603 | } | 617 | } |
604 | if(!copyFile(destFile, curFile) ) { | 618 | if(!copyFile( curFile,destFile) ) { |
605 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 619 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
606 | +curFile +tr("to\n")+destFile); | 620 | +curFile +tr("to\n")+destFile); |
607 | return; | 621 | return; |
608 | } | 622 | } |
609 | 623 | ||
610 | } | 624 | } |
@@ -648,13 +662,13 @@ void AdvancedFm::copySameDir() { | |||
648 | break; | 662 | break; |
649 | case 1: | 663 | case 1: |
650 | return; | 664 | return; |
651 | break; | 665 | break; |
652 | }; | 666 | }; |
653 | } | 667 | } |
654 | if(!copyFile(destFile, curFile) ) { | 668 | if(!copyFile( curFile,destFile) ) { |
655 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 669 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
656 | +curFile +tr("to\n")+destFile); | 670 | +curFile +tr("to\n")+destFile); |
657 | return; | 671 | return; |
658 | } | 672 | } |
659 | 673 | ||
660 | qDebug("copy "+curFile+" as "+destFile); | 674 | qDebug("copy "+curFile+" as "+destFile); |
@@ -686,13 +700,13 @@ void AdvancedFm::copySameDir() { | |||
686 | break; | 700 | break; |
687 | case 1: | 701 | case 1: |
688 | return; | 702 | return; |
689 | break; | 703 | break; |
690 | }; | 704 | }; |
691 | } | 705 | } |
692 | if(!copyFile(destFile, curFile) ) { | 706 | if(!copyFile( curFile,destFile) ) { |
693 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 707 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
694 | +curFile +tr("to\n")+destFile); | 708 | +curFile +tr("to\n")+destFile); |
695 | return; | 709 | return; |
696 | } | 710 | } |
697 | qDebug("copy "+curFile+" as "+destFile); | 711 | qDebug("copy "+curFile+" as "+destFile); |
698 | } | 712 | } |
@@ -727,13 +741,13 @@ void AdvancedFm::move() { | |||
727 | 741 | ||
728 | curFile+= item; | 742 | curFile+= item; |
729 | qDebug("CurrentFile file is " + curFile); | 743 | qDebug("CurrentFile file is " + curFile); |
730 | 744 | ||
731 | QFile f( curFile); | 745 | QFile f( curFile); |
732 | if( f.exists()) { | 746 | if( f.exists()) { |
733 | if(!copyFile( destFile, curFile) ) { | 747 | if(!copyFile( curFile,destFile) ) { |
734 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 748 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
735 | return; | 749 | return; |
736 | } else | 750 | } else |
737 | QFile::remove(curFile); | 751 | QFile::remove(curFile); |
738 | } | 752 | } |
739 | } | 753 | } |
@@ -759,13 +773,13 @@ void AdvancedFm::move() { | |||
759 | curFile +="/"; | 773 | curFile +="/"; |
760 | curFile+= item; | 774 | curFile+= item; |
761 | qDebug("CurrentFile file is " + curFile); | 775 | qDebug("CurrentFile file is " + curFile); |
762 | 776 | ||
763 | QFile f( curFile); | 777 | QFile f( curFile); |
764 | if( f.exists()) { | 778 | if( f.exists()) { |
765 | if(!copyFile( destFile, curFile) ) { | 779 | if(!copyFile( curFile, destFile) ) { |
766 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 780 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
767 | return; | 781 | return; |
768 | } else | 782 | } else |
769 | QFile::remove( curFile); | 783 | QFile::remove( curFile); |
770 | } | 784 | } |
771 | TabWidget->setCurrentTab(0); | 785 | TabWidget->setCurrentTab(0); |
@@ -773,13 +787,13 @@ void AdvancedFm::move() { | |||
773 | } | 787 | } |
774 | populateRemoteView(); | 788 | populateRemoteView(); |
775 | populateLocalView(); | 789 | populateLocalView(); |
776 | } | 790 | } |
777 | } | 791 | } |
778 | 792 | ||
779 | bool AdvancedFm::copyFile( const QString & dest, const QString & src ) { | 793 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
780 | char bf[ 50000 ]; | 794 | char bf[ 50000 ]; |
781 | int bytesRead; | 795 | int bytesRead; |
782 | bool success = TRUE; | 796 | bool success = TRUE; |
783 | struct stat status; | 797 | struct stat status; |
784 | 798 | ||
785 | QFile s( src ); | 799 | QFile s( src ); |