Skip to content

Commit

Permalink
Merge branch 'staged' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Aug 9, 2024
2 parents 529871b + b0bea92 commit af72c97
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ui/articleview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ void ArticleView::highlightFTSResults()
QString script = QString(
"var context = document.querySelector(\"body\");\n"
"var instance = new Mark(context);\n instance.unmark();\n"
"instance.mark(\"%1\");" )
"instance.mark(\"%1\",{\"accuracy\": \"exactly\"});" )
.arg( regString );

webview->page()->runJavaScript( script );
Expand Down
27 changes: 26 additions & 1 deletion src/ui/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,32 @@ void MainWindow::commitData()
if ( d.exists() ) {
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();
}
}

Expand Down Expand Up @@ -2751,7 +2777,6 @@ void MainWindow::toggleMainWindow( bool onlyShow )
if ( !cfg.preferences.searchInDock )
translateBox->setPopupEnabled( false );

qDebug() << "Current state:" << isVisible() << isMinimized() << isActiveWindow() << onlyShow;
if ( !isVisible() ) {
show();

Expand Down
3 changes: 2 additions & 1 deletion src/ui/scanpopup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ void ScanPopup::currentGroupChanged( int )

if ( isVisible() ) {
updateSuggestionList();
translateInputFinished();
QString word = Folding::unescapeWildcardSymbols( definition->getWord() );
showTranslationFor( word );
}

cfg.lastPopupGroupId = ui.groupList->getCurrentGroup();
Expand Down

0 comments on commit af72c97

Please sign in to comment.