From f0c9caf97c692bf67afa3d265e2fa5175fa62c0d Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 12 Jan 2010 13:34:44 +0100 Subject: [PATCH] Remove stale entries in assistant db blocking qch file registering registerDocumentation failed if a namespace/qch file had been registered before, but the qch file is not accessible any more. This prevented the registration of the same namespace/qch file at a different location. Fix this by explicitly removing entries that have no valid qch file any more from the db. Reviewed-by: con --- src/plugins/help/helpplugin.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 51eea86a1d3..1efcf1f77f9 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -105,12 +105,23 @@ void HelpManager::registerDocumentation(const QStringList &fileNames) if (!QFileInfo(fileName).exists()) continue; const QString &nameSpace = QHelpEngineCore::namespaceName(fileName); - if (!nameSpace.isEmpty() - && !hc.registeredDocumentations().contains(nameSpace)) { - if (hc.registerDocumentation(fileName)) + if (!nameSpace.isEmpty()) { + if (hc.registeredDocumentations().contains(nameSpace)) { + if (!QFileInfo(hc.documentationFileName(nameSpace)).exists()) { + // remove stale documentation path first + if (!hc.unregisterDocumentation(fileName)) { + qWarning() << "error unregistering " << fileName << hc.error(); + continue; + } + } else { + continue; + } + } + if (hc.registerDocumentation(fileName)) { needsSetup = true; - else - qDebug() << "error registering" << fileName << hc.error(); + } else { + qWarning() << "error registering" << fileName << hc.error(); + } } } }