Pass on local html links with a fragment to openUrl()
If a file link to a html file has a fragment part included then this will be lost when passed to QDesktopServices::openUrl() as this is not kept in the conversion of the QUrl. So by checking the filename in the case of a fragment existing in the url, we can be sure that the information is passed on correctly for html files. Task-number: QTBUG-14460 Change-Id: I8167d8c164713dd999603ba9e74150f4f1a4abea Reviewed-by: David Faure <david.faure@kdab.com>bb10
parent
ec23d96c86
commit
d90fb72c20
|
|
@ -226,8 +226,11 @@ bool QDesktopServices::openUrl(const QUrl &url)
|
|||
qWarning("The platform plugin does not support services.");
|
||||
return false;
|
||||
}
|
||||
return url.scheme() == QLatin1String("file") ?
|
||||
platformServices->openDocument(url) : platformServices->openUrl(url);
|
||||
// We only use openDocument if there is no fragment for the URL to
|
||||
// avoid it being lost when using openDocument
|
||||
if (url.isLocalFile() && !url.hasFragment())
|
||||
return platformServices->openDocument(url);
|
||||
return platformServices->openUrl(url);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue