Merge branch 'staged' into dev

This commit is contained in:
Xiao Yi Fang 2024-08-09 10:42:19 +08:00
commit af72c97ce4
3 changed files with 29 additions and 3 deletions

View file

@ -2106,7 +2106,7 @@ void ArticleView::highlightFTSResults()
QString script = QString( QString script = QString(
"var context = document.querySelector(\"body\");\n" "var context = document.querySelector(\"body\");\n"
"var instance = new Mark(context);\n instance.unmark();\n" "var instance = new Mark(context);\n instance.unmark();\n"
"instance.mark(\"%1\");" ) "instance.mark(\"%1\",{\"accuracy\": \"exactly\"});" )
.arg( regString ); .arg( regString );
webview->page()->runJavaScript( script ); webview->page()->runJavaScript( script );

View file

@ -1216,6 +1216,32 @@ void MainWindow::commitData()
if ( d.exists() ) { if ( d.exists() ) {
d.removeRecursively(); d.removeRecursively();
} }
//temp dir
QDir dtemp( filePath + "_FTS_x_temp" );
if ( dtemp.exists() ) {
dtemp.removeRecursively();
}
}
//remove temp directories.
QFileInfoList const dirs = dir.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
for ( auto & file : dirs ) {
QString const fileName = file.fileName();
if ( !fileName.endsWith( "_temp" ) )
continue;
const QFileInfo info( fileName );
const QDateTime lastModified = info.lastModified();
//if the temp directory has not been modified within 7 days,remove the temp directory.
if ( lastModified.addDays( 7 ) > QDateTime::currentDateTime() ) {
continue;
}
QDir d( fileName );
d.removeRecursively();
} }
} }
@ -2751,7 +2777,6 @@ void MainWindow::toggleMainWindow( bool onlyShow )
if ( !cfg.preferences.searchInDock ) if ( !cfg.preferences.searchInDock )
translateBox->setPopupEnabled( false ); translateBox->setPopupEnabled( false );
qDebug() << "Current state:" << isVisible() << isMinimized() << isActiveWindow() << onlyShow;
if ( !isVisible() ) { if ( !isVisible() ) {
show(); show();

View file

@ -593,7 +593,8 @@ void ScanPopup::currentGroupChanged( int )
if ( isVisible() ) { if ( isVisible() ) {
updateSuggestionList(); updateSuggestionList();
translateInputFinished(); QString word = Folding::unescapeWildcardSymbols( definition->getWord() );
showTranslationFor( word );
} }
cfg.lastPopupGroupId = ui.groupList->getCurrentGroup(); cfg.lastPopupGroupId = ui.groupList->getCurrentGroup();