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 | |
parent | 45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52 (diff) | |
download | opie-43ade399621278b78d658f660bde7f0e39457f53.zip opie-43ade399621278b78d658f660bde7f0e39457f53.tar.gz opie-43ade399621278b78d658f660bde7f0e39457f53.tar.bz2 |
change focus for edit
-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 16 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmData.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/advancedfm/advancedfmMenu.cpp | 66 |
3 files changed, 46 insertions, 40 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 3cd2067..8d07f69 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -284,3 +284,3 @@ void AdvancedFm::switchToLocalTab() { | |||
284 | TabWidget->setCurrentWidget(0); | 284 | TabWidget->setCurrentWidget(0); |
285 | Local_View->setFocus(); | 285 | // Local_View->setFocus(); |
286 | whichTab = 1; | 286 | whichTab = 1; |
@@ -290,3 +290,3 @@ void AdvancedFm::switchToRemoteTab() { | |||
290 | TabWidget->setCurrentWidget(1); | 290 | TabWidget->setCurrentWidget(1); |
291 | Remote_View->setFocus(); | 291 | // Remote_View->setFocus(); |
292 | whichTab = 2; | 292 | whichTab = 2; |
@@ -383,5 +383,9 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) { | |||
383 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 383 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
384 | if( CurrentView()->hasFocus() ) | 384 | // if( CurrentView()->hasFocus() ) |
385 | e->ignore(); | 385 | // e->ignore(); |
386 | if( e->key() == Key_Left ) | 386 | if( currentPathCombo->lineEdit()->hasFocus()) { |
387 | // qDebug("shout!"); | ||
388 | } | ||
389 | |||
390 | else if( e->key() == Key_Left ) | ||
387 | upDir(); | 391 | upDir(); |
@@ -757,3 +761,3 @@ void AdvancedFm::setOtherTabCurrent() { | |||
757 | } | 761 | } |
758 | OtherView()->setFocus(); | 762 | // OtherView()->setFocus(); |
759 | OtherView()->setSelected( CurrentView()->firstChild(), true); | 763 | OtherView()->setSelected( CurrentView()->firstChild(), true); |
diff --git a/noncore/apps/advancedfm/advancedfmData.cpp b/noncore/apps/advancedfm/advancedfmData.cpp index d2e1d8e..fe565a0 100644 --- a/noncore/apps/advancedfm/advancedfmData.cpp +++ b/noncore/apps/advancedfm/advancedfmData.cpp | |||
@@ -130,3 +130,3 @@ void AdvancedFm::init() { | |||
130 | menuButton->insertSeparator(); | 130 | menuButton->insertSeparator(); |
131 | menuButton->setFocusPolicy(NoFocus); | 131 | // menuButton->setFocusPolicy(NoFocus); |
132 | CBHB->addWidget( menuButton ); | 132 | CBHB->addWidget( menuButton ); |
@@ -138,3 +138,3 @@ void AdvancedFm::init() { | |||
138 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 138 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
139 | currentPathCombo->setFocusPolicy(NoFocus); | 139 | // currentPathCombo->setFocusPolicy(NoFocus); |
140 | CBHB->addWidget( currentPathCombo ); | 140 | CBHB->addWidget( currentPathCombo ); |
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 | |||
@@ -47,3 +47,3 @@ void AdvancedFm::doDirChange() { | |||
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 | } |
@@ -742,21 +742,22 @@ void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { | |||
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 | if ( e->type() == QEvent::KeyPress ) { | 744 | qDebug("QLineEdit event"); |
745 | QKeyEvent *ke = (QKeyEvent*)e; | 745 | if ( e->type() == QEvent::KeyPress ) { |
746 | if ( ke->key() == Key_Return || | 746 | QKeyEvent *ke = (QKeyEvent*)e; |
747 | ke->key() == Key_Enter ) { | 747 | if ( ke->key() == Key_Return || |
748 | okRename(); | 748 | ke->key() == Key_Enter ) { |
749 | return true; | 749 | okRename(); |
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 ) { |
@@ -772,3 +773,3 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { | |||
772 | } | 773 | } |
773 | 774 | */ | |
774 | return QWidget::eventFilter( o, e ); | 775 | return QWidget::eventFilter( o, e ); |
@@ -814,5 +815,5 @@ void AdvancedFm::doRename(QListView * view) { | |||
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); |
@@ -822,18 +823,19 @@ void AdvancedFm::renameIt() { | |||
822 | void AdvancedFm::okRename() { | 823 | void AdvancedFm::okRename() { |
823 | if( !renameBox) return; | 824 | qDebug("okrename"); |
824 | 825 | if( !renameBox) return; | |
825 | QString newName = renameBox->text(); | 826 | |
826 | cancelRename(); | 827 | QString newName = renameBox->text(); |
827 | QListView * view = CurrentView(); | 828 | cancelRename(); |
828 | QString path = CurrentDir()->canonicalPath() + "/"; | 829 | QListView * view = CurrentView(); |
829 | oldName = path + oldName; | 830 | QString path = CurrentDir()->canonicalPath() + "/"; |
830 | newName = path + newName; | 831 | oldName = path + oldName; |
831 | if( rename( oldName.latin1(), newName.latin1())== -1) | 832 | newName = path + newName; |
832 | QMessageBox::message(tr("Note"),tr("Could not rename")); | 833 | if( rename( oldName.latin1(), newName.latin1())== -1) |
833 | else | 834 | QMessageBox::message(tr("Note"),tr("Could not rename")); |
834 | oldName = ""; | 835 | else |
835 | QListViewItem *item = view->currentItem(); | 836 | oldName = ""; |
836 | view->takeItem( item ); | 837 | QListViewItem *item = view->currentItem(); |
837 | delete item; | 838 | view->takeItem( item ); |
838 | rePopulate(); | 839 | delete item; |
840 | rePopulate(); | ||
839 | } | 841 | } |