qdoc: Fixed a link generation regression

This update fixes a bug introduced in the original update for this
task. The bug caused some links to be generated incorrectly. If the
name of the file containing the target began with the module name,
then a test that asks if the link already begins with the module name
fails, and the link is generated incorrectly. The test now checks for
the module name followed by a slash, which it should have done in the
first place.

Change-Id: Iebac228ac969cef875678b15a248a2a1198ace05
Task-number: QTBUG-41705
Reviewed-by: Martin Smith <martin.smith@digia.com>
This commit is contained in:
Martin Smith 2014-10-27 14:19:08 +01:00
parent 0c9d1f99da
commit 894b579e34

View File

@ -3717,7 +3717,6 @@ QString HtmlGenerator::getLink(const Atom *atom, const Node *relative, const Nod
*node = qdb_->findNodeForAtom(atom, relative, ref);
if (!(*node))
return QString();
if (Generator::writeQaPages())
qdb_->incrementLinkCount(*node);
@ -3838,10 +3837,12 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
if (node && relative && (node != relative)) {
if (useOutputSubdirs() && !node->isExternalPage() &&
node->outputSubdirectory() != relative->outputSubdirectory()) {
if (link.startsWith(node->outputSubdirectory()))
if (link.startsWith(QString(node->outputSubdirectory() + QLatin1Char('/')))) {
link.prepend(QString("../"));
else
}
else {
link.prepend(QString("../" + node->outputSubdirectory() + QLatin1Char('/')));
}
}
}
return link;