1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[WebView] Edit isValidUrl method. All non-empty urls are valid now.

Fixes #1099
This commit is contained in:
nowrep 2013-12-05 19:18:11 +01:00
parent 43ab2e44f0
commit 5a7789bd17

View File

@ -239,21 +239,8 @@ QWebElement WebView::activeElement() const
bool WebView::isUrlValid(const QUrl &url) bool WebView::isUrlValid(const QUrl &url)
{ {
const QString &urlScheme = url.scheme(); // Valid url must have scheme and actually contains something (so scheme:// is invalid)
if (urlScheme == QLatin1String("data") || urlScheme == QLatin1String("qrc") || return url.isValid() && !url.scheme().isEmpty() && (!url.host().isEmpty() || !url.path().isEmpty());
urlScheme == QLatin1String("mailto")) {
return true;
}
if (urlScheme == QLatin1String("qupzilla") || urlScheme == QLatin1String("file")) {
return !url.path().isEmpty();
}
if (url.isValid() && !url.host().isEmpty() && !urlScheme.isEmpty()) {
return true;
}
return false;
} }
QUrl WebView::guessUrlFromString(const QString &string) QUrl WebView::guessUrlFromString(const QString &string)