author | simon <simon> | 2002-12-17 13:19:26 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-17 13:19:26 (UTC) |
commit | 72b81e8f489c2d349ad0d481fdc7a870fd627ec8 (patch) (unidiff) | |
tree | 2a8e98e1edeefec6df03330571d49dcd2667df93 | |
parent | 1dee9c33c12ba45134b1ccb17bc84bc7fa94eb3b (diff) | |
download | opie-72b81e8f489c2d349ad0d481fdc7a870fd627ec8.zip opie-72b81e8f489c2d349ad0d481fdc7a870fd627ec8.tar.gz opie-72b81e8f489c2d349ad0d481fdc7a870fd627ec8.tar.bz2 |
- i18n fixlet by Carsten
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index f77554a..a6b59c7 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -401,552 +401,552 @@ void AdvancedFm::filePerms() { | |||
401 | populateLocalView(); | 401 | populateLocalView(); |
402 | } else { | 402 | } else { |
403 | populateRemoteView(); | 403 | populateRemoteView(); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | void AdvancedFm::doProperties() { | 407 | void AdvancedFm::doProperties() { |
408 | #if defined(QT_QWS_OPIE) | 408 | #if defined(QT_QWS_OPIE) |
409 | 409 | ||
410 | QStringList curFileList = getPath(); | 410 | QStringList curFileList = getPath(); |
411 | 411 | ||
412 | QString filePath; | 412 | QString filePath; |
413 | if (TabWidget->getCurrentTab() == 0) { | 413 | if (TabWidget->getCurrentTab() == 0) { |
414 | filePath = currentDir.canonicalPath()+"/"; | 414 | filePath = currentDir.canonicalPath()+"/"; |
415 | } else { | 415 | } else { |
416 | filePath= currentRemoteDir.canonicalPath()+"/"; | 416 | filePath= currentRemoteDir.canonicalPath()+"/"; |
417 | } | 417 | } |
418 | qDebug("%d",curFileList.count()); | 418 | qDebug("%d",curFileList.count()); |
419 | 419 | ||
420 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 420 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
421 | qDebug((filePath+*it)); | 421 | qDebug((filePath+*it)); |
422 | DocLnk lnk( (filePath+*it)); | 422 | DocLnk lnk( (filePath+*it)); |
423 | LnkProperties prop( &lnk ); | 423 | LnkProperties prop( &lnk ); |
424 | prop.showMaximized(); | 424 | prop.showMaximized(); |
425 | prop.exec(); | 425 | prop.exec(); |
426 | } | 426 | } |
427 | #endif | 427 | #endif |
428 | 428 | ||
429 | } | 429 | } |
430 | 430 | ||
431 | void AdvancedFm::upDir() { | 431 | void AdvancedFm::upDir() { |
432 | if (TabWidget->getCurrentTab() == 0) { | 432 | if (TabWidget->getCurrentTab() == 0) { |
433 | QString current = currentDir.canonicalPath(); | 433 | QString current = currentDir.canonicalPath(); |
434 | QDir dir(current); | 434 | QDir dir(current); |
435 | dir.cdUp(); | 435 | dir.cdUp(); |
436 | current = dir.canonicalPath(); | 436 | current = dir.canonicalPath(); |
437 | chdir( current.latin1() ); | 437 | chdir( current.latin1() ); |
438 | currentDir.cd( current, TRUE); | 438 | currentDir.cd( current, TRUE); |
439 | populateLocalView(); | 439 | populateLocalView(); |
440 | update(); | 440 | update(); |
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!"), |
490 | item+tr("\nexists. Ok to overwrite?"), | 490 | item+tr("\nexists. Ok to overwrite?"), |
491 | tr("Yes"),tr("No"),0,0,1) ) { | 491 | tr("Yes"),tr("No"),0,0,1) ) { |
492 | case 1: | 492 | case 1: |
493 | return; | 493 | return; |
494 | break; | 494 | break; |
495 | }; | 495 | }; |
496 | } | 496 | } |
497 | f.remove(); | 497 | f.remove(); |
498 | } | 498 | } |
499 | if(!copyFile( curFile, destFile) ) { | 499 | if(!copyFile( curFile, destFile) ) { |
500 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); | 500 | QMessageBox::message("AdvancedFm","Could not copy\n"+curFile +"to\n"+destFile); |
501 | return; | 501 | return; |
502 | } | 502 | } |
503 | } | 503 | } |
504 | populateRemoteView(); | 504 | populateRemoteView(); |
505 | TabWidget->setCurrentTab(1); | 505 | TabWidget->setCurrentTab(1); |
506 | 506 | ||
507 | } else { | 507 | } else { |
508 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 508 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
509 | item= (*it); | 509 | item= (*it); |
510 | if(item.find("->",0,TRUE)) //symlink | 510 | if(item.find("->",0,TRUE)) //symlink |
511 | item = item.left(item.find("->",0,TRUE)); | 511 | item = item.left(item.find("->",0,TRUE)); |
512 | 512 | ||
513 | destFile = currentDir.canonicalPath()+"/"+ item; | 513 | destFile = currentDir.canonicalPath()+"/"+ item; |
514 | qDebug("Destination file is "+destFile); | 514 | qDebug("Destination file is "+destFile); |
515 | 515 | ||
516 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; | 516 | curFile = currentRemoteDir.canonicalPath()+"/"+ item;; |
517 | qDebug("CurrentFile file is " + curFile); | 517 | qDebug("CurrentFile file is " + curFile); |
518 | 518 | ||
519 | QFile f(destFile); | 519 | QFile f(destFile); |
520 | if( f.exists()) { | 520 | if( f.exists()) { |
521 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 521 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
522 | item+tr("\nexists. Ok to overwrite?"), | 522 | item+tr("\nexists. Ok to overwrite?"), |
523 | tr("Yes"),tr("No"),0,0,1) ) { | 523 | tr("Yes"),tr("No"),0,0,1) ) { |
524 | case 1: | 524 | case 1: |
525 | return; | 525 | return; |
526 | break; | 526 | break; |
527 | }; | 527 | }; |
528 | f.remove(); | 528 | f.remove(); |
529 | } | 529 | } |
530 | if(!copyFile( curFile, destFile) ) { | 530 | if(!copyFile( curFile, destFile) ) { |
531 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 531 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
532 | +curFile +tr("to\n")+destFile); | 532 | +curFile +tr("to\n")+destFile); |
533 | return; | 533 | return; |
534 | 534 | ||
535 | } | 535 | } |
536 | } | 536 | } |
537 | populateLocalView(); | 537 | populateLocalView(); |
538 | TabWidget->setCurrentTab(0); | 538 | TabWidget->setCurrentTab(0); |
539 | } | 539 | } |
540 | 540 | ||
541 | } | 541 | } |
542 | } | 542 | } |
543 | 543 | ||
544 | void AdvancedFm::copyAs() { | 544 | void AdvancedFm::copyAs() { |
545 | qApp->processEvents(); | 545 | qApp->processEvents(); |
546 | 546 | ||
547 | QStringList curFileList = getPath(); | 547 | QStringList curFileList = getPath(); |
548 | QString curFile, item; | 548 | QString curFile, item; |
549 | InputDialog *fileDlg; | 549 | InputDialog *fileDlg; |
550 | if (TabWidget->getCurrentTab() == 0) { | 550 | if (TabWidget->getCurrentTab() == 0) { |
551 | qDebug("tab 1"); | 551 | qDebug("tab 1"); |
552 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 552 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
553 | QString destFile; | 553 | QString destFile; |
554 | item=(*it); | 554 | item=(*it); |
555 | curFile = currentDir.canonicalPath()+"/"+(*it); | 555 | curFile = currentDir.canonicalPath()+"/"+(*it); |
556 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 556 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
557 | 557 | ||
558 | fileDlg->setInputText((const QString &) destFile ); | 558 | fileDlg->setInputText((const QString &) destFile ); |
559 | fileDlg->exec(); | 559 | fileDlg->exec(); |
560 | 560 | ||
561 | if( fileDlg->result() == 1 ) { | 561 | if( fileDlg->result() == 1 ) { |
562 | QString filename = fileDlg->LineEdit1->text(); | 562 | QString filename = fileDlg->LineEdit1->text(); |
563 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 563 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
564 | 564 | ||
565 | QFile f(destFile); | 565 | QFile f(destFile); |
566 | if( f.exists()) { | 566 | if( f.exists()) { |
567 | switch (QMessageBox::warning(this,tr("File Exists!"), | 567 | switch (QMessageBox::warning(this,tr("File Exists!"), |
568 | item+tr("\nexists. Ok to overwrite?"), | 568 | item+tr("\nexists. Ok to overwrite?"), |
569 | tr("Yes"),tr("No"),0,0,1) ) { | 569 | tr("Yes"),tr("No"),0,0,1) ) { |
570 | case 0: | 570 | case 0: |
571 | f.remove(); | 571 | f.remove(); |
572 | break; | 572 | break; |
573 | case 1: | 573 | case 1: |
574 | return; | 574 | return; |
575 | break; | 575 | break; |
576 | }; | 576 | }; |
577 | } | 577 | } |
578 | if(!copyFile( curFile,destFile) ) { | 578 | if(!copyFile( curFile,destFile) ) { |
579 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 579 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
580 | +curFile +tr("to\n")+destFile); | 580 | +curFile +tr("to\n")+destFile); |
581 | return; | 581 | return; |
582 | } | 582 | } |
583 | } | 583 | } |
584 | delete fileDlg; | 584 | delete fileDlg; |
585 | 585 | ||
586 | } | 586 | } |
587 | populateRemoteView(); | 587 | populateRemoteView(); |
588 | TabWidget->setCurrentTab(1); | 588 | TabWidget->setCurrentTab(1); |
589 | 589 | ||
590 | } else { | 590 | } else { |
591 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 591 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
592 | 592 | ||
593 | item=(*it); | 593 | item=(*it); |
594 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); | 594 | curFile = currentRemoteDir.canonicalPath()+"/"+(*it); |
595 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); | 595 | fileDlg = new InputDialog( this,tr("Copy "+curFile+" As"), TRUE, 0); |
596 | 596 | ||
597 | QString destFile; | 597 | QString destFile; |
598 | fileDlg->setInputText((const QString &) destFile); | 598 | fileDlg->setInputText((const QString &) destFile); |
599 | fileDlg->exec(); | 599 | fileDlg->exec(); |
600 | 600 | ||
601 | if( fileDlg->result() == 1 ) { | 601 | if( fileDlg->result() == 1 ) { |
602 | QString filename = fileDlg->LineEdit1->text(); | 602 | QString filename = fileDlg->LineEdit1->text(); |
603 | destFile = currentDir.canonicalPath()+"/"+filename; | 603 | destFile = currentDir.canonicalPath()+"/"+filename; |
604 | 604 | ||
605 | QFile f( destFile); | 605 | QFile f( destFile); |
606 | if( f.exists()) { | 606 | if( f.exists()) { |
607 | switch ( QMessageBox::warning(this,tr("File Exists!"), | 607 | switch ( QMessageBox::warning(this,tr("File Exists!"), |
608 | item+tr("\nexists. Ok to overwrite?"), | 608 | item+tr("\nexists. Ok to overwrite?"), |
609 | tr("Yes"),tr("No"),0,0,1) ) { | 609 | tr("Yes"),tr("No"),0,0,1) ) { |
610 | case 0: | 610 | case 0: |
611 | f.remove(); | 611 | f.remove(); |
612 | break; | 612 | break; |
613 | case 1: | 613 | case 1: |
614 | return; | 614 | return; |
615 | break; | 615 | break; |
616 | }; | 616 | }; |
617 | } | 617 | } |
618 | if(!copyFile( curFile,destFile) ) { | 618 | if(!copyFile( curFile,destFile) ) { |
619 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 619 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
620 | +curFile +tr("to\n")+destFile); | 620 | +curFile +tr("to\n")+destFile); |
621 | return; | 621 | return; |
622 | } | 622 | } |
623 | 623 | ||
624 | } | 624 | } |
625 | delete fileDlg; | 625 | delete fileDlg; |
626 | 626 | ||
627 | } | 627 | } |
628 | populateLocalView(); | 628 | populateLocalView(); |
629 | TabWidget->setCurrentTab(0); | 629 | TabWidget->setCurrentTab(0); |
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
633 | void AdvancedFm::copySameDir() { | 633 | void AdvancedFm::copySameDir() { |
634 | qApp->processEvents(); | 634 | qApp->processEvents(); |
635 | QStringList curFileList = getPath(); | 635 | QStringList curFileList = getPath(); |
636 | QString curFile, item, destFile; | 636 | QString curFile, item, destFile; |
637 | InputDialog *fileDlg; | 637 | InputDialog *fileDlg; |
638 | 638 | ||
639 | if (TabWidget->getCurrentTab() == 0) { | 639 | if (TabWidget->getCurrentTab() == 0) { |
640 | 640 | ||
641 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 641 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
642 | item=(*it); | 642 | item=(*it); |
643 | curFile = currentDir.canonicalPath()+"/"+ item; | 643 | curFile = currentDir.canonicalPath()+"/"+ item; |
644 | 644 | ||
645 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 645 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
646 | fileDlg->setInputText((const QString &) destFile ); | 646 | fileDlg->setInputText((const QString &) destFile ); |
647 | fileDlg->exec(); | 647 | fileDlg->exec(); |
648 | 648 | ||
649 | if( fileDlg->result() == 1 ) { | 649 | if( fileDlg->result() == 1 ) { |
650 | 650 | ||
651 | QString filename = fileDlg->LineEdit1->text(); | 651 | QString filename = fileDlg->LineEdit1->text(); |
652 | destFile = currentDir.canonicalPath()+"/"+filename; | 652 | destFile = currentDir.canonicalPath()+"/"+filename; |
653 | 653 | ||
654 | QFile f(destFile); | 654 | QFile f(destFile); |
655 | if( f.exists()) { | 655 | if( f.exists()) { |
656 | switch (QMessageBox::warning(this,tr("Delete"), | 656 | switch (QMessageBox::warning(this,tr("Delete"), |
657 | destFile+tr(" already exists\nDo you really want to delete it?"), | 657 | destFile+tr(" already exists.\nDo you really want to delete it?"), |
658 | tr("Yes"),tr("No"),0,0,1) ) { | 658 | tr("Yes"),tr("No"),0,0,1) ) { |
659 | case 0: | 659 | case 0: |
660 | 660 | ||
661 | f.remove(); | 661 | f.remove(); |
662 | break; | 662 | break; |
663 | case 1: | 663 | case 1: |
664 | return; | 664 | return; |
665 | break; | 665 | break; |
666 | }; | 666 | }; |
667 | } | 667 | } |
668 | if(!copyFile( curFile,destFile) ) { | 668 | if(!copyFile( curFile,destFile) ) { |
669 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 669 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
670 | +curFile +tr("to\n")+destFile); | 670 | +curFile +tr("to\n")+destFile); |
671 | return; | 671 | return; |
672 | } | 672 | } |
673 | 673 | ||
674 | qDebug("copy "+curFile+" as "+destFile); | 674 | qDebug("copy "+curFile+" as "+destFile); |
675 | } | 675 | } |
676 | delete fileDlg; | 676 | delete fileDlg; |
677 | } | 677 | } |
678 | populateLocalView(); | 678 | populateLocalView(); |
679 | 679 | ||
680 | } else { | 680 | } else { |
681 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 681 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
682 | item=(*it); | 682 | item=(*it); |
683 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; | 683 | curFile = currentRemoteDir.canonicalPath()+"/"+ item; |
684 | 684 | ||
685 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 685 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
686 | fileDlg->setInputText((const QString &) destFile); | 686 | fileDlg->setInputText((const QString &) destFile); |
687 | fileDlg->exec(); | 687 | fileDlg->exec(); |
688 | if( fileDlg->result() == 1 ) { | 688 | if( fileDlg->result() == 1 ) { |
689 | QString filename = fileDlg->LineEdit1->text(); | 689 | QString filename = fileDlg->LineEdit1->text(); |
690 | 690 | ||
691 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; | 691 | destFile = currentRemoteDir.canonicalPath()+"/"+filename; |
692 | 692 | ||
693 | QFile f(destFile); | 693 | QFile f(destFile); |
694 | if( f.exists()) { | 694 | if( f.exists()) { |
695 | switch ( QMessageBox::warning(this,tr("Delete"), | 695 | switch ( QMessageBox::warning(this,tr("Delete"), |
696 | destFile+tr(" already exists\nDo you really want to delete it?"), | 696 | destFile+tr(" already exists.\nDo you really want to delete it?"), |
697 | tr("Yes"),tr("No"),0,0,1) ) { | 697 | tr("Yes"),tr("No"),0,0,1) ) { |
698 | case 0: | 698 | case 0: |
699 | f.remove(); | 699 | f.remove(); |
700 | break; | 700 | break; |
701 | case 1: | 701 | case 1: |
702 | return; | 702 | return; |
703 | break; | 703 | break; |
704 | }; | 704 | }; |
705 | } | 705 | } |
706 | if(!copyFile( curFile,destFile) ) { | 706 | if(!copyFile( curFile,destFile) ) { |
707 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 707 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
708 | +curFile +tr("to\n")+destFile); | 708 | +curFile +tr("to\n")+destFile); |
709 | return; | 709 | return; |
710 | } | 710 | } |
711 | qDebug("copy "+curFile+" as "+destFile); | 711 | qDebug("copy "+curFile+" as "+destFile); |
712 | } | 712 | } |
713 | delete fileDlg; | 713 | delete fileDlg; |
714 | } | 714 | } |
715 | populateRemoteView(); | 715 | populateRemoteView(); |
716 | } | 716 | } |
717 | } | 717 | } |
718 | 718 | ||
719 | void AdvancedFm::move() { | 719 | void AdvancedFm::move() { |
720 | qApp->processEvents(); | 720 | qApp->processEvents(); |
721 | 721 | ||
722 | QStringList curFileList = getPath(); | 722 | QStringList curFileList = getPath(); |
723 | if( curFileList.count() > 0) { | 723 | if( curFileList.count() > 0) { |
724 | QString curFile, destFile, item; | 724 | QString curFile, destFile, item; |
725 | 725 | ||
726 | if (TabWidget->getCurrentTab() == 0) { | 726 | if (TabWidget->getCurrentTab() == 0) { |
727 | 727 | ||
728 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 728 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
729 | item=(*it); | 729 | item=(*it); |
730 | QString destFile = currentRemoteDir.canonicalPath(); | 730 | QString destFile = currentRemoteDir.canonicalPath(); |
731 | 731 | ||
732 | if(destFile.right(1).find("/",0,TRUE) == -1) | 732 | if(destFile.right(1).find("/",0,TRUE) == -1) |
733 | destFile+="/"; | 733 | destFile+="/"; |
734 | destFile += item; | 734 | destFile += item; |
735 | curFile = currentDir.canonicalPath(); | 735 | curFile = currentDir.canonicalPath(); |
736 | 736 | ||
737 | qDebug("Destination file is "+destFile); | 737 | qDebug("Destination file is "+destFile); |
738 | 738 | ||
739 | if(curFile.right(1).find("/",0,TRUE) == -1) | 739 | if(curFile.right(1).find("/",0,TRUE) == -1) |
740 | curFile +="/"; | 740 | curFile +="/"; |
741 | 741 | ||
742 | curFile+= item; | 742 | curFile+= item; |
743 | qDebug("CurrentFile file is " + curFile); | 743 | qDebug("CurrentFile file is " + curFile); |
744 | 744 | ||
745 | QFile f( curFile); | 745 | QFile f( curFile); |
746 | if( f.exists()) { | 746 | if( f.exists()) { |
747 | if(!copyFile( curFile,destFile) ) { | 747 | if(!copyFile( curFile,destFile) ) { |
748 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 748 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
749 | return; | 749 | return; |
750 | } else | 750 | } else |
751 | QFile::remove(curFile); | 751 | QFile::remove(curFile); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | TabWidget->setCurrentTab(1); | 755 | TabWidget->setCurrentTab(1); |
756 | 756 | ||
757 | } else { //view 2 | 757 | } else { //view 2 |
758 | 758 | ||
759 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 759 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
760 | item = (*it); | 760 | item = (*it); |
761 | QString destFile = currentDir.canonicalPath(); | 761 | QString destFile = currentDir.canonicalPath(); |
762 | 762 | ||
763 | if(destFile.right(1).find("/",0,TRUE) == -1) | 763 | if(destFile.right(1).find("/",0,TRUE) == -1) |
764 | destFile+="/"; | 764 | destFile+="/"; |
765 | 765 | ||
766 | destFile += item; | 766 | destFile += item; |
767 | 767 | ||
768 | qDebug("Destination file is "+destFile); | 768 | qDebug("Destination file is "+destFile); |
769 | 769 | ||
770 | curFile = currentRemoteDir.canonicalPath(); | 770 | curFile = currentRemoteDir.canonicalPath(); |
771 | 771 | ||
772 | if(curFile.right(1).find("/",0,TRUE) == -1) | 772 | if(curFile.right(1).find("/",0,TRUE) == -1) |
773 | curFile +="/"; | 773 | curFile +="/"; |
774 | curFile+= item; | 774 | curFile+= item; |
775 | qDebug("CurrentFile file is " + curFile); | 775 | qDebug("CurrentFile file is " + curFile); |
776 | 776 | ||
777 | QFile f( curFile); | 777 | QFile f( curFile); |
778 | if( f.exists()) { | 778 | if( f.exists()) { |
779 | if(!copyFile( curFile, destFile) ) { | 779 | if(!copyFile( curFile, destFile) ) { |
780 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); | 780 | QMessageBox::message(tr("Note"),tr("Could not move\n") + curFile); |
781 | return; | 781 | return; |
782 | } else | 782 | } else |
783 | QFile::remove( curFile); | 783 | QFile::remove( curFile); |
784 | } | 784 | } |
785 | TabWidget->setCurrentTab(0); | 785 | TabWidget->setCurrentTab(0); |
786 | } | 786 | } |
787 | } | 787 | } |
788 | populateRemoteView(); | 788 | populateRemoteView(); |
789 | populateLocalView(); | 789 | populateLocalView(); |
790 | } | 790 | } |
791 | } | 791 | } |
792 | 792 | ||
793 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 793 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
794 | char bf[ 50000 ]; | 794 | char bf[ 50000 ]; |
795 | int bytesRead; | 795 | int bytesRead; |
796 | bool success = TRUE; | 796 | bool success = TRUE; |
797 | struct stat status; | 797 | struct stat status; |
798 | 798 | ||
799 | QFile s( src ); | 799 | QFile s( src ); |
800 | QFile d( dest ); | 800 | QFile d( dest ); |
801 | 801 | ||
802 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { | 802 | if( s.open( IO_ReadOnly | IO_Raw ) && d.open( IO_WriteOnly | IO_Raw ) ) { |
803 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { | 803 | while( (bytesRead = s.readBlock( bf, sizeof( bf ) )) == sizeof( bf ) ) { |
804 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ | 804 | if( d.writeBlock( bf, sizeof( bf ) ) != sizeof( bf ) ){ |
805 | success = FALSE; | 805 | success = FALSE; |
806 | break; | 806 | break; |
807 | } | 807 | } |
808 | } | 808 | } |
809 | if( success && (bytesRead > 0) ){ | 809 | if( success && (bytesRead > 0) ){ |
810 | d.writeBlock( bf, bytesRead ); | 810 | d.writeBlock( bf, bytesRead ); |
811 | } | 811 | } |
812 | } else { | 812 | } else { |
813 | success = FALSE; | 813 | success = FALSE; |
814 | } | 814 | } |
815 | 815 | ||
816 | // Set file permissions | 816 | // Set file permissions |
817 | if( stat( (const char *) src, &status ) == 0 ){ | 817 | if( stat( (const char *) src, &status ) == 0 ){ |
818 | chmod( (const char *) dest, status.st_mode ); | 818 | chmod( (const char *) dest, status.st_mode ); |
819 | } | 819 | } |
820 | 820 | ||
821 | return success; | 821 | return success; |
822 | } | 822 | } |
823 | 823 | ||
824 | void AdvancedFm::runCommand() { | 824 | void AdvancedFm::runCommand() { |
825 | QString curFile; | 825 | QString curFile; |
826 | if (TabWidget->getCurrentTab() == 0) { | 826 | if (TabWidget->getCurrentTab() == 0) { |
827 | if( Local_View->currentItem()) | 827 | if( Local_View->currentItem()) |
828 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 828 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
829 | } else { | 829 | } else { |
830 | if(Remote_View->currentItem()) | 830 | if(Remote_View->currentItem()) |
831 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); | 831 | curFile = currentRemoteDir.canonicalPath() + "/"+Remote_View->currentItem()->text(0); |
832 | } | 832 | } |
833 | 833 | ||
834 | InputDialog *fileDlg; | 834 | InputDialog *fileDlg; |
835 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 835 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
836 | fileDlg->setInputText(curFile); | 836 | fileDlg->setInputText(curFile); |
837 | fileDlg->exec(); | 837 | fileDlg->exec(); |
838 | //QString command; | 838 | //QString command; |
839 | 839 | ||
840 | if( fileDlg->result() == 1 ) { | 840 | if( fileDlg->result() == 1 ) { |
841 | qDebug(fileDlg->LineEdit1->text()); | 841 | qDebug(fileDlg->LineEdit1->text()); |
842 | QStringList command; | 842 | QStringList command; |
843 | 843 | ||
844 | command << "/bin/sh"; | 844 | command << "/bin/sh"; |
845 | command << "-c"; | 845 | command << "-c"; |
846 | command << fileDlg->LineEdit1->text(); | 846 | command << fileDlg->LineEdit1->text(); |
847 | Output *outDlg; | 847 | Output *outDlg; |
848 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 848 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
849 | outDlg->showMaximized(); | 849 | outDlg->showMaximized(); |
850 | outDlg->exec(); | 850 | outDlg->exec(); |
851 | qApp->processEvents(); | 851 | qApp->processEvents(); |
852 | 852 | ||
853 | } | 853 | } |
854 | } | 854 | } |
855 | 855 | ||
856 | void AdvancedFm::runCommandStd() { | 856 | void AdvancedFm::runCommandStd() { |
857 | QString curFile; | 857 | QString curFile; |
858 | if (TabWidget->getCurrentTab() == 0) { | 858 | if (TabWidget->getCurrentTab() == 0) { |
859 | if( Local_View->currentItem()) | 859 | if( Local_View->currentItem()) |
860 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); | 860 | curFile = currentDir.canonicalPath() +"/"+ Local_View->currentItem()->text(0); |
861 | } else { | 861 | } else { |
862 | if(Remote_View->currentItem()) | 862 | if(Remote_View->currentItem()) |
863 | curFile = currentRemoteDir.canonicalPath() +"/" | 863 | curFile = currentRemoteDir.canonicalPath() +"/" |
864 | + Remote_View->currentItem()->text(0); | 864 | + Remote_View->currentItem()->text(0); |
865 | } | 865 | } |
866 | 866 | ||
867 | InputDialog *fileDlg; | 867 | InputDialog *fileDlg; |
868 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 868 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
869 | fileDlg->setInputText(curFile); | 869 | fileDlg->setInputText(curFile); |
870 | fileDlg->exec(); | 870 | fileDlg->exec(); |
871 | 871 | ||
872 | if( fileDlg->result() == 1 ) { | 872 | if( fileDlg->result() == 1 ) { |
873 | qApp->processEvents(); | 873 | qApp->processEvents(); |
874 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); | 874 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); |
875 | } | 875 | } |
876 | } | 876 | } |
877 | 877 | ||
878 | void AdvancedFm::fileStatus() { | 878 | void AdvancedFm::fileStatus() { |
879 | QString curFile; | 879 | QString curFile; |
880 | if (TabWidget->getCurrentTab() == 0) { | 880 | if (TabWidget->getCurrentTab() == 0) { |
881 | curFile = Local_View->currentItem()->text(0); | 881 | curFile = Local_View->currentItem()->text(0); |
882 | } else { | 882 | } else { |
883 | curFile = Remote_View->currentItem()->text(0); | 883 | curFile = Remote_View->currentItem()->text(0); |
884 | } | 884 | } |
885 | 885 | ||
886 | QStringList command; | 886 | QStringList command; |
887 | command << "/bin/sh"; | 887 | command << "/bin/sh"; |
888 | command << "-c"; | 888 | command << "-c"; |
889 | command << "stat -l "+ curFile; | 889 | command << "stat -l "+ curFile; |
890 | 890 | ||
891 | Output *outDlg; | 891 | Output *outDlg; |
892 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 892 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
893 | outDlg->showMaximized(); | 893 | outDlg->showMaximized(); |
894 | outDlg->exec(); | 894 | outDlg->exec(); |
895 | qApp->processEvents(); | 895 | qApp->processEvents(); |
896 | 896 | ||
897 | 897 | ||
898 | // Output *outDlg; | 898 | // Output *outDlg; |
899 | // outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); | 899 | // outDlg = new Output(this, tr("AdvancedFm Output"),FALSE); |
900 | // outDlg->showMaximized(); | 900 | // outDlg->showMaximized(); |
901 | // outDlg->show(); | 901 | // outDlg->show(); |
902 | // qApp->processEvents(); | 902 | // qApp->processEvents(); |
903 | 903 | ||
904 | // FILE *fp; | 904 | // FILE *fp; |
905 | // char line[130]; | 905 | // char line[130]; |
906 | // sleep(1); | 906 | // sleep(1); |
907 | // fp = popen( (const char *) command, "r"); | 907 | // fp = popen( (const char *) command, "r"); |
908 | // if ( !fp ) { | 908 | // if ( !fp ) { |
909 | // qDebug("Could not execute '" + command + "'! err=%d", fp); | 909 | // qDebug("Could not execute '" + command + "'! err=%d", fp); |
910 | // QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); | 910 | // QMessageBox::warning( this, "AdvancedFm", tr("command failed!"), tr("&OK") ); |
911 | // pclose(fp); | 911 | // pclose(fp); |
912 | // return; | 912 | // return; |
913 | // } else { | 913 | // } else { |
914 | // while ( fgets( line, sizeof line, fp)) { | 914 | // while ( fgets( line, sizeof line, fp)) { |
915 | // outDlg->OutputEdit->append(line); | 915 | // outDlg->OutputEdit->append(line); |
916 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 916 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
917 | 917 | ||
918 | // } | 918 | // } |
919 | 919 | ||
920 | // } | 920 | // } |
921 | // pclose(fp); | 921 | // pclose(fp); |
922 | } | 922 | } |
923 | 923 | ||
924 | 924 | ||
925 | void AdvancedFm::mkDir() { | 925 | void AdvancedFm::mkDir() { |
926 | if (TabWidget->getCurrentTab() == 0) | 926 | if (TabWidget->getCurrentTab() == 0) |
927 | localMakDir(); | 927 | localMakDir(); |
928 | else | 928 | else |
929 | remoteMakDir(); | 929 | remoteMakDir(); |
930 | 930 | ||
931 | } | 931 | } |
932 | 932 | ||
933 | void AdvancedFm::rn() { | 933 | void AdvancedFm::rn() { |
934 | if (TabWidget->getCurrentTab() == 0) | 934 | if (TabWidget->getCurrentTab() == 0) |
935 | localRename(); | 935 | localRename(); |
936 | else | 936 | else |
937 | remoteRename(); | 937 | remoteRename(); |
938 | 938 | ||
939 | } | 939 | } |
940 | 940 | ||
941 | void AdvancedFm::del() { | 941 | void AdvancedFm::del() { |
942 | if (TabWidget->getCurrentTab() == 0) | 942 | if (TabWidget->getCurrentTab() == 0) |
943 | localDelete(); | 943 | localDelete(); |
944 | else | 944 | else |
945 | remoteDelete(); | 945 | remoteDelete(); |
946 | } | 946 | } |
947 | 947 | ||
948 | void AdvancedFm::mkSym() { | 948 | void AdvancedFm::mkSym() { |
949 | QString cmd; | 949 | QString cmd; |
950 | QStringList curFileList = getPath(); | 950 | QStringList curFileList = getPath(); |
951 | if( curFileList.count() > 0) { | 951 | if( curFileList.count() > 0) { |
952 | 952 | ||