author | llornkcor <llornkcor> | 2003-11-07 12:37:57 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-11-07 12:37:57 (UTC) |
commit | fa1e47631442d509e9c1603684bdc9e9590cf866 (patch) (side-by-side diff) | |
tree | 5411adf72ccde8c46b13b0487a2602609b081d9e | |
parent | 82fdb639058354177d27b432f97e8750ac846ee6 (diff) | |
download | opie-fa1e47631442d509e9c1603684bdc9e9590cf866.zip opie-fa1e47631442d509e9c1603684bdc9e9590cf866.tar.gz opie-fa1e47631442d509e9c1603684bdc9e9590cf866.tar.bz2 |
from 1.0, needs fix
-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 @@ -101,13 +101,16 @@ 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); thisDir->setMatchAllDirs(TRUE); thisDir->setNameFilter(filterStr); @@ -808,9 +811,9 @@ QListView * AdvancedFm::OtherView() { return Local_View; } void AdvancedFm::setOtherTabCurrent() { -// qWarning("setOtherTabCurrent()"); + qWarning("setOtherTabCurrent() %d", whichTab); if ( whichTab == 1) { TabWidget->setCurrentWidget(1); } else { TabWidget->setCurrentWidget(0); 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 @@ -153,9 +153,11 @@ protected slots: void fileStatus(); void doAbout(); void doBeam(); void fileBeamFinished( Ir *); - + bool copyDirectory( const QString & , const QString & ); +// void navigateToSelected(); + bool moveDirectory( const QString & , const QString & ); // void slotSwitchtoLocal(int); private: MenuButton *menuButton; 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 @@ -67,10 +67,10 @@ void AdvancedFm::showMenuHidden() { CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); } - rePopulate(); b = !b; + populateView(); } void AdvancedFm::showHidden() { if (b) { @@ -79,9 +79,9 @@ void AdvancedFm::showHidden() { } else { CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); } - rePopulate(); + populateView(); } QString AdvancedFm::dealWithSymName(const QString &fileName) { QString strItem = fileName; @@ -338,10 +338,10 @@ void AdvancedFm::copy() { tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); return; } } - rePopulate(); setOtherTabCurrent(); + rePopulate(); } } void AdvancedFm::copyAs() { @@ -437,9 +437,9 @@ void AdvancedFm::copySameDir() { // qDebug("copy "+curFile+" as "+destFile); } delete fileDlg; } - populateView(); + rePopulate(); } void AdvancedFm::move() { qApp->processEvents(); @@ -464,8 +464,14 @@ void AdvancedFm::move() { curFile +="/"; curFile+= item; // qDebug("CurrentFile file is " + curFile); + if(QFileInfo(curFile).isDir()) { + moveDirectory( curFile, destFile ); + rePopulate(); + return; + } + QFile f( curFile); if( f.exists()) { if( !copyFile( curFile, destFile) ) { QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); @@ -479,9 +485,51 @@ void AdvancedFm::move() { rePopulate(); setOtherTabCurrent(); } +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; QFile srcFile(src); QFile destFile(dest); @@ -686,9 +734,9 @@ void AdvancedFm::startProcess(const QString & cmd) { qDebug("could not start process"); } void AdvancedFm::processEnded(OProcess *) { - populateView(); + rePopulate(); } void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { // qWarning("received stderrt %d bytes", buflen); @@ -774,9 +822,9 @@ void AdvancedFm::renameIt() { if( !CurrentView()->currentItem()) return; QListView *thisView = CurrentView(); oldName = thisView->currentItem()->text(0); doRename( thisView ); - populateView(); + rePopulate(); } void AdvancedFm::okRename() { if( !CurrentView()->currentItem()) return; @@ -793,9 +841,9 @@ void AdvancedFm::okRename() { oldName = ""; view->takeItem( view->currentItem() ); delete view->currentItem(); - populateView(); + rePopulate(); } void AdvancedFm::openSearch() { QMessageBox::message(tr("Note"),tr("Not Yet Implemented")); |