Merge pull request #76 from xiaoyifang/golden-master

merge upstream changes
This commit is contained in:
xiaoyifang 2022-05-25 08:02:21 +08:00 committed by GitHub
commit 4096362183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View file

@ -652,18 +652,18 @@ void ArticleView::jumpToDictionary( QString const & id, bool force )
}
}
void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
bool ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
{
if ( !isScrollTo( id ) )
return; // Incorrect id
return false; // Incorrect id
if ( !ui.definition->isVisible() )
return; // No action on background page, scrollIntoView there don't work
return false; // No action on background page, scrollIntoView there don't work
if(moveToIt){
QString dictId = id.mid( 7 );
if( dictId.isEmpty() )
return;
return false;
QString script = QString( "var elem=document.getElementById('%1'); "
"if(elem!=undefined){elem.scrollIntoView(true);} gdMakeArticleActive('%2',true);" )
.arg( id, dictId );
@ -671,6 +671,7 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
ui.definition->page()->runJavaScript( script );
setActiveArticleId( dictId );
}
return true;
}
void ArticleView::selectCurrentArticle()

View file

@ -364,7 +364,8 @@ private:
/// Sets the current article by executing a javascript code.
/// If moveToIt is true, it moves the focus to it as well.
void setCurrentArticle( QString const &, bool moveToIt = false );
/// Returns true in case of success, false otherwise.
bool setCurrentArticle( QString const &, bool moveToIt = false );
/// Checks if the given article in form of "gdfrom-xxx" is inside a "website"
/// frame.

View file

@ -44,7 +44,7 @@ namespace {
enum
{
Signature = 0x58575045, // EPWX on little-endian, XWPE on big-endian
CurrentFormatVersion = 5 + BtreeIndexing::FormatVersion + Folding::Version
CurrentFormatVersion = 6 + BtreeIndexing::FormatVersion + Folding::Version
};
struct IdxHeader