From 2e6217b7564f7900b8d689abbce60f6fa967a9cf Mon Sep 17 00:00:00 2001 From: kh1 Date: Wed, 29 Sep 2010 14:08:57 +0200 Subject: [PATCH] Prefer never documentation over old ones. Task-number: QTCREATORBUG-2080 Reviewed-by: ck --- src/plugins/help/helpplugin.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 55438fa64c..2be35d4600 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -73,6 +73,7 @@ #include #include #include +#include #include #include @@ -839,7 +840,21 @@ void HelpPlugin::activateContext() "available.").arg(m_idFromContext)); viewer->setSource(QUrl()); } else { - const QUrl &source = *links.begin(); + int version = 0; + const QRegExp exp("(\\d+)"); + QUrl source = *links.begin(); + foreach (const QUrl &tmp, links) { + const QString &authority = tmp.authority(); + if (authority.startsWith(QLatin1String("com.trolltech.qt"))) { + if (exp.indexIn(authority) >= 0) { + const int tmpVersion = exp.cap(1).toInt(); + if (tmpVersion > version) { + source = tmp; + version = tmpVersion; + } + } + } + } const QUrl &oldSource = viewer->source(); if (source != oldSource) { #if !defined(QT_NO_WEBKIT) -- 2.11.0