author | llornkcor <llornkcor> | 2004-09-25 05:26:52 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-09-25 05:26:52 (UTC) |
commit | 43ade399621278b78d658f660bde7f0e39457f53 (patch) (side-by-side diff) | |
tree | 271268029e4a128c93adaae54bfd47084881e90f /noncore | |
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 @@ -282,13 +282,13 @@ void AdvancedFm::refreshCurrentTab() { void AdvancedFm::switchToLocalTab() { TabWidget->setCurrentWidget(0); - Local_View->setFocus(); +// Local_View->setFocus(); whichTab = 1; } void AdvancedFm::switchToRemoteTab() { TabWidget->setCurrentWidget(1); - Remote_View->setFocus(); +// Remote_View->setFocus(); whichTab = 2; } @@ -381,9 +381,13 @@ void AdvancedFm::keyPressEvent( QKeyEvent *e) { } void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { - if( CurrentView()->hasFocus() ) - e->ignore(); - if( e->key() == Key_Left ) +// if( CurrentView()->hasFocus() ) +// e->ignore(); + if( currentPathCombo->lineEdit()->hasFocus()) { +// qDebug("shout!"); + } + + else if( e->key() == Key_Left ) upDir(); else if( e->key() == Key_Return || e->key() == Key_Enter) navigateToSelected(); @@ -755,7 +759,7 @@ void AdvancedFm::setOtherTabCurrent() { } else { TabWidget->setCurrentWidget(0); } - OtherView()->setFocus(); +// OtherView()->setFocus(); 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 @@ -128,7 +128,7 @@ void AdvancedFm::init() { menuButton->insertItem( s_addBookmark); menuButton->insertItem( s_removeBookmark); menuButton->insertSeparator(); - menuButton->setFocusPolicy(NoFocus); +// menuButton->setFocusPolicy(NoFocus); CBHB->addWidget( menuButton ); customDirsToMenu(); @@ -136,7 +136,7 @@ void AdvancedFm::init() { currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" ); currentPathCombo->setEditable(TRUE); currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); - currentPathCombo->setFocusPolicy(NoFocus); +// currentPathCombo->setFocusPolicy(NoFocus); CBHB->addWidget( currentPathCombo ); layout->addLayout( CBHB ); 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 @@ -45,7 +45,7 @@ void AdvancedFm::doDirChange() { if( pathItem.find(" -> ",0,TRUE) != -1) pathItem = dealWithSymName((const QString&)pathItem)+"/"; // owarn << pathItem << oendl; - gotoDirectory( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); + changeTo( CurrentDir()->path()+"/"+pathItem.left( pathItem.length() - 1) ); } } @@ -740,25 +740,26 @@ void AdvancedFm::oprocessStderr(OProcess*, char *buffer, int ) { } bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { - if ( o->inherits( "QLineEdit" ) ) { - if ( e->type() == QEvent::KeyPress ) { - QKeyEvent *ke = (QKeyEvent*)e; - if ( ke->key() == Key_Return || - ke->key() == Key_Enter ) { - okRename(); - return true; + if ( o->inherits( "QLineEdit" ) ) { + qDebug("QLineEdit event"); + if ( e->type() == QEvent::KeyPress ) { + QKeyEvent *ke = (QKeyEvent*)e; + if ( ke->key() == Key_Return || + ke->key() == Key_Enter ) { + okRename(); + return true; } - else if ( ke->key() == Key_Escape ) { + else if ( ke->key() == Key_Escape ) { cancelRename(); return true; - } + } } - else if ( e->type() == QEvent::FocusOut ) { + else if ( e->type() == QEvent::FocusOut ) { cancelRename(); return true; - } + } } - if ( o->inherits( "QListView" ) ) { +/* if ( o->inherits( "QListView" ) ) { if ( e->type() == QEvent::FocusIn ) { // if( o == Local_View) { //keep track of which view // qDebug("local view"); @@ -770,7 +771,7 @@ bool AdvancedFm::eventFilter( QObject * o, QEvent * e ) { } OtherView()->setSelected( OtherView()->currentItem(), FALSE );//make sure there's correct selection } - +*/ return QWidget::eventFilter( o, e ); } @@ -812,30 +813,31 @@ void AdvancedFm::doRename(QListView * view) { void AdvancedFm::renameIt() { - if( !CurrentView()->currentItem()) return; + if( !CurrentView()->currentItem()) return; - QListView *thisView = CurrentView(); + QListView *thisView = CurrentView(); oldName = thisView->currentItem()->text(0); doRename( thisView ); } void AdvancedFm::okRename() { - if( !renameBox) return; - - QString newName = renameBox->text(); - cancelRename(); - QListView * view = CurrentView(); - QString path = CurrentDir()->canonicalPath() + "/"; - oldName = path + oldName; - newName = path + newName; - if( rename( oldName.latin1(), newName.latin1())== -1) - QMessageBox::message(tr("Note"),tr("Could not rename")); - else - oldName = ""; - QListViewItem *item = view->currentItem(); - view->takeItem( item ); - delete item; - rePopulate(); + qDebug("okrename"); + if( !renameBox) return; + + QString newName = renameBox->text(); + cancelRename(); + QListView * view = CurrentView(); + QString path = CurrentDir()->canonicalPath() + "/"; + oldName = path + oldName; + newName = path + newName; + if( rename( oldName.latin1(), newName.latin1())== -1) + QMessageBox::message(tr("Note"),tr("Could not rename")); + else + oldName = ""; + QListViewItem *item = view->currentItem(); + view->takeItem( item ); + delete item; + rePopulate(); } void AdvancedFm::openSearch() { |