diff --git a/mainwindow.cc b/mainwindow.cc index 627c7398..4c5f5f2c 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -2645,12 +2645,19 @@ static bool needHideSearchPane; ui.showHideHistory->setText( tr( "&Show" ) ); showHistory = false; + disconnect( &focusTranslateLineAction, SIGNAL( triggered() ), + this, SLOT( focusWordList() ) ); + + connect( &focusTranslateLineAction, SIGNAL( triggered() ), + this, SLOT( focusTranslateLine() ) ); + connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), this, SLOT( translateInputChanged( QString const & ) ) ); ui.translateLine->clear(); ui.translateLine->setEnabled( true ); ui.translateLine->setProperty( "noResults", false ); + focusTranslateLine(); setStyleSheet( styleSheet() ); ui.wordList->clear(); @@ -2664,6 +2671,12 @@ static bool needHideSearchPane; disconnect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), this, SLOT( translateInputChanged( QString const & ) ) ); + disconnect( &focusTranslateLineAction, SIGNAL( triggered() ), + this, SLOT( focusTranslateLine() ) ); + + connect( &focusTranslateLineAction, SIGNAL( triggered() ), + this, SLOT( focusWordList() ) ); + if( !ui.searchPane->isVisible() ) { ui.searchPane->show(); @@ -2681,6 +2694,8 @@ static bool needHideSearchPane; setStyleSheet( styleSheet() ); fillWordListFromHistory(); + focusWordList(); + } } @@ -2842,3 +2857,9 @@ void MainWindow::fillWordListFromHistory() ui.wordList->setUpdatesEnabled( true ); } + +void MainWindow::focusWordList() +{ + if( ui.wordList->count() > 0 ) + ui.wordList->setFocus(); +} diff --git a/mainwindow.hh b/mainwindow.hh index f665e1e0..bc72898c 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -329,6 +329,7 @@ private slots: void on_showHideHistory_activated(); void on_exportHistory_activated(); void on_importHistory_activated(); + void focusWordList(); }; #endif