Focus word list in history review mode

This commit is contained in:
Abs62 2012-09-12 16:32:29 +04:00
parent 13e3c630dc
commit 5ceab47fb3
2 changed files with 22 additions and 0 deletions

View file

@ -2645,12 +2645,19 @@ static bool needHideSearchPane;
ui.showHideHistory->setText( tr( "&Show" ) ); ui.showHideHistory->setText( tr( "&Show" ) );
showHistory = false; showHistory = false;
disconnect( &focusTranslateLineAction, SIGNAL( triggered() ),
this, SLOT( focusWordList() ) );
connect( &focusTranslateLineAction, SIGNAL( triggered() ),
this, SLOT( focusTranslateLine() ) );
connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
this, SLOT( translateInputChanged( QString const & ) ) ); this, SLOT( translateInputChanged( QString const & ) ) );
ui.translateLine->clear(); ui.translateLine->clear();
ui.translateLine->setEnabled( true ); ui.translateLine->setEnabled( true );
ui.translateLine->setProperty( "noResults", false ); ui.translateLine->setProperty( "noResults", false );
focusTranslateLine();
setStyleSheet( styleSheet() ); setStyleSheet( styleSheet() );
ui.wordList->clear(); ui.wordList->clear();
@ -2664,6 +2671,12 @@ static bool needHideSearchPane;
disconnect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), disconnect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
this, SLOT( translateInputChanged( 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() ) if( !ui.searchPane->isVisible() )
{ {
ui.searchPane->show(); ui.searchPane->show();
@ -2681,6 +2694,8 @@ static bool needHideSearchPane;
setStyleSheet( styleSheet() ); setStyleSheet( styleSheet() );
fillWordListFromHistory(); fillWordListFromHistory();
focusWordList();
} }
} }
@ -2842,3 +2857,9 @@ void MainWindow::fillWordListFromHistory()
ui.wordList->setUpdatesEnabled( true ); ui.wordList->setUpdatesEnabled( true );
} }
void MainWindow::focusWordList()
{
if( ui.wordList->count() > 0 )
ui.wordList->setFocus();
}

View file

@ -329,6 +329,7 @@ private slots:
void on_showHideHistory_activated(); void on_showHideHistory_activated();
void on_exportHistory_activated(); void on_exportHistory_activated();
void on_importHistory_activated(); void on_importHistory_activated();
void focusWordList();
}; };
#endif #endif