summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-10-13 21:53:13 (UTC)
committer llornkcor <llornkcor>2004-10-13 21:53:13 (UTC)
commit1f59ac9b59393b46a7ae5d4e1a46e1c1aaf05b23 (patch) (unidiff)
tree85461425e52ee7e90b40ffeaed7450122a8cb0b0
parentff1e5cf77abe865c4ca9beda114577ad4a13e61f (diff)
downloadopie-1f59ac9b59393b46a7ae5d4e1a46e1c1aaf05b23.zip
opie-1f59ac9b59393b46a7ae5d4e1a46e1c1aaf05b23.tar.gz
opie-1f59ac9b59393b46a7ae5d4e1a46e1c1aaf05b23.tar.bz2
fix move
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index f25048a..8b98898 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -461,77 +461,79 @@ void AdvancedFm::move() {
461 461
462 QStringList curFileList = getPath(); 462 QStringList curFileList = getPath();
463 if( curFileList.count() > 0) { 463 if( curFileList.count() > 0) {
464 QString curFile, destFile, item; 464 QString curFile, destFile, item;
465 465
466 QDir *thisDir = CurrentDir(); 466 QDir *thisDir = CurrentDir();
467 QDir *thatDir = OtherDir(); 467 QDir *thatDir = OtherDir();
468 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 468 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
469 item=(*it); 469 item=(*it);
470 QString destFile = thatDir->canonicalPath(); 470 QString destFile = thatDir->canonicalPath();
471 471
472 if(destFile.right(1).find("/",0,TRUE) == -1) 472 if(destFile.right(1).find("/",0,TRUE) == -1)
473 destFile+="/"; 473 destFile+="/";
474 destFile += item; 474 destFile += item;
475// odebug << "Destination file is "+destFile << oendl; 475// odebug << "Destination file is "+destFile << oendl;
476 476
477 curFile = thisDir->canonicalPath(); 477 curFile = thisDir->canonicalPath();
478 if(curFile.right(1).find("/",0,TRUE) == -1) 478 if(curFile.right(1).find("/",0,TRUE) == -1)
479 curFile +="/"; 479 curFile +="/";
480 curFile+= item; 480 curFile+= item;
481// odebug << "CurrentFile file is " + curFile << oendl; 481// odebug << "CurrentFile file is " + curFile << oendl;
482 482
483 if(QFileInfo(curFile).isDir()) { 483 if(QFileInfo(curFile).isDir()) {
484 moveDirectory( curFile, destFile ); 484 moveDirectory( curFile, destFile );
485 rePopulate(); 485 rePopulate();
486 return; 486 return;
487 } 487 }
488 QFile f( destFile); 488 QFile f( destFile);
489 if( f.exists()) { 489 if( f.exists()) {
490 switch ( QMessageBox::warning(this,tr("File Exists!"), 490 switch ( QMessageBox::warning(this,tr("File Exists!"),
491 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile), 491 tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile),
492 tr("Yes"),tr("No"),0,0,1)) { 492 tr("Yes"),tr("No"),0,0,1)) {
493 case 0:
494 break;
493 case 1: 495 case 1:
494 return; 496 return;
495 break; 497 break;
496 default: 498 default:
497 return; 499 return;
498 break; 500 break;
499 }; 501 };
502 }
500 if( !copyFile( curFile, destFile) ) { 503 if( !copyFile( curFile, destFile) ) {
501 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile)); 504 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile));
502 return; 505 return;
503 } else 506 } else
504 QFile::remove(curFile); 507 QFile::remove(curFile);
505 }
506 } 508 }
507 } 509 }
508 rePopulate(); 510 rePopulate();
509 //setOtherTabCurrent(); 511 //setOtherTabCurrent();
510} 512}
511 513
512bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { 514bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) {
513 int err = 0; 515 int err = 0;
514 if( copyDirectory( src, dest ) ) { 516 if( copyDirectory( src, dest ) ) {
515 QString cmd = "rm -rf " + src; 517 QString cmd = "rm -rf " + src;
516 err = system((const char*)cmd); 518 err = system((const char*)cmd);
517 } else 519 } else
518 err = -1; 520 err = -1;
519 521
520 if(err!=0) { 522 if(err!=0) {
521 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg( src)); 523 QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg( src));
522 return false; 524 return false;
523 } 525 }
524 return true; 526 return true;
525} 527}
526 528
527bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { 529bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) {
528 530
529 QString cmd = "/bin/cp -fpR " + src + " " + dest; 531 QString cmd = "/bin/cp -fpR " + src + " " + dest;
530 owarn << cmd << oendl; 532 owarn << cmd << oendl;
531 int err = system( (const char *) cmd ); 533 int err = system( (const char *) cmd );
532 if ( err != 0 ) { 534 if ( err != 0 ) {
533 QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) ); 535 QMessageBox::message("AdvancedFm", tr( "<p>Could not copy %1 to %2</p>").arg( src ).arg( dest ) );
534 return false; 536 return false;
535 } 537 }
536 538
537 return true; 539 return true;