diff --git a/src/article_maker.cc b/src/article_maker.cc index 56b07772..70d13b2e 100644 --- a/src/article_maker.cc +++ b/src/article_maker.cc @@ -516,13 +516,15 @@ void ArticleRequest::altSearchFinished() // if the dictionary is website dictionary and openinNewTab is enabled, emit a signal. if ( GlobalBroadcaster::instance()->getPreference()->openWebsiteInNewTab ) { if ( ( activeDict->getFeatures() | Dictionary::WebSite ) == Dictionary::WebSite ) { - //todo ,replace the word with actual url + //replace the word,and get the actual requested url string url = activeDict->getProperties()[ Dictionary::Property::Url ]; if ( url.empty() ) { continue; } + + QString requestUrl = Utils::WebSite::urlReplaceWord( QString::fromStdString( url ), word ); emit GlobalBroadcaster::instance() - -> websiteDictionary( QString::fromStdString( activeDict->getName() ), QString::fromStdString( url ) ); + -> websiteDictionary( QString::fromStdString( activeDict->getName() ), requestUrl ); continue; } } diff --git a/src/dict/website.cc b/src/dict/website.cc index 186ed342..f0a3e399 100644 --- a/src/dict/website.cc +++ b/src/dict/website.cc @@ -316,7 +316,7 @@ void WebSiteArticleRequest::requestFinished( QNetworkReply * r ) sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str, vector< wstring > const & /*alts*/, - wstring const & context, + wstring const & /*context*/, bool /*ignoreDiacritics*/ ) { QString urlString = Utils::WebSite::urlReplaceWord( QString( urlTemplate ), QString::fromStdU32String( str ) ); @@ -330,14 +330,14 @@ sptr< DataRequest > WebSiteDictionary::getArticle( wstring const & str, QUrl url( urlString ); GlobalBroadcaster::instance()->addWhitelist( url.host() ); - QString encodeUrl = encodeUrl = urlString; + const QString & encodeUrl = urlString; - if ( GlobalBroadcaster::instance()->getPreference()->openWebSiteInNewTab ) { + if ( GlobalBroadcaster::instance()->getPreference()->openWebsiteInNewTab ) { result += string( "
this website dictionary is opened in the new tab
" ); } else { fmt::format_to( std::back_inserter( result ), - R"(