author | llornkcor <llornkcor> | 2004-09-25 05:38:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 05:38:23 (UTC) |
commit | 244945237bc55945ba41f86d5f175204e00592ea (patch) (unidiff) | |
tree | 2acd2b87562e887d555913e80a04074092a2215e | |
parent | 43ade399621278b78d658f660bde7f0e39457f53 (diff) | |
download | opie-244945237bc55945ba41f86d5f175204e00592ea.zip opie-244945237bc55945ba41f86d5f175204e00592ea.tar.gz opie-244945237bc55945ba41f86d5f175204e00592ea.tar.bz2 |
uptodate
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 2e6b0da..b5a05d3 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -680,129 +680,128 @@ void AdvancedFm::mkSym() { | |||
680 | rePopulate(); | 680 | rePopulate(); |
681 | setOtherTabCurrent(); | 681 | setOtherTabCurrent(); |
682 | } | 682 | } |
683 | } | 683 | } |
684 | 684 | ||
685 | void AdvancedFm::doBeam() { | 685 | void AdvancedFm::doBeam() { |
686 | Ir ir; | 686 | Ir ir; |
687 | if(!ir.supported()) { | 687 | if(!ir.supported()) { |
688 | } else { | 688 | } else { |
689 | QStringList curFileList = getPath(); | 689 | QStringList curFileList = getPath(); |
690 | if( curFileList.count() > 0) { | 690 | if( curFileList.count() > 0) { |
691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { | 691 | for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { |
692 | QString curFile = (*it); | 692 | QString curFile = (*it); |
693 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; | 693 | QString curFilePath = CurrentDir()->canonicalPath()+"/"+curFile; |
694 | if( curFilePath.right(1) == "/") { | 694 | if( curFilePath.right(1) == "/") { |
695 | curFilePath = curFilePath.left( curFilePath.length() -1); | 695 | curFilePath = curFilePath.left( curFilePath.length() -1); |
696 | } | 696 | } |
697 | Ir *file = new Ir(this, "IR"); | 697 | Ir *file = new Ir(this, "IR"); |
698 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); | 698 | connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished(Ir*))); |
699 | file->send( curFilePath, curFile ); | 699 | file->send( curFilePath, curFile ); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } | 702 | } |
703 | } | 703 | } |
704 | 704 | ||
705 | void AdvancedFm::fileBeamFinished( Ir *) { | 705 | void AdvancedFm::fileBeamFinished( Ir *) { |
706 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); | 706 | QMessageBox::message( tr("Advancedfm Beam out"), tr("Ir sent.") ,tr("Ok") ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void AdvancedFm::selectAll() { | 709 | void AdvancedFm::selectAll() { |
710 | QListView *thisView = CurrentView(); | 710 | QListView *thisView = CurrentView(); |
711 | thisView->selectAll(true); | 711 | thisView->selectAll(true); |
712 | thisView->setSelected( thisView->firstChild(),false); | 712 | thisView->setSelected( thisView->firstChild(),false); |
713 | } | 713 | } |
714 | 714 | ||
715 | void AdvancedFm::startProcess(const QString & cmd) { | 715 | void AdvancedFm::startProcess(const QString & cmd) { |
716 | QStringList command; | 716 | QStringList command; |
717 | OProcess *process; | 717 | OProcess *process; |
718 | process = new OProcess(); | 718 | process = new OProcess(); |
719 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); | 719 | connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); |
720 | 720 | ||
721 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); | 721 | connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); |
722 | 722 | ||
723 | command << "/bin/sh"; | 723 | command << "/bin/sh"; |
724 | command << "-c"; | 724 | command << "-c"; |
725 | command << cmd.latin1(); | 725 | command << cmd.latin1(); |
726 | *process << command; | 726 | *process << command; |
727 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) | 727 | if(!process->start(OProcess::NotifyOnExit, OProcess::All) ) |
728 | odebug << "could not start process" << oendl; | 728 | odebug << "could not start process" << oendl; |
729 | } | 729 | } |
730 | 730 | ||
731 | void AdvancedFm::processEnded(OProcess *) { | 731 | void AdvancedFm::processEnded(OProcess *) { |
732 | rePopulate(); | 732 | rePopulate(); |
733 | } | 733 | } |
734 | 734 | ||
735 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | 735 | void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { |
736 | // owarn << "received stderrt " << buflen << " bytes" << oendl; | 736 | // owarn << "received stderrt " << buflen << " bytes" << oendl; |
737 | 737 | ||
738 | QString lineStr = buffer; | 738 | QString lineStr = buffer; |
739 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); | 739 | QMessageBox::warning( this, tr("Error"), lineStr ,tr("Ok") ); |
740 | } | 740 | } |
741 | 741 | ||
742 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | 742 | bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { |
743 | if ( o->inherits( "QLineEdit" ) ) { | 743 | if ( o->inherits( "QLineEdit" ) ) { |
744 | qDebug("QLineEdit event"); | ||
745 | if ( e->type() == QEvent::KeyPress ) { | 744 | if ( e->type() == QEvent::KeyPress ) { |
746 | QKeyEvent *ke = (QKeyEvent*)e; | 745 | QKeyEvent *ke = (QKeyEvent*)e; |
747 | if ( ke->key() == Key_Return || | 746 | if ( ke->key() == Key_Return || |
748 | ke->key() == Key_Enter ) { | 747 | ke->key() == Key_Enter ) { |
749 | okRename(); | 748 | okRename(); |
750 | return true; | 749 | return true; |
751 | } | 750 | } |
752 | else if ( ke->key() == Key_Escape ) { | 751 | else if ( ke->key() == Key_Escape ) { |
753 | cancelRename(); | 752 | cancelRename(); |
754 | return true; | 753 | return true; |
755 | } | 754 | } |
756 | } | 755 | } |
757 | else if ( e->type() == QEvent::FocusOut ) { | 756 | else if ( e->type() == QEvent::FocusOut ) { |
758 | cancelRename(); | 757 | cancelRename(); |
759 | return true; | 758 | return true; |
760 | } | 759 | } |
761 | } | 760 | } |
762 | /* if ( o->inherits( "QListView" ) ) { | 761 | /* if ( o->inherits( "QListView" ) ) { |
763 | if ( e->type() == QEvent::FocusIn ) { | 762 | if ( e->type() == QEvent::FocusIn ) { |
764 | // if( o == Local_View) { //keep track of which view | 763 | // if( o == Local_View) { //keep track of which view |
765 | // qDebug("local view"); | 764 | // qDebug("local view"); |
766 | // whichTab = 1; | 765 | // whichTab = 1; |
767 | // } else { | 766 | // } else { |
768 | // whichTab = 2; | 767 | // whichTab = 2; |
769 | // qDebug("remote view"); | 768 | // qDebug("remote view"); |
770 | // } | 769 | // } |
771 | } | 770 | } |
772 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 771 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
773 | } | 772 | } |
774 | */ | 773 | */ |
775 | return QWidget::eventFilter( o, e ); | 774 | return QWidget::eventFilter( o, e ); |
776 | } | 775 | } |
777 | 776 | ||
778 | 777 | ||
779 | void AdvancedFm::cancelRename() { | 778 | void AdvancedFm::cancelRename() { |
780 | // odebug << "cancel rename" << oendl; | 779 | // odebug << "cancel rename" << oendl; |
781 | QListView * view; | 780 | QListView * view; |
782 | view = CurrentView(); | 781 | view = CurrentView(); |
783 | 782 | ||
784 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 783 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
785 | delete renameBox; | 784 | delete renameBox; |
786 | renameBox = 0; | 785 | renameBox = 0; |
787 | if ( resetFocus ) { | 786 | if ( resetFocus ) { |
788 | view->viewport()->setFocusProxy( view); | 787 | view->viewport()->setFocusProxy( view); |
789 | view->setFocus(); | 788 | view->setFocus(); |
790 | } | 789 | } |
791 | } | 790 | } |
792 | 791 | ||
793 | void AdvancedFm::doRename(QListView * view) { | 792 | void AdvancedFm::doRename(QListView * view) { |
794 | if( !CurrentView()->currentItem()) return; | 793 | if( !CurrentView()->currentItem()) return; |
795 | 794 | ||
796 | QRect r = view->itemRect( view->currentItem( )); | 795 | QRect r = view->itemRect( view->currentItem( )); |
797 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); | 796 | r = QRect( view->viewportToContents( r.topLeft() ), r.size() ); |
798 | r.setX( view->contentsX() ); | 797 | r.setX( view->contentsX() ); |
799 | if ( r.width() > view->visibleWidth() ) | 798 | if ( r.width() > view->visibleWidth() ) |
800 | r.setWidth( view->visibleWidth() ); | 799 | r.setWidth( view->visibleWidth() ); |
801 | 800 | ||
802 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); | 801 | renameBox = new QLineEdit( view->viewport(), "qt_renamebox" ); |
803 | renameBox->setFrame(true); | 802 | renameBox->setFrame(true); |
804 | renameBox->setText( view->currentItem()->text(0) ); | 803 | renameBox->setText( view->currentItem()->text(0) ); |
805 | renameBox->selectAll(); | 804 | renameBox->selectAll(); |
806 | renameBox->installEventFilter( this ); | 805 | renameBox->installEventFilter( this ); |
807 | view->addChild( renameBox, r.x(), r.y() ); | 806 | view->addChild( renameBox, r.x(), r.y() ); |
808 | renameBox->resize( r.size() ); | 807 | renameBox->resize( r.size() ); |