From a5e4c2925a4f845685bce8a4094921e85bc7f93b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 18 Sep 2012 10:05:09 +0200 Subject: Fixes: Qt Creator documentation is accumulated Deregistering the old documentation must be delayed till the help engine is set up, because otherwise the list of registered namespaces is empty. Task-number: QTCREATORBUG-4605 Change-Id: I08288129fe24a80b7af090c3aa5dd13395bc6093 Reviewed-by: Karsten Heimrich --- src/plugins/help/helpplugin.cpp | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'src/plugins/help/helpplugin.cpp') diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 2af6e437e1..9a7e0ee787 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -194,6 +194,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) SLOT(setupHelpEngineIfNeeded())); connect(Core::HelpManager::instance(), SIGNAL(collectionFileChanged()), this, SLOT(setupHelpEngineIfNeeded())); + connect(Core::HelpManager::instance(), SIGNAL(setupFinished()), this, + SLOT(unregisterOldQtCreatorDocumentation())); m_splitter = new Core::MiniSplitter; m_centralWidget = new Help::Internal::CentralWidget(); @@ -385,16 +387,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) void HelpPlugin::extensionsInitialized() { - const QString &nsInternal = QString::fromLatin1("com.nokia.qtcreator.%1%2%3") - .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE); - - Core::HelpManager *helpManager = Core::HelpManager::instance(); - foreach (const QString &ns, helpManager->registeredNamespaces()) { - if (ns.startsWith(QLatin1String("com.nokia.qtcreator.")) - && ns != nsInternal) - helpManager->unregisterDocumentation(QStringList() << ns); - } - QStringList filesToRegister; // Explicitly register qml.qch if located in creator directory. This is only // needed for the creator-qml package, were we want to ship the documentation @@ -406,7 +398,7 @@ void HelpPlugin::extensionsInitialized() // we might need to register creators inbuild help filesToRegister.append(QDir::cleanPath(appPath + QLatin1String(DOCPATH "qtcreator.qch"))); - helpManager->registerDocumentation(filesToRegister); + Core::HelpManager::instance()->registerDocumentation(filesToRegister); } ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() @@ -428,6 +420,23 @@ ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() return SynchronousShutdown; } +void HelpPlugin::unregisterOldQtCreatorDocumentation() +{ + const QString &nsInternal = QString::fromLatin1("com.nokia.qtcreator.%1%2%3") + .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE); + + Core::HelpManager *helpManager = Core::HelpManager::instance(); + QStringList documentationToUnregister; + foreach (const QString &ns, helpManager->registeredNamespaces()) { + if (ns.startsWith(QLatin1String("com.nokia.qtcreator.")) + && ns != nsInternal) { + documentationToUnregister << ns; + } + } + if (!documentationToUnregister.isEmpty()) + helpManager->unregisterDocumentation(documentationToUnregister); +} + void HelpPlugin::setupUi() { // side bar widgets and shortcuts -- cgit v1.2.1