Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 62 |
1 files changed, 55 insertions, 7 deletions
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(); } |