diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-10-04 16:01:36 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-10-18 12:08:08 +0000 |
commit | 91d785a1236aa749a9807faad62cf828e17dacd3 (patch) | |
tree | 8d08f3929d1a9bda5bd6b26ad7a9c37d0868e23c /src/plugins/help | |
parent | ab355bb15751141475b32dc64169b49d4a068580 (diff) |
Help: Unregister documentation when unregistering Qt versions
While doing we must take care that we do not remove documentation that
is used by other, still registered Qt versions (since for example
desktop & mobile Qt versions share the same documentation).
Fixes: QTCREATORBUG-16631
Change-Id: I77a38c89698cb3050d4a0a6963ab12d3238e2068
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/help')
-rw-r--r-- | src/plugins/help/helpmanager.cpp | 16 | ||||
-rw-r--r-- | src/plugins/help/helpmanager.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp index 6d41b79ff3..3c40e18702 100644 --- a/src/plugins/help/helpmanager.cpp +++ b/src/plugins/help/helpmanager.cpp @@ -136,8 +136,20 @@ void HelpManager::registerDocumentation(const QStringList &files) emit Core::HelpManager::Signals::instance()->documentationChanged(); } }); - ProgressManager::addTask(future, tr("Update Documentation"), - kUpdateDocumentationTask); + ProgressManager::addTask(future, tr("Update Documentation"), kUpdateDocumentationTask); +} + +void HelpManager::unregisterDocumentation(const QStringList &fileNames) +{ + if (fileNames.isEmpty()) + return; + const auto getNamespaces = [](const QStringList &fileNames) { + QMutexLocker locker(&d->m_helpengineMutex); + return Utils::transform(fileNames, [](const QString &filePath) { + return d->m_helpEngine->namespaceName(filePath); + }); + }; + unregisterNamespaces(getNamespaces(fileNames)); } void HelpManager::registerDocumentationNow(QFutureInterface<bool> &futureInterface, diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h index 49ca60f468..bcde6b794c 100644 --- a/src/plugins/help/helpmanager.h +++ b/src/plugins/help/helpmanager.h @@ -49,6 +49,7 @@ public: static QString collectionFilePath(); void registerDocumentation(const QStringList &fileNames) override; + void unregisterDocumentation(const QStringList &fileNames) override; static void unregisterNamespaces(const QStringList &nameSpaces); |