forked from qt-creator/qt-creator
Reregister a help file if creation time is newer.
Reviewed-by: ck
This commit is contained in:
@@ -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)
|
|||||||
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()
|
|||||||
|
|
||||||
void HelpManager::verifyDocumenation()
|
void HelpManager::verifyDocumenation()
|
||||||
{
|
{
|
||||||
QStringList nameSpacesToUnregister;
|
|
||||||
const QStringList ®isteredDocs = m_helpEngine->registeredDocumentations();
|
const QStringList ®isteredDocs = 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
|
||||||
|
|||||||
Reference in New Issue
Block a user