-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index a6b59c7..98d024d 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -441,108 +441,106 @@ void AdvancedFm::upDir() { | |||
441 | } else { | 441 | } else { |
442 | QString current = currentRemoteDir.canonicalPath(); | 442 | QString current = currentRemoteDir.canonicalPath(); |
443 | QDir dir(current); | 443 | QDir dir(current); |
444 | dir.cdUp(); | 444 | dir.cdUp(); |
445 | current = dir.canonicalPath(); | 445 | current = dir.canonicalPath(); |
446 | chdir( current.latin1() ); | 446 | chdir( current.latin1() ); |
447 | currentRemoteDir.cd( current, TRUE); | 447 | currentRemoteDir.cd( current, TRUE); |
448 | populateRemoteView(); | 448 | populateRemoteView(); |
449 | update(); | 449 | update(); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | void AdvancedFm::copy() { | 453 | void AdvancedFm::copy() { |
454 | qApp->processEvents(); | 454 | qApp->processEvents(); |
455 | QStringList curFileList = getPath(); | 455 | QStringList curFileList = getPath(); |
456 | bool doMsg=true; | 456 | bool doMsg=true; |
457 | int count=curFileList.count(); | 457 | int count=curFileList.count(); |
458 | if( count > 0) { | 458 | if( count > 0) { |
459 | if(count > 1 ){ | 459 | if(count > 1 ){ |
460 | QString msg; | 460 | QString msg; |
461 | msg=tr("Really copy\n%1 files?").arg(count); | 461 | msg=tr("Really copy\n%1 files?").arg(count); |
462 | switch ( QMessageBox::warning(this,tr("Delete"),msg | 462 | switch ( QMessageBox::warning(this,tr("Delete"),msg |
463 | ,tr("Yes"),tr("No"),0,0,1) ) { | 463 | ,tr("Yes"),tr("No"),0,0,1) ) { |
464 | case 0: | 464 | case 0: |
465 | doMsg=false; | 465 | doMsg=false; |
466 | break; | 466 | break; |
467 | case 1: | 467 | case 1: |
468 | return; | 468 | return; |
469 | break; | 469 | break; |
470 | }; | 470 | }; |
471 | } | 471 | } |
472 | 472 | ||
473 | QString curFile, item, destFile; | 473 | QString curFile, item, destFile; |
474 | if (TabWidget->getCurrentTab() == 0) { | 474 | if (TabWidget->getCurrentTab() == 0) { |
475 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 475 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
476 | item=(*it); | 476 | item=(*it); |
477 | if(item.find("->",0,TRUE)) //symlink | 477 | if(item.find("->",0,TRUE)) //symlink |
478 | item = item.left(item.find("->",0,TRUE)); | 478 | item = item.left(item.find("->",0,TRUE)); |
479 | 479 | ||
480 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; | 480 | destFile = currentRemoteDir.canonicalPath()+"/"+ item; |
481 | qDebug("Destination file is "+destFile); | 481 | qDebug("Destination file is "+destFile); |
482 | 482 | ||
483 | curFile = currentDir.canonicalPath()+"/"+ item; | 483 | curFile = currentDir.canonicalPath()+"/"+ item; |
484 | qDebug("CurrentFile file is " + curFile); | 484 | qDebug("CurrentFile file is " + curFile); |
485 | 485 | ||
486 | QFile f(destFile); | 486 | QFile f(destFile); |
487 | if( f.exists()) { | 487 | if( f.exists()) { |
488 | if(doMsg) { | 488 | if(doMsg) { |
489 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 489 | switch ( QMessageBox::warning(this,tr("File Exists!"), tr("%1 exists. Ok to overwrite?").arg( item ), tr("Yes"),tr("No"),0,0,1) ) { |
490 | item+tr("\nexists. Ok to overwrite?"), | ||
491 | tr("Yes"),tr("No"),0,0,1) ) { | ||
492 | case 1: | 490 | case 1: |
493 | return; | 491 | return; |
494 | break; | 492 | break; |
495 | }; | 493 | }; |
496 | } | 494 | } |
497 | f.remove(); | 495 | f.remove(); |
498 | } | 496 | } |
499 | if(!copyFile( curFile, destFile) ) { | 497 | if(!copyFile( curFile, destFile) ) { |
500 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 498 | QMessageBox::message("AdvancedFm",tr( "Could not copy %1 to %2").arg( curFile ).arg( destFile ) ); |
501 | return; | 499 | return; |
502 | } | 500 | } |
503 | } | 501 | } |
504 | populateRemoteView(); | 502 | populateRemoteView(); |
505 | TabWidget->setCurrentTab(1); | 503 | TabWidget->setCurrentTab(1); |
506 | 504 | ||
507 | } else { | 505 | } else { |
508 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 506 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
509 | item= (*it); | 507 | item= (*it); |
510 | if(item.find("->",0,TRUE)) //symlink | 508 | if(item.find("->",0,TRUE)) //symlink |
511 | item = item.left(item.find("->",0,TRUE)); | 509 | item = item.left(item.find("->",0,TRUE)); |
512 | 510 | ||
513 | destFile = currentDir.canonicalPath()+"/"+ item; | 511 | destFile = currentDir.canonicalPath()+"/"+ item; |
514 | qDebug("Destination file is "+destFile); | 512 | qDebug("Destination file is "+destFile); |
515 | 513 | ||
516 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 514 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
517 | qDebug("CurrentFile file is " + curFile); | 515 | qDebug("CurrentFile file is " + curFile); |
518 | 516 | ||
519 | QFile f(destFile); | 517 | QFile f(destFile); |
520 | if( f.exists()) { | 518 | if( f.exists()) { |
521 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 519 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
522 | item+tr("\nexists. Ok to overwrite?"), | 520 | item+tr("\nexists. Ok to overwrite?"), |
523 | tr("Yes"),tr("No"),0,0,1) ) { | 521 | tr("Yes"),tr("No"),0,0,1) ) { |
524 | case 1: | 522 | case 1: |
525 | return; | 523 | return; |
526 | break; | 524 | break; |
527 | }; | 525 | }; |
528 | f.remove(); | 526 | f.remove(); |
529 | } | 527 | } |
530 | if(!copyFile( curFile, destFile) ) { | 528 | if(!copyFile( curFile, destFile) ) { |
531 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 529 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
532 | +curFile +tr("to\n")+destFile); | 530 | +curFile +tr("to\n")+destFile); |
533 | return; | 531 | return; |
534 | 532 | ||
535 | } | 533 | } |
536 | } | 534 | } |
537 | populateLocalView(); | 535 | populateLocalView(); |
538 | TabWidget->setCurrentTab(0); | 536 | TabWidget->setCurrentTab(0); |
539 | } | 537 | } |
540 | 538 | ||
541 | } | 539 | } |
542 | } | 540 | } |
543 | 541 | ||
544 | void AdvancedFm::copyAs() { | 542 | void AdvancedFm::copyAs() { |
545 | qApp->processEvents(); | 543 | qApp->processEvents(); |
546 | 544 | ||
547 | QStringList curFileList = getPath(); | 545 | QStringList curFileList = getPath(); |
548 | QString curFile, item; | 546 | QString curFile, item; |