summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 05:38:23 (UTC)
committer llornkcor <llornkcor>2004-09-25 05:38:23 (UTC)
commit244945237bc55945ba41f86d5f175204e00592ea (patch) (unidiff)
tree2acd2b87562e887d555913e80a04074092a2215e
parent43ade399621278b78d658f660bde7f0e39457f53 (diff)
downloadopie-244945237bc55945ba41f86d5f175204e00592ea.zip
opie-244945237bc55945ba41f86d5f175204e00592ea.tar.gz
opie-244945237bc55945ba41f86d5f175204e00592ea.tar.bz2
uptodate
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfmMenu.cpp1
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
@@ -648,193 +648,192 @@ void AdvancedFm::mkDir() {
648void AdvancedFm::rn() { 648void AdvancedFm::rn() {
649 renameIt(); 649 renameIt();
650} 650}
651 651
652void AdvancedFm::del() { 652void AdvancedFm::del() {
653 doDelete(); 653 doDelete();
654} 654}
655 655
656void AdvancedFm::mkSym() { 656void AdvancedFm::mkSym() {
657 QString cmd; 657 QString cmd;
658 QStringList curFileList = getPath(); 658 QStringList curFileList = getPath();
659 if( curFileList.count() > 0) { 659 if( curFileList.count() > 0) {
660 QDir *thisDir = CurrentDir(); 660 QDir *thisDir = CurrentDir();
661 QDir * thatDir = OtherDir(); 661 QDir * thatDir = OtherDir();
662 662
663 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { 663 for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) {
664 664
665 QString destName = thatDir->canonicalPath()+"/"+(*it); 665 QString destName = thatDir->canonicalPath()+"/"+(*it);
666 if(destName.right(1) == "/") { 666 if(destName.right(1) == "/") {
667 destName = destName.left( destName.length() -1); 667 destName = destName.left( destName.length() -1);
668 } 668 }
669 669
670 QString curFile = thisDir->canonicalPath()+"/"+(*it); 670 QString curFile = thisDir->canonicalPath()+"/"+(*it);
671 671
672 if( curFile.right(1) == "/") { 672 if( curFile.right(1) == "/") {
673 curFile = curFile.left( curFile.length() -1); 673 curFile = curFile.left( curFile.length() -1);
674 } 674 }
675 675
676 cmd = "ln -s "+curFile+" "+destName; 676 cmd = "ln -s "+curFile+" "+destName;
677// odebug << cmd << oendl; 677// odebug << cmd << oendl;
678 startProcess( (const QString)cmd ); 678 startProcess( (const QString)cmd );
679 } 679 }
680 rePopulate(); 680 rePopulate();
681 setOtherTabCurrent(); 681 setOtherTabCurrent();
682 } 682 }
683} 683}
684 684
685void AdvancedFm::doBeam() { 685void 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
705void AdvancedFm::fileBeamFinished( Ir *) { 705void 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
709void AdvancedFm::selectAll() { 709void 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
715void AdvancedFm::startProcess(const QString & cmd) { 715void 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
731void AdvancedFm::processEnded(OProcess *) { 731void AdvancedFm::processEnded(OProcess *) {
732 rePopulate(); 732 rePopulate();
733} 733}
734 734
735void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { 735void 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
742bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { 742bool 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
779void AdvancedFm::cancelRename() { 778void 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
793void AdvancedFm::doRename(QListView * view) { 792void 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() );
809 view->viewport()->setFocusProxy( renameBox ); 808 view->viewport()->setFocusProxy( renameBox );
810 renameBox->setFocus(); 809 renameBox->setFocus();
811 renameBox->show(); 810 renameBox->show();
812} 811}
813 812
814 813
815void AdvancedFm::renameIt() { 814void AdvancedFm::renameIt() {
816 if( !CurrentView()->currentItem()) return; 815 if( !CurrentView()->currentItem()) return;
817 816
818 QListView *thisView = CurrentView(); 817 QListView *thisView = CurrentView();
819 oldName = thisView->currentItem()->text(0); 818 oldName = thisView->currentItem()->text(0);
820 doRename( thisView ); 819 doRename( thisView );
821} 820}
822 821
823void AdvancedFm::okRename() { 822void AdvancedFm::okRename() {
824 qDebug("okrename"); 823 qDebug("okrename");
825 if( !renameBox) return; 824 if( !renameBox) return;
826 825
827 QString newName = renameBox->text(); 826 QString newName = renameBox->text();
828 cancelRename(); 827 cancelRename();
829 QListView * view = CurrentView(); 828 QListView * view = CurrentView();
830 QString path = CurrentDir()->canonicalPath() + "/"; 829 QString path = CurrentDir()->canonicalPath() + "/";
831 oldName = path + oldName; 830 oldName = path + oldName;
832 newName = path + newName; 831 newName = path + newName;
833 if( rename( oldName.latin1(), newName.latin1())== -1) 832 if( rename( oldName.latin1(), newName.latin1())== -1)
834 QMessageBox::message(tr("Note"),tr("Could not rename")); 833 QMessageBox::message(tr("Note"),tr("Could not rename"));
835 else 834 else
836 oldName = ""; 835 oldName = "";
837 QListViewItem *item = view->currentItem(); 836 QListViewItem *item = view->currentItem();
838 view->takeItem( item ); 837 view->takeItem( item );
839 delete item; 838 delete item;
840 rePopulate(); 839 rePopulate();