author | llornkcor <llornkcor> | 2004-09-25 05:26:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 05:26:52 (UTC) |
commit | 43ade399621278b78d658f660bde7f0e39457f53 (patch) (unidiff) | |
tree | 271268029e4a128c93adaae54bfd47084881e90f /noncore/apps/advancedfm/advancedfmMenu.cpp | |
parent | 45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52 (diff) | |
download | opie-43ade399621278b78d658f660bde7f0e39457f53.zip opie-43ade399621278b78d658f660bde7f0e39457f53.tar.gz opie-43ade399621278b78d658f660bde7f0e39457f53.tar.bz2 |
change focus for edit
Diffstat (limited to 'noncore/apps/advancedfm/advancedfmMenu.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 5a46579..2e6b0da 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp | |||
@@ -36,25 +36,25 @@ using namespace Opie::Core; | |||
36 | #include <dirent.h> | 36 | #include <dirent.h> |
37 | #include <sys/sendfile.h> | 37 | #include <sys/sendfile.h> |
38 | #include <fcntl.h> | 38 | #include <fcntl.h> |
39 | 39 | ||
40 | void AdvancedFm::doDirChange() { | 40 | void AdvancedFm::doDirChange() { |
41 | QString pathItem = CurrentView()->currentItem()->text(0); | 41 | QString pathItem = CurrentView()->currentItem()->text(0); |
42 | if( pathItem == "../") { | 42 | if( pathItem == "../") { |
43 | ListClicked( CurrentView()->currentItem()); | 43 | ListClicked( CurrentView()->currentItem()); |
44 | } else { | 44 | } else { |
45 | if( pathItem.find(" -> ",0,TRUE) != -1) | 45 | if( pathItem.find(" -> ",0,TRUE) != -1) |
46 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; | 46 | pathItem = dealWithSymName((const QString&)pathItem)+"/"; |
47 | // owarn << pathItem << oendl; | 47 | // owarn << pathItem << oendl; |
48 | gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); | 48 | changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | void AdvancedFm::showMenuHidden() { | 52 | void AdvancedFm::showMenuHidden() { |
53 | if (b) { | 53 | if (b) { |
54 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 54 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
55 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 55 | OtherDir()->setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
56 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); | 56 | fileMenu->setItemChecked( fileMenu->idAt(0),TRUE); |
57 | } else { | 57 | } else { |
58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 58 | CurrentDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 59 | OtherDir()->setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
60 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); | 60 | fileMenu->setItemChecked( fileMenu->idAt(0),FALSE); |
@@ -732,54 +732,55 @@ 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"); | ||
744 | if ( e->type() == QEvent::KeyPress ) { | 745 | if ( e->type() == QEvent::KeyPress ) { |
745 | QKeyEvent *ke = (QKeyEvent*)e; | 746 | QKeyEvent *ke = (QKeyEvent*)e; |
746 | if ( ke->key() == Key_Return || | 747 | if ( ke->key() == Key_Return || |
747 | ke->key() == Key_Enter ) { | 748 | ke->key() == Key_Enter ) { |
748 | okRename(); | 749 | okRename(); |
749 | return true; | 750 | return true; |
750 | } | 751 | } |
751 | else if ( ke->key() == Key_Escape ) { | 752 | else if ( ke->key() == Key_Escape ) { |
752 | cancelRename(); | 753 | cancelRename(); |
753 | return true; | 754 | return true; |
754 | } | 755 | } |
755 | } | 756 | } |
756 | else if ( e->type() == QEvent::FocusOut ) { | 757 | else if ( e->type() == QEvent::FocusOut ) { |
757 | cancelRename(); | 758 | cancelRename(); |
758 | return true; | 759 | return true; |
759 | } | 760 | } |
760 | } | 761 | } |
761 | if ( o->inherits( "QListView" ) ) { | 762 | /* if ( o->inherits( "QListView" ) ) { |
762 | if ( e->type() == QEvent::FocusIn ) { | 763 | if ( e->type() == QEvent::FocusIn ) { |
763 | // if( o == Local_View) { //keep track of which view | 764 | // if( o == Local_View) { //keep track of which view |
764 | // qDebug("local view"); | 765 | // qDebug("local view"); |
765 | // whichTab = 1; | 766 | // whichTab = 1; |
766 | // } else { | 767 | // } else { |
767 | // whichTab = 2; | 768 | // whichTab = 2; |
768 | // qDebug("remote view"); | 769 | // qDebug("remote view"); |
769 | // } | 770 | // } |
770 | } | 771 | } |
771 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection | 772 | OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection |
772 | } | 773 | } |
773 | 774 | */ | |
774 | return QWidget::eventFilter( o, e ); | 775 | return QWidget::eventFilter( o, e ); |
775 | } | 776 | } |
776 | 777 | ||
777 | 778 | ||
778 | void AdvancedFm::cancelRename() { | 779 | void AdvancedFm::cancelRename() { |
779 | // odebug << "cancel rename" << oendl; | 780 | // odebug << "cancel rename" << oendl; |
780 | QListView * view; | 781 | QListView * view; |
781 | view = CurrentView(); | 782 | view = CurrentView(); |
782 | 783 | ||
783 | bool resetFocus = view->viewport()->focusProxy() == renameBox; | 784 | bool resetFocus = view->viewport()->focusProxy() == renameBox; |
784 | delete renameBox; | 785 | delete renameBox; |
785 | renameBox = 0; | 786 | renameBox = 0; |
@@ -811,24 +812,25 @@ void AdvancedFm::doRename(QListView * view) { | |||
811 | } | 812 | } |
812 | 813 | ||
813 | 814 | ||
814 | void AdvancedFm::renameIt() { | 815 | void AdvancedFm::renameIt() { |
815 | if( !CurrentView()->currentItem()) return; | 816 | if( !CurrentView()->currentItem()) return; |
816 | 817 | ||
817 | QListView *thisView = CurrentView(); | 818 | QListView *thisView = CurrentView(); |
818 | oldName = thisView->currentItem()->text(0); | 819 | oldName = thisView->currentItem()->text(0); |
819 | doRename( thisView ); | 820 | doRename( thisView ); |
820 | } | 821 | } |
821 | 822 | ||
822 | void AdvancedFm::okRename() { | 823 | void AdvancedFm::okRename() { |
824 | qDebug("okrename"); | ||
823 | if( !renameBox) return; | 825 | if( !renameBox) return; |
824 | 826 | ||
825 | QString newName = renameBox->text(); | 827 | QString newName = renameBox->text(); |
826 | cancelRename(); | 828 | cancelRename(); |
827 | QListView * view = CurrentView(); | 829 | QListView * view = CurrentView(); |
828 | QString path = CurrentDir()->canonicalPath() + "/"; | 830 | QString path = CurrentDir()->canonicalPath() + "/"; |
829 | oldName = path + oldName; | 831 | oldName = path + oldName; |
830 | newName = path + newName; | 832 | newName = path + newName; |
831 | if( rename( oldName.latin1(), newName.latin1())== -1) | 833 | if( rename( oldName.latin1(), newName.latin1())== -1) |
832 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 834 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
833 | else | 835 | else |
834 | oldName = ""; | 836 | oldName = ""; |