From df4bc682485057a90baa6f4d2b6b985598a69863 Mon Sep 17 00:00:00 2001 From: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Date: Thu, 20 Jul 2023 22:49:37 +0800 Subject: [PATCH] fix: [regression]scanpopup right context menu lost dictionary list (#989) * fix: [regression]scanpopup right context menu lost dictionary list * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- src/ui/articleview.cc | 13 ++++++------- src/ui/scanpopup.cc | 3 +++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ui/articleview.cc b/src/ui/articleview.cc index f6c18d15..2172444f 100644 --- a/src/ui/articleview.cc +++ b/src/ui/articleview.cc @@ -252,14 +252,11 @@ ArticleView::ArticleView( QWidget * parent, // Variable name for store current selection range rangeVarName = QString( "sr_%1" ).arg( QString::number( (quint64)this, 16 ) ); - if ( const bool fromMainWindow = parent && parent->objectName() == "MainWindow" ) { - connect( GlobalBroadcaster::instance(), - &GlobalBroadcaster::dictionaryChanges, - this, - &ArticleView::setActiveDictIds ); - connect( GlobalBroadcaster::instance(), &GlobalBroadcaster::dictionaryClear, this, &ArticleView::dictionaryClear ); - } + connect( GlobalBroadcaster::instance(), &GlobalBroadcaster::dictionaryChanges, this, &ArticleView::setActiveDictIds ); + + connect( GlobalBroadcaster::instance(), &GlobalBroadcaster::dictionaryClear, this, &ArticleView::dictionaryClear ); + channel = new QWebChannel( webview->page() ); agent = new ArticleViewAgent( this ); @@ -1862,6 +1859,8 @@ void ArticleView::pasteTriggered() unsigned ArticleView::getCurrentGroup() { + if ( !groupComboBox ) + return currentGroupId; return groupComboBox->getCurrentGroup(); } diff --git a/src/ui/scanpopup.cc b/src/ui/scanpopup.cc index db595e5e..11e9d789 100644 --- a/src/ui/scanpopup.cc +++ b/src/ui/scanpopup.cc @@ -132,6 +132,7 @@ ScanPopup::ScanPopup( QWidget * parent, ui.groupList->fill( groups ); ui.groupList->setCurrentGroup( cfg.lastPopupGroupId ); + definition->setCurrentGroupId( ui.groupList->getCurrentGroup() ); dictionaryBar.setFloatable( false ); Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId ); @@ -598,6 +599,8 @@ void ScanPopup::currentGroupChanged( int ) updateDictionaryBar(); + definition->setCurrentGroupId( cfg.lastPopupGroupId ); + if ( isVisible() ) { updateSuggestionList(); translateInputFinished();