qdoc: \externalpage links are fixed

The problem was they were being incorrectly written to
and read from the index files.

Task-number: QTBUG-33510
Change-Id: Ib0b34265cd22fff5ed88ae2fd5d5d7ea58b3761d
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
bb10
Martin Smith 2013-09-20 13:39:08 +02:00 committed by The Qt Project
parent 2d00d3951d
commit f5b3224cb5
3 changed files with 21 additions and 11 deletions

View File

@ -3605,8 +3605,10 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative)
back down into the other subdirectory.
*/
if (node && relative && (node != relative)) {
if (useOutputSubdirs() && node->outputSubdirectory() != relative->outputSubdirectory())
if (useOutputSubdirs() && !node->isExternalPage() &&
node->outputSubdirectory() != relative->outputSubdirectory()) {
link.prepend(QString("../" + node->outputSubdirectory() + QLatin1Char('/')));
}
}
return link;
}

View File

@ -211,6 +211,7 @@ public:
virtual bool isWrapper() const;
virtual bool isReadOnly() const { return false; }
virtual bool isDefault() const { return false; }
virtual bool isExternalPage() const { return false; }
virtual void addMember(Node* ) { }
virtual bool hasMembers() const { return false; }
virtual bool hasNamespaces() const { return false; }
@ -514,6 +515,7 @@ public:
virtual bool isGroup() const { return (subType() == Node::Group); }
virtual bool isExample() const { return (subType() == Node::Example); }
virtual bool isExampleFile() const { return (parent() && parent()->isExample()); }
virtual bool isExternalPage() const { return nodeSubtype_ == ExternalPage; }
protected:
SubType nodeSubtype_;

View File

@ -499,9 +499,10 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
QString moduleName = element.attribute("module");
if (!moduleName.isEmpty())
node->setModuleName(moduleName);
if (!indexUrl.isEmpty()) {
if (node->isExternalPage())
node->setUrl(href);
else if (!indexUrl.isEmpty())
node->setUrl(indexUrl + QLatin1Char('/') + href);
}
QString since = element.attribute("since");
if (!since.isEmpty()) {
@ -776,15 +777,20 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
if (!qmlFullBaseName.isEmpty())
writer.writeAttribute("qml-base-type", qmlFullBaseName);
}
QString fullName = node->fullDocumentName();
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
QString href;
if (Generator::useOutputSubdirs())
href = node->outputSubdirectory();
if (!href.isEmpty())
href.append(QLatin1Char('/'));
href.append(gen_->fullDocumentLocation(node));
if (!node->isExternalPage()) {
QString fullName = node->fullDocumentName();
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
if (Generator::useOutputSubdirs())
href = node->outputSubdirectory();
if (!href.isEmpty())
href.append(QLatin1Char('/'));
href.append(gen_->fullDocumentLocation(node));
}
else
href = node->name();
writer.writeAttribute("href", href);
writer.writeAttribute("location", node->location().fileName());