Help plugin: Simplify code path in doc registering.

This commit is contained in:
ck
2010-01-13 15:08:07 +01:00
parent 3b7527de2e
commit e83c2e40a6

View File

@@ -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)