Commit 30a0379f authored by kh1's avatar kh1
Browse files

Reregister a help file if creation time is newer.

Reviewed-by: ck
parent a3757d89
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "icore.h" #include "icore.h"
#include <QtCore/QDateTime>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
...@@ -119,6 +120,18 @@ void HelpManager::registerDocumentation(const QStringList &files) ...@@ -119,6 +120,18 @@ void HelpManager::registerDocumentation(const QStringList &files)
qWarning() << "Error registering namespace '" << nameSpace qWarning() << "Error registering namespace '" << nameSpace
<< "' from file '" << file << "':" << m_helpEngine->error(); << "' from file '" << file << "':" << m_helpEngine->error();
} }
} else {
const QLatin1String key("CreationDate");
const QString &newDate = m_helpEngine->metaData(file, key).toString();
const QString &oldDate = m_helpEngine->metaData(
m_helpEngine->documentationFileName(nameSpace), key).toString();
if (QDateTime::fromString(newDate, Qt::ISODate)
> QDateTime::fromString(oldDate, Qt::ISODate)) {
if (m_helpEngine->unregisterDocumentation(nameSpace)) {
docsChanged = true;
m_helpEngine->registerDocumentation(file);
}
}
} }
} }
if (docsChanged) if (docsChanged)
...@@ -313,16 +326,11 @@ void HelpManager::setupHelpManager() ...@@ -313,16 +326,11 @@ void HelpManager::setupHelpManager()
void HelpManager::verifyDocumenation() void HelpManager::verifyDocumenation()
{ {
QStringList nameSpacesToUnregister;
const QStringList &registeredDocs = m_helpEngine->registeredDocumentations(); const QStringList &registeredDocs = m_helpEngine->registeredDocumentations();
foreach (const QString &nameSpace, registeredDocs) { foreach (const QString &nameSpace, registeredDocs) {
const QString &file = m_helpEngine->documentationFileName(nameSpace); if (!QFileInfo(m_helpEngine->documentationFileName(nameSpace)).exists())
if (!QFileInfo(file).exists()) m_nameSpacesToUnregister.append(nameSpace);
nameSpacesToUnregister.append(nameSpace);
} }
if (!nameSpacesToUnregister.isEmpty())
unregisterDocumentation(nameSpacesToUnregister);
} }
} // Core } // Core
Markdown is supported
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