From e83c2e40a6d94e87412684fc037a927464cd844d Mon Sep 17 00:00:00 2001
From: ck <qt-info@nokia.com>
Date: Wed, 13 Jan 2010 15:08:07 +0100
Subject: [PATCH] Help plugin: Simplify code path in doc registering.

---
 src/plugins/help/helpplugin.cpp | 37 ++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index ccdbaa5f9ba..367aead0f35 100644
--- a/src/plugins/help/helpplugin.cpp
+++ b/src/plugins/help/helpplugin.cpp
@@ -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)
-- 
GitLab