-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 d34f330..4628170 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -372,386 +372,386 @@ void AdvancedFm::copyAs() { | |||
372 | if( !copyFile( curFile, destFile) ) { | 372 | if( !copyFile( curFile, destFile) ) { |
373 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 373 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
374 | +curFile +tr("to\n")+destFile); | 374 | +curFile +tr("to\n")+destFile); |
375 | return; | 375 | return; |
376 | } | 376 | } |
377 | } | 377 | } |
378 | delete fileDlg; | 378 | delete fileDlg; |
379 | 379 | ||
380 | } | 380 | } |
381 | rePopulate(); | 381 | rePopulate(); |
382 | setOtherTabCurrent(); | 382 | setOtherTabCurrent(); |
383 | } | 383 | } |
384 | 384 | ||
385 | void AdvancedFm::copySameDir() { | 385 | void AdvancedFm::copySameDir() { |
386 | qApp->processEvents(); | 386 | qApp->processEvents(); |
387 | QStringList curFileList = getPath(); | 387 | QStringList curFileList = getPath(); |
388 | QString curFile, item, destFile; | 388 | QString curFile, item, destFile; |
389 | InputDialog *fileDlg; | 389 | InputDialog *fileDlg; |
390 | 390 | ||
391 | QDir *thisDir = CurrentDir(); | 391 | QDir *thisDir = CurrentDir(); |
392 | 392 | ||
393 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 393 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
394 | item=(*it); | 394 | item=(*it); |
395 | curFile = thisDir->canonicalPath()+"/"+ item; | 395 | curFile = thisDir->canonicalPath()+"/"+ item; |
396 | 396 | ||
397 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); | 397 | fileDlg = new InputDialog(this,tr("Copy ")+curFile+tr(" As"),TRUE, 0); |
398 | fileDlg->setInputText((const QString &) destFile ); | 398 | fileDlg->setInputText((const QString &) destFile ); |
399 | fileDlg->exec(); | 399 | fileDlg->exec(); |
400 | 400 | ||
401 | if( fileDlg->result() == 1 ) { | 401 | if( fileDlg->result() == 1 ) { |
402 | 402 | ||
403 | QString filename = fileDlg->LineEdit1->text(); | 403 | QString filename = fileDlg->LineEdit1->text(); |
404 | destFile = thisDir->canonicalPath()+"/"+filename; | 404 | destFile = thisDir->canonicalPath()+"/"+filename; |
405 | 405 | ||
406 | QFile f(destFile); | 406 | QFile f(destFile); |
407 | if( f.exists()) { | 407 | if( f.exists()) { |
408 | switch (QMessageBox::warning(this,tr("Delete"), | 408 | switch (QMessageBox::warning(this,tr("Delete"), |
409 | destFile+tr(" already exists.\nDo you really want to delete it?"), | 409 | destFile+tr(" already exists.\nDo you really want to delete it?"), |
410 | tr("Yes"),tr("No"),0,0,1) ) { | 410 | tr("Yes"),tr("No"),0,0,1) ) { |
411 | case 0: | 411 | case 0: |
412 | 412 | ||
413 | f.remove(); | 413 | f.remove(); |
414 | break; | 414 | break; |
415 | case 1: | 415 | case 1: |
416 | return; | 416 | return; |
417 | break; | 417 | break; |
418 | }; | 418 | }; |
419 | } | 419 | } |
420 | if(!copyFile( curFile,destFile) ) { | 420 | if(!copyFile( curFile,destFile) ) { |
421 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") | 421 | QMessageBox::message("AdvancedFm",tr("Could not copy\n") |
422 | +curFile +tr("to\n")+destFile); | 422 | +curFile +tr("to\n")+destFile); |
423 | return; | 423 | return; |
424 | } | 424 | } |
425 | 425 | ||
426 | // odebug << "copy "+curFile+" as "+destFile << oendl; | 426 | // odebug << "copy "+curFile+" as "+destFile << oendl; |
427 | } | 427 | } |
428 | delete fileDlg; | 428 | delete fileDlg; |
429 | } | 429 | } |
430 | rePopulate(); | 430 | rePopulate(); |
431 | } | 431 | } |
432 | 432 | ||
433 | void AdvancedFm::move() { | 433 | void AdvancedFm::move() { |
434 | qApp->processEvents(); | 434 | qApp->processEvents(); |
435 | 435 | ||
436 | QStringList curFileList = getPath(); | 436 | QStringList curFileList = getPath(); |
437 | if( curFileList.count() > 0) { | 437 | if( curFileList.count() > 0) { |
438 | QString curFile, destFile, item; | 438 | QString curFile, destFile, item; |
439 | 439 | ||
440 | QDir *thisDir = CurrentDir(); | 440 | QDir *thisDir = CurrentDir(); |
441 | QDir *thatDir = OtherDir(); | 441 | QDir *thatDir = OtherDir(); |
442 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 442 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
443 | item=(*it); | 443 | item=(*it); |
444 | QString destFile = thatDir->canonicalPath(); | 444 | QString destFile = thatDir->canonicalPath(); |
445 | 445 | ||
446 | if(destFile.right(1).find("/",0,TRUE) == -1) | 446 | if(destFile.right(1).find("/",0,TRUE) == -1) |
447 | destFile+="/"; | 447 | destFile+="/"; |
448 | destFile += item; | 448 | destFile += item; |
449 | // odebug << "Destination file is "+destFile << oendl; | 449 | // odebug << "Destination file is "+destFile << oendl; |
450 | 450 | ||
451 | curFile = thisDir->canonicalPath(); | 451 | curFile = thisDir->canonicalPath(); |
452 | if(curFile.right(1).find("/",0,TRUE) == -1) | 452 | if(curFile.right(1).find("/",0,TRUE) == -1) |
453 | curFile +="/"; | 453 | curFile +="/"; |
454 | curFile+= item; | 454 | curFile+= item; |
455 | // odebug << "CurrentFile file is " + curFile << oendl; | 455 | // odebug << "CurrentFile file is " + curFile << oendl; |
456 | 456 | ||
457 | if(QFileInfo(curFile).isDir()) { | 457 | if(QFileInfo(curFile).isDir()) { |
458 | moveDirectory( curFile, destFile ); | 458 | moveDirectory( curFile, destFile ); |
459 | rePopulate(); | 459 | rePopulate(); |
460 | return; | 460 | return; |
461 | } | 461 | } |
462 | 462 | ||
463 | QFile f( curFile); | 463 | QFile f( curFile); |
464 | if( f.exists()) { | 464 | if( f.exists()) { |
465 | if( !copyFile( curFile, destFile) ) { | 465 | if( !copyFile( curFile, destFile) ) { |
466 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); | 466 | QMessageBox::message(tr("Note"),tr("Could not move\n")+curFile); |
467 | return; | 467 | return; |
468 | } else | 468 | } else |
469 | QFile::remove(curFile); | 469 | QFile::remove(curFile); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | } | 473 | } |
474 | rePopulate(); | 474 | rePopulate(); |
475 | setOtherTabCurrent(); | 475 | setOtherTabCurrent(); |
476 | } | 476 | } |
477 | 477 | ||
478 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { | 478 | bool AdvancedFm::moveDirectory( const QString & src, const QString & dest ) { |
479 | int err = 0; | 479 | int err = 0; |
480 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; | 480 | if( copyDirectory( src, dest ) ) { QString cmd = "rm -rf " + src; |
481 | err = system((const char*)cmd); | 481 | err = system((const char*)cmd); |
482 | } else | 482 | } else |
483 | err = -1; | 483 | err = -1; |
484 | 484 | ||
485 | if(err!=0) { | 485 | if(err!=0) { |
486 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); | 486 | QMessageBox::message(tr("Note"),tr("Could not move\n") + src); |
487 | return false; | 487 | return false; |
488 | } | 488 | } |
489 | return true; | 489 | return true; |
490 | } | 490 | } |
491 | 491 | ||
492 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { | 492 | bool AdvancedFm::copyDirectory( const QString & src, const QString & dest ) { |
493 | 493 | ||
494 | QString cmd = "/bin/cp -fpR " + src + " " + dest; | 494 | QString cmd = "/bin/cp -fpR " + src + " " + dest; |
495 | owarn << cmd << oendl; | 495 | owarn << cmd << oendl; |
496 | int err = system( (const char *) cmd ); | 496 | int err = system( (const char *) cmd ); |
497 | if ( err != 0 ) { | 497 | if ( err != 0 ) { |
498 | QMessageBox::message("AdvancedFm", | 498 | QMessageBox::message("AdvancedFm", |
499 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); | 499 | tr( "Could not copy \n%1 \nto \n%2").arg( src ).arg( dest ) ); |
500 | return false; | 500 | return false; |
501 | } | 501 | } |
502 | 502 | ||
503 | return true; | 503 | return true; |
504 | } | 504 | } |
505 | 505 | ||
506 | 506 | ||
507 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { | 507 | bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { |
508 | 508 | ||
509 | 509 | ||
510 | if(QFileInfo(src).isDir()) { | 510 | if(QFileInfo(src).isDir()) { |
511 | if( copyDirectory( src, dest )) { | 511 | if( copyDirectory( src, dest )) { |
512 | setOtherTabCurrent(); | 512 | setOtherTabCurrent(); |
513 | populateView(); | 513 | populateView(); |
514 | return true; | 514 | return true; |
515 | } | 515 | } |
516 | else | 516 | else |
517 | return false; | 517 | return false; |
518 | } | 518 | } |
519 | 519 | ||
520 | 520 | ||
521 | bool success = true; | 521 | bool success = true; |
522 | struct stat status; | 522 | struct stat status; |
523 | QFile srcFile(src); | 523 | QFile srcFile(src); |
524 | QFile destFile(dest); | 524 | QFile destFile(dest); |
525 | int err=0; | 525 | int err=0; |
526 | int read_fd=0; | 526 | int read_fd=0; |
527 | int write_fd=0; | 527 | int write_fd=0; |
528 | struct stat stat_buf; | 528 | struct stat stat_buf; |
529 | off_t offset = 0; | 529 | off_t offset = 0; |
530 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { | 530 | if(!srcFile.open( IO_ReadOnly|IO_Raw)) { |
531 | // owarn << "open failed" << oendl; | 531 | // owarn << "open failed" << oendl; |
532 | return success = false; | 532 | return success = false; |
533 | } | 533 | } |
534 | read_fd = srcFile.handle(); | 534 | read_fd = srcFile.handle(); |
535 | if(read_fd != -1) { | 535 | if(read_fd != -1) { |
536 | fstat (read_fd, &stat_buf); | 536 | fstat (read_fd, &stat_buf); |
537 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { | 537 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) { |
538 | // owarn << "destfile open failed" << oendl; | 538 | // owarn << "destfile open failed" << oendl; |
539 | return success = false; | 539 | return success = false; |
540 | } | 540 | } |
541 | write_fd = destFile.handle(); | 541 | write_fd = destFile.handle(); |
542 | if(write_fd != -1) { | 542 | if(write_fd != -1) { |
543 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 543 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); |
544 | if( err == -1) { | 544 | if( err == -1) { |
545 | QString msg; | 545 | QString msg; |
546 | switch(err) { | 546 | switch(err) { |
547 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 547 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; |
548 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 548 | case EINVAL: msg = "Descriptor is not valid or locked. "; |
549 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 549 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; |
550 | case EIO: msg = "Unspecified error while reading from in_fd."; | 550 | case EIO: msg = "Unspecified error while reading from in_fd."; |
551 | }; | 551 | }; |
552 | success = false; | 552 | success = false; |
553 | // owarn << msg << oendl; | 553 | // owarn << msg << oendl; |
554 | } | 554 | } |
555 | } else { | 555 | } else { |
556 | success = false; | 556 | success = false; |
557 | } | 557 | } |
558 | } else { | 558 | } else { |
559 | success = false; | 559 | success = false; |
560 | } | 560 | } |
561 | srcFile.close(); | 561 | srcFile.close(); |
562 | destFile.close(); | 562 | destFile.close(); |
563 | // Set file permissions | 563 | // Set file permissions |
564 | if( stat( (const char *) src, &status ) == 0 ) { | 564 | if( stat( QFile::encodeName(src), &status ) == 0 ) { |
565 | chmod( (const char *) dest, status.st_mode ); | 565 | chmod( QFile::encodeName(dest), status.st_mode ); |
566 | } | 566 | } |
567 | 567 | ||
568 | return success; | 568 | return success; |
569 | } | 569 | } |
570 | 570 | ||
571 | void AdvancedFm::runCommand() { | 571 | void AdvancedFm::runCommand() { |
572 | if( !CurrentView()->currentItem()) return; | 572 | if( !CurrentView()->currentItem()) return; |
573 | QDir *thisDir = CurrentDir(); | 573 | QDir *thisDir = CurrentDir(); |
574 | 574 | ||
575 | QString curFile; | 575 | QString curFile; |
576 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); | 576 | curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); |
577 | 577 | ||
578 | InputDialog *fileDlg; | 578 | InputDialog *fileDlg; |
579 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 579 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
580 | fileDlg->setInputText(curFile); | 580 | fileDlg->setInputText(curFile); |
581 | fileDlg->exec(); | 581 | fileDlg->exec(); |
582 | //QString command; | 582 | //QString command; |
583 | 583 | ||
584 | if( fileDlg->result() == 1 ) { | 584 | if( fileDlg->result() == 1 ) { |
585 | // odebug << fileDlg->LineEdit1->text() << oendl; | 585 | // odebug << fileDlg->LineEdit1->text() << oendl; |
586 | QStringList command; | 586 | QStringList command; |
587 | 587 | ||
588 | command << "/bin/sh"; | 588 | command << "/bin/sh"; |
589 | command << "-c"; | 589 | command << "-c"; |
590 | command << fileDlg->LineEdit1->text(); | 590 | command << fileDlg->LineEdit1->text(); |
591 | Output *outDlg; | 591 | Output *outDlg; |
592 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 592 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
593 | QPEApplication::execDialog( outDlg ); | 593 | QPEApplication::execDialog( outDlg ); |
594 | qApp->processEvents(); | 594 | qApp->processEvents(); |
595 | 595 | ||
596 | } | 596 | } |
597 | } | 597 | } |
598 | 598 | ||
599 | void AdvancedFm::runCommandStd() { | 599 | void AdvancedFm::runCommandStd() { |
600 | if( !CurrentView()->currentItem()) return; | 600 | if( !CurrentView()->currentItem()) return; |
601 | QString curFile; | 601 | QString curFile; |
602 | QDir *thisDir = CurrentDir(); | 602 | QDir *thisDir = CurrentDir(); |
603 | QListView *thisView = CurrentView(); | 603 | QListView *thisView = CurrentView(); |
604 | if( thisView->currentItem()) | 604 | if( thisView->currentItem()) |
605 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); | 605 | curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); |
606 | 606 | ||
607 | InputDialog *fileDlg; | 607 | InputDialog *fileDlg; |
608 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); | 608 | fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); |
609 | fileDlg->setInputText(curFile); | 609 | fileDlg->setInputText(curFile); |
610 | fileDlg->exec(); | 610 | fileDlg->exec(); |
611 | 611 | ||
612 | if( fileDlg->result() == 1 ) { | 612 | if( fileDlg->result() == 1 ) { |
613 | qApp->processEvents(); | 613 | qApp->processEvents(); |
614 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); | 614 | startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); |
615 | } | 615 | } |
616 | } | 616 | } |
617 | 617 | ||
618 | void AdvancedFm::fileStatus() { | 618 | void AdvancedFm::fileStatus() { |
619 | if( !CurrentView()->currentItem()) return; | 619 | if( !CurrentView()->currentItem()) return; |
620 | QString curFile; | 620 | QString curFile; |
621 | curFile = CurrentView()->currentItem()->text(0); | 621 | curFile = CurrentView()->currentItem()->text(0); |
622 | 622 | ||
623 | QStringList command; | 623 | QStringList command; |
624 | command << "/bin/sh"; | 624 | command << "/bin/sh"; |
625 | command << "-c"; | 625 | command << "-c"; |
626 | command << "stat -l "+ curFile; | 626 | command << "stat -l "+ curFile; |
627 | 627 | ||
628 | Output *outDlg; | 628 | Output *outDlg; |
629 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); | 629 | outDlg = new Output( command, this, tr("AdvancedFm Output"), true); |
630 | QPEApplication::execDialog( outDlg ); | 630 | QPEApplication::execDialog( outDlg ); |
631 | qApp->processEvents(); | 631 | qApp->processEvents(); |
632 | } | 632 | } |
633 | 633 | ||
634 | 634 | ||
635 | void AdvancedFm::mkDir() { | 635 | void AdvancedFm::mkDir() { |
636 | makeDir(); | 636 | makeDir(); |
637 | } | 637 | } |
638 | 638 | ||
639 | void AdvancedFm::rn() { | 639 | void AdvancedFm::rn() { |
640 | renameIt(); | 640 | renameIt(); |
641 | } | 641 | } |
642 | 642 | ||
643 | void AdvancedFm::del() { | 643 | void AdvancedFm::del() { |
644 | doDelete(); | 644 | doDelete(); |
645 | } | 645 | } |
646 | 646 | ||
647 | void AdvancedFm::mkSym() { | 647 | void AdvancedFm::mkSym() { |
648 | QString cmd; | 648 | QString cmd; |
649 | QStringList curFileList = getPath(); | 649 | QStringList curFileList = getPath(); |
650 | if( curFileList.count() > 0) { | 650 | if( curFileList.count() > 0) { |
651 | QDir *thisDir = CurrentDir(); | 651 | QDir *thisDir = CurrentDir(); |
652 | QDir * thatDir = OtherDir(); | 652 | QDir * thatDir = OtherDir(); |
653 | 653 | ||
654 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 654 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
655 | 655 | ||
656 | QString destName = thatDir->canonicalPath()+"/"+(*it); | 656 | QString destName = thatDir->canonicalPath()+"/"+(*it); |
657 | if(destName.right(1) == "/") { | 657 | if(destName.right(1) == "/") { |
658 | destName = destName.left( destName.length() -1); | 658 | destName = destName.left( destName.length() -1); |
659 | } | 659 | } |
660 | 660 | ||
661 | QString curFile = thisDir->canonicalPath()+"/"+(*it); | 661 | QString curFile = thisDir->canonicalPath()+"/"+(*it); |
662 | 662 | ||
663 | if( curFile.right(1) == "/") { | 663 | if( curFile.right(1) == "/") { |
664 | curFile = curFile.left( curFile.length() -1); | 664 | curFile = curFile.left( curFile.length() -1); |
665 | } | 665 | } |
666 | 666 | ||
667 | cmd = "ln -s "+curFile+" "+destName; | 667 | cmd = "ln -s "+curFile+" "+destName; |
668 | // odebug << cmd << oendl; | 668 | // odebug << cmd << oendl; |
669 | startProcess( (const QString)cmd ); | 669 | startProcess( (const QString)cmd ); |
670 | } | 670 | } |
671 | rePopulate(); | 671 | rePopulate(); |
672 | setOtherTabCurrent(); | 672 | setOtherTabCurrent(); |
673 | } | 673 | } |
674 | } | 674 | } |
675 | 675 | ||
676 | void AdvancedFm::doBeam() { | 676 | void AdvancedFm::doBeam() { |
677 | Ir ir; | 677 | Ir ir; |
678 | if(!ir.supported()) { | 678 | if(!ir.supported()) { |
679 | } else { | 679 | } else { |
680 | QStringList curFileList = getPath(); | 680 | QStringList curFileList = getPath(); |
681 | if( curFileList.count() > 0) { | 681 | if( curFileList.count() > 0) { |
682 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 682 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
683 | QString curFile = (*it); | 683 | QString curFile = (*it); |
684 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 684 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
685 | if( curFilePath.right(1) == "/") { | 685 | if( curFilePath.right(1) == "/") { |
686 | curFilePath = curFilePath.left( curFilePath.length() -1); | 686 | curFilePath = curFilePath.left( curFilePath.length() -1); |
687 | } | 687 | } |
688 | Ir *file = new Ir(this, "IR"); | 688 | Ir *file = new Ir(this, "IR"); |
689 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); | 689 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
690 | file->send( curFilePath, curFile ); | 690 | file->send( curFilePath, curFile ); |
691 | } | 691 | } |
692 | } | 692 | } |
693 | } | 693 | } |
694 | } | 694 | } |
695 | 695 | ||
696 | void AdvancedFm::fileBeamFinished( Ir *) { | 696 | void AdvancedFm::fileBeamFinished( Ir *) { |
697 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 697 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
698 | } | 698 | } |
699 | 699 | ||
700 | void AdvancedFm::selectAll() { | 700 | void AdvancedFm::selectAll() { |
701 | QListView *thisView = CurrentView(); | 701 | QListView *thisView = CurrentView(); |
702 | thisView->selectAll(true); | 702 | thisView->selectAll(true); |
703 | thisView->setSelected( thisView->firstChild(),false); | 703 | thisView->setSelected( thisView->firstChild(),false); |
704 | } | 704 | } |
705 | 705 | ||
706 | void AdvancedFm::startProcess(const QString & cmd) { | 706 | void AdvancedFm::startProcess(const QString & cmd) { |
707 | QStringList command; | 707 | QStringList command; |
708 | OProcess *process; | 708 | OProcess *process; |
709 | process = new OProcess(); | 709 | process = new OProcess(); |
710 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), | 710 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), |
711 | this, SLOT( processEnded(Opie::Core::OProcess*))); | 711 | this, SLOT( processEnded(Opie::Core::OProcess*))); |
712 | 712 | ||
713 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), | 713 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), |
714 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | 714 | this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
715 | 715 | ||
716 | command << "/bin/sh"; | 716 | command << "/bin/sh"; |
717 | command << "-c"; | 717 | command << "-c"; |
718 | command << cmd.latin1(); | 718 | command << cmd.latin1(); |
719 | *process << command; | 719 | *process << command; |
720 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 720 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
721 | odebug << "could not start process" << oendl; | 721 | odebug << "could not start process" << oendl; |
722 | } | 722 | } |
723 | 723 | ||
724 | void AdvancedFm::processEnded(OProcess *) { | 724 | void AdvancedFm::processEnded(OProcess *) { |
725 | rePopulate(); | 725 | rePopulate(); |
726 | } | 726 | } |
727 | 727 | ||
728 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 728 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
729 | // owarn << "received stderrt " << buflen << " bytes" << oendl; | 729 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |
730 | 730 | ||
731 | QString lineStr = buffer; | 731 | QString lineStr = buffer; |
732 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 732 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
733 | } | 733 | } |
734 | 734 | ||
735 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 735 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
736 | if ( o->inherits( "QLineEdit" ) ) { | 736 | if ( o->inherits( "QLineEdit" ) ) { |
737 | if ( e->type() == QEvent::KeyPress ) { | 737 | if ( e->type() == QEvent::KeyPress ) { |
738 | QKeyEvent *ke = (QKeyEvent*)e; | 738 | QKeyEvent *ke = (QKeyEvent*)e; |
739 | if ( ke->key() == Key_Return || | 739 | if ( ke->key() == Key_Return || |
740 | ke->key() == Key_Enter ) { | 740 | ke->key() == Key_Enter ) { |
741 | okRename(); | 741 | okRename(); |
742 | return true; | 742 | return true; |
743 | } | 743 | } |
744 | else if ( ke->key() == Key_Escape ) { | 744 | else if ( ke->key() == Key_Escape ) { |
745 | cancelRename(); | 745 | cancelRename(); |
746 | return true; | 746 | return true; |
747 | } | 747 | } |
748 | } | 748 | } |
749 | else if ( e->type() == QEvent::FocusOut ) { | 749 | else if ( e->type() == QEvent::FocusOut ) { |
750 | cancelRename(); | 750 | cancelRename(); |
751 | return true; | 751 | return true; |
752 | } | 752 | } |
753 | } | 753 | } |
754 | if ( o->inherits( "QListView" ) ) { | 754 | if ( o->inherits( "QListView" ) ) { |
755 | if ( e->type() == QEvent::FocusIn ) { | 755 | if ( e->type() == QEvent::FocusIn ) { |
756 | if( o == Local_View) { //keep track of which view | 756 | if( o == Local_View) { //keep track of which view |
757 | whichTab=1; | 757 | whichTab=1; |