Help: support qt-6 online documentation

Last segment of host part represents version string.
e.g. qthelp://org.qt-project.qtwidgets.630/...

If it starts with "6", let's open qt-6 documentation.
Otherwise, let's open qt-5 as it is.

Change-Id: I88b5f6bd2ebfd8494e48f043678dbc190310b90f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Tasuku Suzuki
2022-03-29 00:14:48 +09:00
parent 42d6704c4f
commit c49645483e

View File

@@ -589,10 +589,22 @@ bool LocalHelpManager::openOnlineHelp(const QUrl &url)
if (canOpenOnlineHelp(url)) {
QString urlPrefix = "http://doc.qt.io/";
if (url.authority().startsWith(unversionedLocalDomainName))
if (url.authority().startsWith(unversionedLocalDomainName)) {
urlPrefix.append(Core::Constants::IDE_ID);
else
urlPrefix.append("qt-5");
} else {
const auto host = url.host();
const auto dot = host.lastIndexOf('.');
if (dot < 0) {
urlPrefix.append("qt-5");
} else {
const auto version = host.mid(dot + 1);
if (version.startsWith('6')) {
urlPrefix.append("qt-6");
} else {
urlPrefix.append("qt-5");
}
}
}
const QString address = url.toString();
QDesktopServices::openUrl(QUrl(urlPrefix + address.mid(address.lastIndexOf(QLatin1Char('/')))));
return true;