mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
Don't jump to dictionary when new page opens in background
This commit is contained in:
parent
7cea352be9
commit
dabceff223
|
@ -451,6 +451,9 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
|||
if ( !id.startsWith( "gdfrom-" ) )
|
||||
return; // Incorrect id
|
||||
|
||||
if ( !ui.definition->isVisible() )
|
||||
return; // No action on background page, scrollIntoView there don't work
|
||||
|
||||
if ( getArticlesList().contains( id.mid( 7 ) ) )
|
||||
{
|
||||
if ( moveToIt )
|
||||
|
@ -1828,7 +1831,7 @@ void ArticleView::onJsActiveArticleChanged(QString const & id)
|
|||
if ( !id.startsWith( "gdfrom-" ) )
|
||||
return; // Incorrect id
|
||||
|
||||
emit activeArticleChanged( id.mid( 7 ) );
|
||||
emit activeArticleChanged( this, id.mid( 7 ) );
|
||||
}
|
||||
|
||||
void ArticleView::doubleClicked()
|
||||
|
|
|
@ -196,7 +196,7 @@ signals:
|
|||
/// typically in response to user actions
|
||||
/// (clicking on the article or using shortcuts).
|
||||
/// id - the dictionary id of the active article.
|
||||
void activeArticleChanged ( QString const & id );
|
||||
void activeArticleChanged ( ArticleView const *, QString const & id );
|
||||
|
||||
/// Signal to add word to history even if history is disabled
|
||||
void forceAddWordToHistory( const QString & word);
|
||||
|
|
|
@ -1396,8 +1396,8 @@ ArticleView * MainWindow::createNewTab( bool switchToIt,
|
|||
connect( view, SIGNAL( typingEvent( QString const & ) ),
|
||||
this, SLOT( typingEvent( QString const & ) ) );
|
||||
|
||||
connect( view, SIGNAL( activeArticleChanged( const QString & ) ),
|
||||
this, SLOT( activeArticleChanged( const QString & ) ) );
|
||||
connect( view, SIGNAL( activeArticleChanged( ArticleView const *, const QString & ) ),
|
||||
this, SLOT( activeArticleChanged( ArticleView const *, const QString & ) ) );
|
||||
|
||||
connect( view, SIGNAL( statusBarMessage( QString const &, int, QPixmap const & ) ),
|
||||
this, SLOT( showStatusBarMessage( QString const &, int, QPixmap const & ) ) );
|
||||
|
@ -1588,6 +1588,9 @@ void MainWindow::updateWindowTitle()
|
|||
|
||||
void MainWindow::pageLoaded( ArticleView * view )
|
||||
{
|
||||
if( view != getCurrentArticleView() )
|
||||
return; // It was background action
|
||||
|
||||
updateBackForwardButtons();
|
||||
|
||||
updatePronounceAvailability();
|
||||
|
@ -2329,8 +2332,11 @@ void MainWindow::showDefinitionInNewTab( QString const & word,
|
|||
showDefinition( word, group, fromArticle, contexts );
|
||||
}
|
||||
|
||||
void MainWindow::activeArticleChanged( QString const & id )
|
||||
void MainWindow::activeArticleChanged( ArticleView const * view, QString const & id )
|
||||
{
|
||||
if( view != getCurrentArticleView() )
|
||||
return; // It was background action
|
||||
|
||||
// select the row with the corresponding id
|
||||
for (int i = 0; i < ui.dictsList->count(); ++i) {
|
||||
QListWidgetItem * w = ui.dictsList->item( i );
|
||||
|
|
|
@ -339,7 +339,7 @@ private slots:
|
|||
ArticleView::Contexts const & contexts );
|
||||
void typingEvent( QString const & );
|
||||
|
||||
void activeArticleChanged( QString const & id );
|
||||
void activeArticleChanged( ArticleView const *, QString const & id );
|
||||
|
||||
void mutedDictionariesChanged();
|
||||
|
||||
|
|
Loading…
Reference in a new issue