Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't update state prematurely in showTranslationFor()
MainWindow::showTranslationFor() overloads disable the "Pronounce Word" action, then call ArticleView::showDefinition(). And then immediately update pronounce availability, Found in Dictionaries list, Back and Forward buttons. Since ArticleView::showDefinition() loads the requested page asynchronously, the previous page is still current. Therefore the "Pronounce Word" action is immediately re-enabled (if the still-current article has sounds), the other state updates have no effect whatsoever. Once the new page is loaded, the state is updated again in MainWindow::pageLoaded() - this time with the desired effect. So the only effect of the state updates in MainWindow::showTranslationFor() is to revert the intentional disabling of the "Pronounce Word" action. Plus waste some CPU time. The pronunciation-disabling behavior looks better to me and is consistent with the scan popup's behavior (which immediately hides the "Pronounce Word" button).
- Loading branch information