mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 04:24:09 +00:00
Don't update pages history in ArticleView::setCurrentArticle()
The current article is saved to pages history user data before any navigation to another page and before reloading the current page. Therefore saving it each time the user activates an article is redundant. This redundancy is not consistent, because when a user activates an article by clicking on it, the current article changes in the UI, but is not immediately saved in history as setCurrentArticle() is not called. The inconsistent redundancy is a waste of CPU time and can hide bugs.
This commit is contained in:
parent
7df106c68c
commit
9b5756d5e1
|
@ -761,10 +761,6 @@ bool ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
||||||
if ( moveToIt )
|
if ( moveToIt )
|
||||||
ui.definition->page()->mainFrame()->evaluateJavaScript( QString( "document.getElementById('%1').scrollIntoView(true);" ).arg( id ) );
|
ui.definition->page()->mainFrame()->evaluateJavaScript( QString( "document.getElementById('%1').scrollIntoView(true);" ).arg( id ) );
|
||||||
|
|
||||||
QMap< QString, QVariant > userData = ui.definition->history()->currentItem().userData().toMap();
|
|
||||||
userData[ "currentArticle" ] = id;
|
|
||||||
ui.definition->history()->currentItem().setUserData( userData );
|
|
||||||
|
|
||||||
ui.definition->page()->mainFrame()->evaluateJavaScript(
|
ui.definition->page()->mainFrame()->evaluateJavaScript(
|
||||||
QString( "gdMakeArticleActive( '%1' );" ).arg( dictionaryId ) );
|
QString( "gdMakeArticleActive( '%1' );" ).arg( dictionaryId ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue