summaryrefslogtreecommitdiff
path: root/noncore/apps/advancedfm/advancedfmMenu.cpp
Unidiff
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp
index 9ad1146..9e740d0 100644
--- a/noncore/apps/advancedfm/advancedfmMenu.cpp
+++ b/noncore/apps/advancedfm/advancedfmMenu.cpp
@@ -588,218 +588,218 @@ void AdvancedFm::runCommand() {
588 QPEApplication::execDialog( outDlg ); 588 QPEApplication::execDialog( outDlg );
589 qApp->processEvents(); 589 qApp->processEvents();
590 590
591 } 591 }
592} 592}
593 593
594void AdvancedFm::runCommandStd() { 594void AdvancedFm::runCommandStd() {
595 if( !CurrentView()->currentItem()) return; 595 if( !CurrentView()->currentItem()) return;
596 QString curFile; 596 QString curFile;
597 QDir *thisDir = CurrentDir(); 597 QDir *thisDir = CurrentDir();
598 QListView *thisView = CurrentView(); 598 QListView *thisView = CurrentView();
599 if( thisView->currentItem()) 599 if( thisView->currentItem())
600 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); 600 curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0);
601 601
602 InputDialog *fileDlg; 602 InputDialog *fileDlg;
603 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); 603 fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0);
604 fileDlg->setInputText(curFile); 604 fileDlg->setInputText(curFile);
605 fileDlg->exec(); 605 fileDlg->exec();
606 606
607 if( fileDlg->result() == 1 ) { 607 if( fileDlg->result() == 1 ) {
608 qApp->processEvents(); 608 qApp->processEvents();
609 startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); 609 startProcess( (const QString)fileDlg->LineEdit1->text().latin1());
610 } 610 }
611} 611}
612 612
613void AdvancedFm::fileStatus() { 613void AdvancedFm::fileStatus() {
614 if( !CurrentView()->currentItem()) return; 614 if( !CurrentView()->currentItem()) return;
615 QString curFile; 615 QString curFile;
616 curFile = CurrentView()->currentItem()->text(0); 616 curFile = CurrentView()->currentItem()->text(0);
617 617
618 QStringList command; 618 QStringList command;
619 command << "/bin/sh"; 619 command << "/bin/sh";
620 command << "-c"; 620 command << "-c";
621 command << "stat -l "+ curFile; 621 command << "stat -l "+ curFile;
622 622
623 Output *outDlg; 623 Output *outDlg;
624 outDlg = new Output( command, this, tr("AdvancedFm Output"), true); 624 outDlg = new Output( command, this, tr("AdvancedFm Output"), true);
625 QPEApplication::execDialog( outDlg ); 625 QPEApplication::execDialog( outDlg );
626 qApp->processEvents(); 626 qApp->processEvents();
627} 627}
628 628
629 629
630void AdvancedFm::mkDir() { 630void AdvancedFm::mkDir() {
631 makeDir(); 631 makeDir();
632} 632}
633 633
634void AdvancedFm::rn() { 634void AdvancedFm::rn() {
635 renameIt(); 635 renameIt();
636} 636}
637 637
638void AdvancedFm::del() { 638void AdvancedFm::del() {
639 doDelete(); 639 doDelete();
640} 640}
641 641
642void AdvancedFm::mkSym() { 642void AdvancedFm::mkSym() {
643 QString cmd; 643 QString cmd;
644 QStringList curFileList = getPath(); 644 QStringList curFileList = getPath();
645 if( curFileList.count() > 0) { 645 if( curFileList.count() > 0) {
646 QDir *thisDir = CurrentDir(); 646 QDir *thisDir = CurrentDir();
647 QDir * thatDir = OtherDir(); 647 QDir * thatDir = OtherDir();
648 648
649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 649 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
650 650
651 QString destName = thatDir->canonicalPath()+"/"+(*it); 651 QString destName = thatDir->canonicalPath()+"/"+(*it);
652 if(destName.right(1) == "/") { 652 if(destName.right(1) == "/") {
653 destName = destName.left( destName.length() -1); 653 destName = destName.left( destName.length() -1);
654 } 654 }
655 655
656 QString curFile = thisDir->canonicalPath()+"/"+(*it); 656 QString curFile = thisDir->canonicalPath()+"/"+(*it);
657 657
658 if( curFile.right(1) == "/") { 658 if( curFile.right(1) == "/") {
659 curFile = curFile.left( curFile.length() -1); 659 curFile = curFile.left( curFile.length() -1);
660 } 660 }
661 661
662 cmd = "ln -s "+curFile+" "+destName; 662 cmd = "ln -s "+curFile+" "+destName;
663// qDebug(cmd); 663// qDebug(cmd);
664 startProcess( (const QString)cmd ); 664 startProcess( (const QString)cmd );
665 } 665 }
666 rePopulate(); 666 rePopulate();
667 setOtherTabCurrent(); 667 setOtherTabCurrent();
668 } 668 }
669} 669}
670 670
671void AdvancedFm::doBeam() { 671void AdvancedFm::doBeam() {
672 Ir ir; 672 Ir ir;
673 if(!ir.supported()) { 673 if(!ir.supported()) {
674 } else { 674 } else {
675 QStringList curFileList = getPath(); 675 QStringList curFileList = getPath();
676 if( curFileList.count() > 0) { 676 if( curFileList.count() > 0) {
677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 677 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
678 QString curFile = (*it); 678 QString curFile = (*it);
679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; 679 QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile;
680 if( curFilePath.right(1) == "/") { 680 if( curFilePath.right(1) == "/") {
681 curFilePath = curFilePath.left( curFilePath.length() -1); 681 curFilePath = curFilePath.left( curFilePath.length() -1);
682 } 682 }
683 Ir *file = new Ir(this, "IR"); 683 Ir *file = new Ir(this, "IR");
684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 684 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*)));
685 file->send( curFilePath, curFile ); 685 file->send( curFilePath, curFile );
686 } 686 }
687 } 687 }
688 } 688 }
689} 689}
690 690
691void AdvancedFm::fileBeamFinished( Ir *) { 691void AdvancedFm::fileBeamFinished( Ir *) {
692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); 692 QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") );
693} 693}
694 694
695void AdvancedFm::selectAll() { 695void AdvancedFm::selectAll() {
696 QListView *thisView = CurrentView(); 696 QListView *thisView = CurrentView();
697 thisView->selectAll(true); 697 thisView->selectAll(true);
698 thisView->setSelected( thisView->firstChild(),false); 698 thisView->setSelected( thisView->firstChild(),false);
699} 699}
700 700
701void AdvancedFm::startProcess(const QString & cmd) { 701void AdvancedFm::startProcess(const QString & cmd) {
702 QStringList command; 702 QStringList command;
703 OProcess *process; 703 OProcess *process;
704 process = new OProcess(); 704 process = new OProcess();
705 connect(process, SIGNAL(processExited(OProcess *)), 705 connect(process, SIGNAL(processExited(OProcess*)),
706 this, SLOT( processEnded(OProcess *))); 706 this, SLOT( processEnded(OProcess*)));
707 707
708 connect(process, SIGNAL( receivedStderr(OProcess *, char *, int)), 708 connect(process, SIGNAL( receivedStderr(OProcess*,char*,int)),
709 this, SLOT( oprocessStderr(OProcess *, char *, int))); 709 this, SLOT( oprocessStderr(OProcess*,char*,int)));
710 710
711 command << "/bin/sh"; 711 command << "/bin/sh";
712 command << "-c"; 712 command << "-c";
713 command << cmd.latin1(); 713 command << cmd.latin1();
714 *process << command; 714 *process << command;
715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) 715 if(!process->start(OProcess::NotifyOnExit, OProcess::All) )
716 qDebug("could not start process"); 716 qDebug("could not start process");
717} 717}
718 718
719void AdvancedFm::processEnded(OProcess *) { 719void AdvancedFm::processEnded(OProcess *) {
720 rePopulate(); 720 rePopulate();
721} 721}
722 722
723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 723void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) {
724// qWarning("received stderrt %d bytes", buflen); 724// qWarning("received stderrt %d bytes", buflen);
725 725
726 QString lineStr = buffer; 726 QString lineStr = buffer;
727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); 727 QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") );
728} 728}
729 729
730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 730bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) {
731 if ( o->inherits( "QLineEdit" ) ) { 731 if ( o->inherits( "QLineEdit" ) ) {
732 if ( e->type() == QEvent::KeyPress ) { 732 if ( e->type() == QEvent::KeyPress ) {
733 QKeyEvent *ke = (QKeyEvent*)e; 733 QKeyEvent *ke = (QKeyEvent*)e;
734 if ( ke->key() == Key_Return || 734 if ( ke->key() == Key_Return ||
735 ke->key() == Key_Enter ) { 735 ke->key() == Key_Enter ) {
736 okRename(); 736 okRename();
737 return true; 737 return true;
738 } 738 }
739 else if ( ke->key() == Key_Escape ) { 739 else if ( ke->key() == Key_Escape ) {
740 cancelRename(); 740 cancelRename();
741 return true; 741 return true;
742 } 742 }
743 } 743 }
744 else if ( e->type() == QEvent::FocusOut ) { 744 else if ( e->type() == QEvent::FocusOut ) {
745 cancelRename(); 745 cancelRename();
746 return true; 746 return true;
747 } 747 }
748 } 748 }
749 if ( o->inherits( "QListView" ) ) { 749 if ( o->inherits( "QListView" ) ) {
750 if ( e->type() == QEvent::FocusIn ) { 750 if ( e->type() == QEvent::FocusIn ) {
751 if( o == Local_View) { //keep track of which view 751 if( o == Local_View) { //keep track of which view
752 whichTab=1; 752 whichTab=1;
753 } 753 }
754 else { 754 else {
755 whichTab=2; 755 whichTab=2;
756 } 756 }
757 } 757 }
758 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection 758 OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection
759 } 759 }
760 760
761 return QWidget::eventFilter( o, e ); 761 return QWidget::eventFilter( o, e );
762} 762}
763 763
764 764
765void AdvancedFm::cancelRename() { 765void AdvancedFm::cancelRename() {
766// qDebug("cancel rename"); 766// qDebug("cancel rename");
767 QListView * view; 767 QListView * view;
768 view = CurrentView(); 768 view = CurrentView();
769 769
770 bool resetFocus = view->viewport()->focusProxy() == renameBox; 770 bool resetFocus = view->viewport()->focusProxy() == renameBox;
771 delete renameBox; 771 delete renameBox;
772 renameBox = 0; 772 renameBox = 0;
773 if ( resetFocus ) { 773 if ( resetFocus ) {
774 view->viewport()->setFocusProxy( view); 774 view->viewport()->setFocusProxy( view);
775 view->setFocus(); 775 view->setFocus();
776 } 776 }
777} 777}
778 778
779void AdvancedFm::doRename(QListView * view) { 779void AdvancedFm::doRename(QListView * view) {
780 if( !CurrentView()->currentItem()) return; 780 if( !CurrentView()->currentItem()) return;
781 781
782 QRect r = view->itemRect( view->currentItem( )); 782 QRect r = view->itemRect( view->currentItem( ));
783 r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); 783 r = QRect( view->viewportToContents( r.topLeft() ), r.size() );
784 r.setX( view->contentsX() ); 784 r.setX( view->contentsX() );
785 785
786 if ( r.width() > view->visibleWidth() ) 786 if ( r.width() > view->visibleWidth() )
787 r.setWidth( view->visibleWidth() ); 787 r.setWidth( view->visibleWidth() );
788 788
789 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); 789 renameBox = new QLineEdit( view->viewport(), "qt_renamebox" );
790 renameBox->setFrame(true); 790 renameBox->setFrame(true);
791 791
792 renameBox->setText( view->currentItem()->text(0) ); 792 renameBox->setText( view->currentItem()->text(0) );
793 793
794 renameBox->selectAll(); 794 renameBox->selectAll();
795 renameBox->installEventFilter( this ); 795 renameBox->installEventFilter( this );
796 796
797 view->addChild( renameBox, r.x(), r.y() ); 797 view->addChild( renameBox, r.x(), r.y() );
798 798
799 renameBox->resize( r.size() ); 799 renameBox->resize( r.size() );
800 800
801 view->viewport()->setFocusProxy( renameBox ); 801 view->viewport()->setFocusProxy( renameBox );
802 802
803 renameBox->setFocus(); 803 renameBox->setFocus();
804 renameBox->show(); 804 renameBox->show();
805} 805}