mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Allow history import during history review
This commit is contained in:
parent
dec9792f75
commit
54bba79c60
|
@ -2653,11 +2653,9 @@ static bool needHideSearchPane;
|
|||
ui.wordList->clear();
|
||||
|
||||
history.enableAdd( true );
|
||||
ui.importHistory->setDisabled( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.importHistory->setDisabled( true );
|
||||
history.enableAdd( false );
|
||||
|
||||
disconnect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
|
||||
|
@ -2679,22 +2677,7 @@ static bool needHideSearchPane;
|
|||
ui.translateLine->setProperty( "noResults", true );
|
||||
setStyleSheet( styleSheet() );
|
||||
|
||||
ui.wordList->setUpdatesEnabled( false );
|
||||
ui.wordList->clear();
|
||||
|
||||
QList< History::Item > const & items = history.getItems();
|
||||
for( int x = 0; x < items.size(); ++x )
|
||||
{
|
||||
History::Item const * i = &items[ x ];
|
||||
QListWidgetItem * s = new QListWidgetItem( i->word, ui.wordList );
|
||||
if (s->text().at(0).direction() == QChar::DirR)
|
||||
s->setTextAlignment(Qt::AlignRight);
|
||||
if (s->text().at(0).direction() == QChar::DirL)
|
||||
s->setTextAlignment(Qt::AlignLeft);
|
||||
ui.wordList->addItem( s );
|
||||
}
|
||||
|
||||
ui.wordList->setUpdatesEnabled( true );
|
||||
fillWordListFromHistory();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2785,8 +2768,14 @@ void MainWindow::on_importHistory_activated()
|
|||
|
||||
} while( !fileStream.atEnd() && itemList.size() < (int)history.getMaxSize() );
|
||||
|
||||
history.enableAdd( true );
|
||||
for( QList< QString >::const_iterator i = itemList.constBegin(); i != itemList.constEnd(); ++i )
|
||||
history.addItem( History::Item( 1, *i ) );
|
||||
if( showHistory )
|
||||
{
|
||||
history.enableAdd( false );
|
||||
fillWordListFromHistory();
|
||||
}
|
||||
|
||||
if( file.error() != QFile::NoError )
|
||||
break;
|
||||
|
@ -2805,3 +2794,22 @@ void MainWindow::on_importHistory_activated()
|
|||
mainStatusBar->showMessage( errStr, 10000, QPixmap( ":/icons/error.png" ) );
|
||||
}
|
||||
|
||||
void MainWindow::fillWordListFromHistory()
|
||||
{
|
||||
ui.wordList->setUpdatesEnabled( false );
|
||||
ui.wordList->clear();
|
||||
|
||||
QList< History::Item > const & items = history.getItems();
|
||||
for( int x = 0; x < items.size(); ++x )
|
||||
{
|
||||
History::Item const * i = &items[ x ];
|
||||
QListWidgetItem * s = new QListWidgetItem( i->word, ui.wordList );
|
||||
if (s->text().at(0).direction() == QChar::DirR)
|
||||
s->setTextAlignment(Qt::AlignRight);
|
||||
if (s->text().at(0).direction() == QChar::DirL)
|
||||
s->setTextAlignment(Qt::AlignLeft);
|
||||
ui.wordList->addItem( s );
|
||||
}
|
||||
|
||||
ui.wordList->setUpdatesEnabled( true );
|
||||
}
|
||||
|
|
|
@ -174,6 +174,8 @@ private:
|
|||
ArticleView * getCurrentArticleView();
|
||||
void ctrlTabPressed();
|
||||
|
||||
void fillWordListFromHistory();
|
||||
|
||||
private slots:
|
||||
|
||||
void hotKeyActivated( int );
|
||||
|
|
Loading…
Reference in a new issue