author | llornkcor <llornkcor> | 2004-09-25 05:50:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 05:50:48 (UTC) |
commit | dba0864dd99dfc86a33bde72809634be7f0da9c4 (patch) (unidiff) | |
tree | 074ccc67cc4e7474d697117357bca2c1b19cef16 | |
parent | 244945237bc55945ba41f86d5f175204e00592ea (diff) | |
download | opie-dba0864dd99dfc86a33bde72809634be7f0da9c4.zip opie-dba0864dd99dfc86a33bde72809634be7f0da9c4.tar.gz opie-dba0864dd99dfc86a33bde72809634be7f0da9c4.tar.bz2 |
fix move overwrite
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index b5a05d3..f14f588 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -471,16 +471,22 @@ void AdvancedFm::move() { | |||
471 | rePopulate(); | 471 | rePopulate(); |
472 | return; | 472 | return; |
473 | } | 473 | } |
474 | QFile f( curFile); | 474 | QFile f( destFile); |
475 | if( f.exists()) { | 475 | if( f.exists()) { |
476 | switch ( QMessageBox::warning(this,tr("File Exists!"), | ||
477 | tr("<p>%1 already exists. Ok to overwrite?</P>").arg(destFile), | ||
478 | tr("Yes"),tr("No"),0,0,1)) { | ||
479 | case 1: | ||
480 | return; | ||
481 | break; | ||
482 | }; | ||
476 | if( !copyFile( curFile, destFile) ) { | 483 | if( !copyFile( curFile, destFile) ) { |
477 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 484 | QMessageBox::message(tr("Note"),tr("<p>Could not move %1</p>").arg(curFile)); |
478 | return; | 485 | return; |
479 | } else | 486 | } else |
480 | QFile::remove(curFile); | 487 | QFile::remove(curFile); |
481 | } | 488 | } |
482 | } | 489 | } |
483 | |||
484 | } | 490 | } |
485 | rePopulate(); | 491 | rePopulate(); |
486 | //setOtherTabCurrent(); | 492 | //setOtherTabCurrent(); |
@@ -488,7 +494,8 @@ void AdvancedFm::move() { | |||
488 | 494 | ||
489 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 495 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
490 | int err = 0; | 496 | int err = 0; |
491 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; | 497 | if( copyDirectory( src, dest ) ) { |
498 | QString cmd = "rm -rf " + src; | ||
492 | err = system((const char*)cmd); | 499 | err = system((const char*)cmd); |
493 | } else | 500 | } else |
494 | err = -1; | 501 | err = -1; |
@@ -506,8 +513,7 @@ bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | |||
506 | owarn << cmd << oendl; | 513 | owarn << cmd << oendl; |
507 | int err = system( (const char *) cmd ); | 514 | int err = system( (const char *) cmd ); |
508 | if ( err != 0 ) { | 515 | if ( err != 0 ) { |
509 | QMessageBox::message("AdvancedFm", | 516 | QMessageBox::message("AdvancedFm", tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); |
510 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); | ||
511 | return false; | 517 | return false; |
512 | } | 518 | } |
513 | 519 | ||