-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.h | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 62 |
3 files changed, 63 insertions, 10 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 2fc4b49..ecf471d 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -102,11 +102,14 @@ void AdvancedFm::tabChanged(QWidget *) { | |||
102 | 102 | ||
103 | 103 | ||
104 | void AdvancedFm::populateView() { | 104 | void AdvancedFm::populateView() { |
105 | |||
106 | qWarning("PopulateView"); | ||
105 | QPixmap pm; | 107 | QPixmap pm; |
106 | QListView *thisView = CurrentView(); | 108 | QListView *thisView = CurrentView(); |
107 | QDir *thisDir = CurrentDir(); | 109 | QDir *thisDir = CurrentDir(); |
108 | QString path = thisDir->canonicalPath(); | 110 | QString path = thisDir->canonicalPath(); |
109 | // qWarning("path is "+path); | 111 | |
112 | qWarning("path is "+path); | ||
110 | thisView->clear(); | 113 | thisView->clear(); |
111 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 114 | thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
112 | thisDir->setMatchAllDirs(TRUE); | 115 | thisDir->setMatchAllDirs(TRUE); |
@@ -809,7 +812,7 @@ QListView * AdvancedFm::OtherView() { | |||
809 | } | 812 | } |
810 | 813 | ||
811 | void AdvancedFm::setOtherTabCurrent() { | 814 | void AdvancedFm::setOtherTabCurrent() { |
812 | // qWarning("setOtherTabCurrent()"); | 815 | qWarning("setOtherTabCurrent() %d", whichTab); |
813 | if ( whichTab == 1) { | 816 | if ( whichTab == 1) { |
814 | TabWidget->setCurrentWidget(1); | 817 | TabWidget->setCurrentWidget(1); |
815 | } else { | 818 | } else { |
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h index 5f6eabb..be574c4 100644 --- a/noncore/apps/advancedfm/advancedfm.h +++ b/noncore/apps/advancedfm/advancedfm.h | |||
@@ -154,7 +154,9 @@ protected slots: | |||
154 | void doAbout(); | 154 | void doAbout(); |
155 | void doBeam(); | 155 | void doBeam(); |
156 | void fileBeamFinished( Ir *); | 156 | void fileBeamFinished( Ir *); |
157 | 157 | bool copyDirectory( const QString & , const QString & ); | |
158 | // void navigateToSelected(); | ||
159 | bool moveDirectory( const QString & , const QString & ); | ||
158 | // void slotSwitchtoLocal(int); | 160 | // void slotSwitchtoLocal(int); |
159 | 161 | ||
160 | private: | 162 | private: |
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index c0be948..90c887f 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -68,8 +68,8 @@ void AdvancedFm::showMenuHidden() { | |||
68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 68 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 69 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
70 | } | 70 | } |
71 | rePopulate(); | ||
72 | b = !b; | 71 | b = !b; |
72 | populateView(); | ||
73 | } | 73 | } |
74 | 74 | ||
75 | void AdvancedFm::showHidden() { | 75 | void AdvancedFm::showHidden() { |
@@ -80,7 +80,7 @@ void AdvancedFm::showHidden() { | |||
80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 80 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 81 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
82 | } | 82 | } |
83 | rePopulate(); | 83 | populateView(); |
84 | } | 84 | } |
85 | 85 | ||
86 | QString AdvancedFm::dealWithSymName(const QString &fileName) { | 86 | QString AdvancedFm::dealWithSymName(const QString &fileName) { |
@@ -339,8 +339,8 @@ void AdvancedFm::copy() { | |||
339 | return; | 339 | return; |
340 | } | 340 | } |
341 | } | 341 | } |
342 | rePopulate(); | ||
343 | setOtherTabCurrent(); | 342 | setOtherTabCurrent(); |
343 | rePopulate(); | ||
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
@@ -438,7 +438,7 @@ void AdvancedFm::copySameDir() { | |||
438 | } | 438 | } |
439 | delete fileDlg; | 439 | delete fileDlg; |
440 | } | 440 | } |
441 | populateView(); | 441 | rePopulate(); |
442 | } | 442 | } |
443 | 443 | ||
444 | void AdvancedFm::move() { | 444 | void AdvancedFm::move() { |
@@ -465,6 +465,12 @@ void AdvancedFm::move() { | |||
465 | curFile+= item; | 465 | curFile+= item; |
466 | // qDebug("CurrentFile file is " + curFile); | 466 | // qDebug("CurrentFile file is " + curFile); |
467 | 467 | ||
468 | if(QFileInfo(curFile).isDir()) { | ||
469 | moveDirectory( curFile, destFile ); | ||
470 | rePopulate(); | ||
471 | return; | ||
472 | } | ||
473 | |||
468 | QFile f( curFile); | 474 | QFile f( curFile); |
469 | if( f.exists()) { | 475 | if( f.exists()) { |
470 | if( !copyFile( curFile, destFile) ) { | 476 | if( !copyFile( curFile, destFile) ) { |
@@ -480,7 +486,49 @@ void AdvancedFm::move() { | |||
480 | setOtherTabCurrent(); | 486 | setOtherTabCurrent(); |
481 | } | 487 | } |
482 | 488 | ||
489 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | ||
490 | int err = 0; | ||
491 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; | ||
492 | err = system((const char*)cmd); | ||
493 | } else | ||
494 | err = -1; | ||
495 | |||
496 | if(err!=0) { | ||
497 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); | ||
498 | return false; | ||
499 | } | ||
500 | return true; | ||
501 | } | ||
502 | |||
503 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | ||
504 | |||
505 | QStringcmd = "/bin/cp -fpR " + src + " " + dest; | ||
506 | qWarning(cmd); | ||
507 | interr = system( (const char *) cmd ); | ||
508 | if ( err != 0 ) { | ||
509 | QMessageBox::message("AdvancedFm", | ||
510 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); | ||
511 | return false; | ||
512 | } | ||
513 | |||
514 | return true; | ||
515 | } | ||
516 | |||
517 | |||
483 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 518 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
519 | |||
520 | |||
521 | if(QFileInfo(src).isDir()) { | ||
522 | if( copyDirectory( src, dest )) { | ||
523 | setOtherTabCurrent(); | ||
524 | populateView(); | ||
525 | return true; | ||
526 | } | ||
527 | else | ||
528 | return false; | ||
529 | } | ||
530 | |||
531 | |||
484 | bool success = true; | 532 | bool success = true; |
485 | struct stat status; | 533 | struct stat status; |
486 | QFile srcFile(src); | 534 | QFile srcFile(src); |
@@ -687,7 +735,7 @@ void AdvancedFm::startProcess(const QString & cmd) { | |||
687 | } | 735 | } |
688 | 736 | ||
689 | void AdvancedFm::processEnded(OProcess *) { | 737 | void AdvancedFm::processEnded(OProcess *) { |
690 | populateView(); | 738 | rePopulate(); |
691 | } | 739 | } |
692 | 740 | ||
693 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 741 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
@@ -775,7 +823,7 @@ void AdvancedFm::renameIt() { | |||
775 | QListView *thisView = CurrentView(); | 823 | QListView *thisView = CurrentView(); |
776 | oldName = thisView->currentItem()->text(0); | 824 | oldName = thisView->currentItem()->text(0); |
777 | doRename( thisView ); | 825 | doRename( thisView ); |
778 | populateView(); | 826 | rePopulate(); |
779 | } | 827 | } |
780 | 828 | ||
781 | void AdvancedFm::okRename() { | 829 | void AdvancedFm::okRename() { |
@@ -794,7 +842,7 @@ void AdvancedFm::okRename() { | |||
794 | 842 | ||
795 | view->takeItem( view->currentItem() ); | 843 | view->takeItem( view->currentItem() ); |
796 | delete view->currentItem(); | 844 | delete view->currentItem(); |
797 | populateView(); | 845 | rePopulate(); |
798 | } | 846 | } |
799 | 847 | ||
800 | void AdvancedFm::openSearch() { | 848 | void AdvancedFm::openSearch() { |