diff options
author | kh1 <qt-info@nokia.com> | 2010-09-10 14:09:08 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2010-09-10 14:09:58 +0200 |
commit | be357c4736ad70b6d5c8907931ef08c55320f0dc (patch) | |
tree | c47930e8eb19b692c8d41cfb1b0a8befd1214b22 /src/plugins/coreplugin/helpmanager.cpp | |
parent | e9cf4e0e42e22ab7316328c902fd9497f2d311b2 (diff) | |
download | qt-creator-be357c4736ad70b6d5c8907931ef08c55320f0dc.tar.gz |
Monitor the collection file for doc updates during sdk update.
Reviewed-by: ck
Diffstat (limited to 'src/plugins/coreplugin/helpmanager.cpp')
-rw-r--r-- | src/plugins/coreplugin/helpmanager.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/helpmanager.cpp b/src/plugins/coreplugin/helpmanager.cpp index 6fbb3f0ac1..da2151a4d0 100644 --- a/src/plugins/coreplugin/helpmanager.cpp +++ b/src/plugins/coreplugin/helpmanager.cpp @@ -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() |