Commit 30a0379f authored by kh1's avatar kh1

Reregister a help file if creation time is newer.

Reviewed-by: ck
parent a3757d89
......@@ -31,6 +31,7 @@
#include "icore.h"
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
......@@ -119,6 +120,18 @@ void HelpManager::registerDocumentation(const QStringList &files)
qWarning() << "Error registering namespace '" << nameSpace
<< "' 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)
......@@ -313,16 +326,11 @@ void HelpManager::setupHelpManager()
void HelpManager::verifyDocumenation()
{
QStringList nameSpacesToUnregister;
const QStringList &registeredDocs = m_helpEngine->registeredDocumentations();
foreach (const QString &nameSpace, registeredDocs) {
const QString &file = m_helpEngine->documentationFileName(nameSpace);
if (!QFileInfo(file).exists())
nameSpacesToUnregister.append(nameSpace);
if (!QFileInfo(m_helpEngine->documentationFileName(nameSpace)).exists())
m_nameSpacesToUnregister.append(nameSpace);
}
if (!nameSpacesToUnregister.isEmpty())
unregisterDocumentation(nameSpacesToUnregister);
}
} // 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