Full-text search: A little refactoring of dialog

This commit is contained in:
Abs62 2014-04-29 17:54:09 +04:00
parent c32c610665
commit 052e43e2c3
2 changed files with 9 additions and 2 deletions

View file

@ -134,6 +134,9 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
if( cfg.preferences.fts.dialogGeometry.size() > 0 ) if( cfg.preferences.fts.dialogGeometry.size() > 0 )
restoreGeometry( cfg.preferences.fts.dialogGeometry ); restoreGeometry( cfg.preferences.fts.dialogGeometry );
setAttribute( Qt::WA_DeleteOnClose, false );
setWindowFlags( windowFlags() & ~Qt::WindowContextHelpButtonHint );
setWindowTitle( tr( "Full-text search" ) ); setWindowTitle( tr( "Full-text search" ) );
setNewIndexingName( ftsIdx.nowIndexingName() ); setNewIndexingName( ftsIdx.nowIndexingName() );
@ -186,6 +189,8 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
connect( ui.headwordsView, SIGNAL( clicked( QModelIndex ) ), connect( ui.headwordsView, SIGNAL( clicked( QModelIndex ) ),
this, SLOT( itemClicked( QModelIndex ) ) ); this, SLOT( itemClicked( QModelIndex ) ) );
connect( this, SIGNAL( finished( int ) ), this, SLOT( saveData() ) );
connect( ui.OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( ui.OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( ui.cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( ui.cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
@ -198,7 +203,6 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
FullTextSearchDialog::~FullTextSearchDialog() FullTextSearchDialog::~FullTextSearchDialog()
{ {
saveData();
if( delegate ) if( delegate )
delete delegate; delete delegate;
} }
@ -395,8 +399,11 @@ void FullTextSearchDialog::reject()
if( !searchReqs.empty() ) if( !searchReqs.empty() )
stopSearch(); stopSearch();
else else
{
saveData();
emit closeDialog(); emit closeDialog();
} }
}
void FullTextSearchDialog::itemClicked( const QModelIndex & idx ) void FullTextSearchDialog::itemClicked( const QModelIndex & idx )
{ {

View file

@ -3992,7 +3992,7 @@ void MainWindow::showFullTextSearchDialog()
connect( ftsDlg, SIGNAL( showTranslationFor( QString, QStringList, QRegExp ) ), connect( ftsDlg, SIGNAL( showTranslationFor( QString, QStringList, QRegExp ) ),
this, SLOT( showTranslationFor( QString, QStringList, QRegExp ) ) ); this, SLOT( showTranslationFor( QString, QStringList, QRegExp ) ) );
connect( ftsDlg, SIGNAL( closeDialog() ), connect( ftsDlg, SIGNAL( closeDialog() ),
this, SLOT( closeFullTextSearchDialog() ) ); this, SLOT( closeFullTextSearchDialog() ), Qt::QueuedConnection );
connect( &configEvents, SIGNAL( mutedDictionariesChanged() ), connect( &configEvents, SIGNAL( mutedDictionariesChanged() ),
ftsDlg, SLOT( updateDictionaries() ) ); ftsDlg, SLOT( updateDictionaries() ) );
} }