-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 @@ -104,2 +104,4 @@ void AdvancedFm::tabChanged(QWidget *) { void AdvancedFm::populateView() { + +qWarning("PopulateView"); QPixmap pm; @@ -108,3 +110,4 @@ void AdvancedFm::populateView() { QString path = thisDir->canonicalPath(); -// qWarning("path is "+path); + +qWarning("path is "+path); thisView->clear(); @@ -811,3 +814,3 @@ QListView * AdvancedFm::OtherView() { void AdvancedFm::setOtherTabCurrent() { -// qWarning("setOtherTabCurrent()"); + qWarning("setOtherTabCurrent() %d", whichTab); if ( whichTab == 1) { 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 @@ -156,3 +156,5 @@ protected slots: void fileBeamFinished( Ir *); - + bool copyDirectory( const QString & , const QString & ); +// void navigateToSelected(); + bool moveDirectory( const QString & , const QString & ); // void slotSwitchtoLocal(int); 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 @@ -70,4 +70,4 @@ void AdvancedFm::showMenuHidden() { } - rePopulate(); b = !b; + populateView(); } @@ -82,3 +82,3 @@ void AdvancedFm::showHidden() { } - rePopulate(); + populateView(); } @@ -341,4 +341,4 @@ void AdvancedFm::copy() { } - rePopulate(); setOtherTabCurrent(); + rePopulate(); } @@ -440,3 +440,3 @@ void AdvancedFm::copySameDir() { } - populateView(); + rePopulate(); } @@ -467,2 +467,8 @@ void AdvancedFm::move() { + if(QFileInfo(curFile).isDir()) { + moveDirectory( curFile, destFile ); + rePopulate(); + return; + } + QFile f( curFile); @@ -482,3 +488,45 @@ void AdvancedFm::move() { +bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { + int err = 0; + if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; + err = system((const char*)cmd); + } else + err = -1; + + if(err!=0) { + QMessageBox::message(tr("Note"),tr("Could not move\n") + src); + return false; + } + return true; +} + +bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { + + QString cmd = "/bin/cp -fpR " + src + " " + dest; + qWarning(cmd); + int err = system( (const char *) cmd ); + if ( err != 0 ) { + QMessageBox::message("AdvancedFm", + tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); + return false; + } + + return true; +} + + bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { + + + if(QFileInfo(src).isDir()) { + if( copyDirectory( src, dest )) { + setOtherTabCurrent(); + populateView(); + return true; + } + else + return false; + } + + bool success = true; @@ -689,3 +737,3 @@ void AdvancedFm::startProcess(const QString & cmd) { void AdvancedFm::processEnded(OProcess *) { - populateView(); + rePopulate(); } @@ -777,3 +825,3 @@ void AdvancedFm::renameIt() { doRename( thisView ); - populateView(); + rePopulate(); } @@ -796,3 +844,3 @@ void AdvancedFm::okRename() { delete view->currentItem(); - populateView(); + rePopulate(); } |