Commit e83c2e40 authored by ck's avatar ck
Browse files

Help plugin: Simplify code path in doc registering.

parent 3b7527de
......@@ -99,30 +99,33 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
bool needsSetup = false;
{
QHelpEngineCore hc(m_plugin->helpEngine()->collectionFile());
if (!hc.setupData())
if (!hc.setupData()) {
qWarning() << "Could not initialize help engine:" << hc.error();
return;
}
foreach (const QString &fileName, fileNames) {
if (!QFileInfo(fileName).exists())
continue;
const QString &nameSpace = QHelpEngineCore::namespaceName(fileName);
if (!nameSpace.isEmpty()) {
if (hc.registeredDocumentations().contains(nameSpace)) {
if (!QFileInfo(hc.documentationFileName(nameSpace)).exists()) {
// remove stale documentation path first
if (!hc.unregisterDocumentation(nameSpace)) {
qWarning() << "error unregistering " << fileName << hc.error();
continue;
}
} else {
continue;
}
}
if (hc.registerDocumentation(fileName)) {
needsSetup = true;
} else {
qWarning() << "error registering" << fileName << hc.error();
if (nameSpace.isEmpty())
continue;
if (hc.registeredDocumentations().contains(nameSpace)) {
if (QFileInfo(hc.documentationFileName(nameSpace)).exists())
continue;
// remove stale documentation first
if (!hc.unregisterDocumentation(nameSpace)) {
qWarning() << "error unregistering namespace '"
<< nameSpace << "' from file '" << fileName << "': "
<< hc.error();
continue;
}
}
if (hc.registerDocumentation(fileName)) {
needsSetup = true;
} else {
qWarning() << "error registering" << fileName << hc.error();
}
}
}
if (needsSetup)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment