Monitor the collection file for doc updates during sdk update.

Reviewed-by: ck
This commit is contained in:
kh1
2010-09-10 14:09:08 +02:00
parent e9cf4e0e42
commit be357c4736
2 changed files with 22 additions and 2 deletions

View File

@@ -35,6 +35,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QFileSystemWatcher>
#include <QtCore/QStringList>
#include <QtHelp/QHelpEngineCore>
@@ -94,7 +95,8 @@ HelpManager* HelpManager::instance()
QString HelpManager::collectionFilePath()
{
return QDir::cleanPath(Core::ICore::instance()->userResourcePath() + QLatin1String("/helpcollection.qhc"));
return QDir::cleanPath(Core::ICore::instance()->userResourcePath()
+ QLatin1String("/helpcollection.qhc"));
}
void HelpManager::registerDocumentation(const QStringList &files)
@@ -392,7 +394,7 @@ void HelpManager::setupHelpManager()
// this might come from the installer
const QLatin1String key("AddedDocs");
const QString &addedDocs = m_helpEngine->customValue(key).toString();
const QString addedDocs = m_helpEngine->customValue(key).toString();
if (!addedDocs.isEmpty()) {
m_helpEngine->removeCustomValue(key);
m_filesToRegister += addedDocs.split(QLatin1Char(';'));
@@ -407,9 +409,24 @@ void HelpManager::setupHelpManager()
for (it = m_customValues.constBegin(); it != m_customValues.constEnd(); ++it)
setCustomValue(it.key(), it.value());
m_collectionWatcher = new QFileSystemWatcher(QStringList() << collectionFilePath(),
this);
connect(m_collectionWatcher, SIGNAL(fileChanged(QString)), this,
SLOT(collectionFileModified()));
emit setupFinished();
}
void HelpManager::collectionFileModified()
{
const QLatin1String key("AddedDocs");
const QString addedDocs = m_helpEngine->customValue(key).toString();
if (!addedDocs.isEmpty()) {
m_helpEngine->removeCustomValue(key);
registerDocumentation(addedDocs.split(QLatin1Char(';')));
}
}
// -- private
void HelpManager::verifyDocumenation()