-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 @@ -103,9 +103,12 @@ void AdvancedFm::tabChanged(QWidget *) { void AdvancedFm::populateView() { + +qWarning("PopulateView"); QPixmap pm; QListView *thisView = CurrentView(); QDir *thisDir = CurrentDir(); QString path = thisDir->canonicalPath(); -// qWarning("path is "+path); + +qWarning("path is "+path); thisView->clear(); thisDir->setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -810,5 +813,5 @@ QListView * AdvancedFm::OtherView() { void AdvancedFm::setOtherTabCurrent() { -// qWarning("setOtherTabCurrent()"); + qWarning("setOtherTabCurrent() %d", whichTab); if ( whichTab == 1) { TabWidget->setCurrentWidget(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 @@ -155,5 +155,7 @@ protected slots: void doBeam(); 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 @@ -69,6 +69,6 @@ void AdvancedFm::showMenuHidden() { fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); } - rePopulate(); b = !b; + populateView(); } @@ -81,5 +81,5 @@ void AdvancedFm::showHidden() { OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); } - rePopulate(); + populateView(); } @@ -340,6 +340,6 @@ void AdvancedFm::copy() { } } - rePopulate(); setOtherTabCurrent(); + rePopulate(); } } @@ -439,5 +439,5 @@ void AdvancedFm::copySameDir() { delete fileDlg; } - populateView(); + rePopulate(); } @@ -466,4 +466,10 @@ void AdvancedFm::move() { // qDebug("CurrentFile file is " + curFile); + if(QFileInfo(curFile).isDir()) { + moveDirectory( curFile, destFile ); + rePopulate(); + return; + } + QFile f( curFile); if( f.exists()) { @@ -481,5 +487,47 @@ 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; struct stat status; @@ -688,5 +736,5 @@ void AdvancedFm::startProcess(const QString & cmd) { void AdvancedFm::processEnded(OProcess *) { - populateView(); + rePopulate(); } @@ -776,5 +824,5 @@ void AdvancedFm::renameIt() { oldName = thisView->currentItem()->text(0); doRename( thisView ); - populateView(); + rePopulate(); } @@ -795,5 +843,5 @@ void AdvancedFm::okRename() { view->takeItem( view->currentItem() ); delete view->currentItem(); - populateView(); + rePopulate(); } |