Add option to prefer DuckDuckGo

This commit is contained in:
Xaver Maierhofer 2019-04-13 14:29:56 +02:00 committed by Jonathan White
parent 7bd079d48d
commit 12e020b7c2
2 changed files with 4 additions and 4 deletions

View File

@ -212,7 +212,7 @@
<item>
<widget class="QCheckBox" name="fallbackToSearch">
<property name="text">
<string>Use DuckDuckGo as fallback for downloading website icons</string>
<string>Use DuckDuckGo to download website icons</string>
</property>
</widget>
</item>

View File

@ -223,16 +223,16 @@ void EditWidgetIcons::downloadFavicon()
QUrl fallbackUrl = QUrl("https://icons.duckduckgo.com");
fallbackUrl.setPath("/ip3/" + QUrl::toPercentEncoding(fullyQualifiedDomain) + ".ico");
m_urlsToTry.append(fallbackUrl);
if (!hostIsIp) {
QString secondLevelDomain = getSecondLevelDomain(m_url);
if (fullyQualifiedDomain != secondLevelDomain) {
fallbackUrl.setPath("/ip3/" + QUrl::toPercentEncoding(secondLevelDomain) + ".ico");
m_urlsToTry.append(fallbackUrl);
m_urlsToTry.prepend(fallbackUrl);
}
}
m_urlsToTry.prepend(fallbackUrl);
}
startFetchFavicon(m_urlsToTry.takeFirst());