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 <karsten.heimrich@nokia.com>
This commit is contained in:
Eike Ziller
2012-09-18 10:05:09 +02:00
parent 6d17da175f
commit a5e4c2925a
2 changed files with 22 additions and 11 deletions

View File

@@ -194,6 +194,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
SLOT(setupHelpEngineIfNeeded())); SLOT(setupHelpEngineIfNeeded()));
connect(Core::HelpManager::instance(), SIGNAL(collectionFileChanged()), this, connect(Core::HelpManager::instance(), SIGNAL(collectionFileChanged()), this,
SLOT(setupHelpEngineIfNeeded())); SLOT(setupHelpEngineIfNeeded()));
connect(Core::HelpManager::instance(), SIGNAL(setupFinished()), this,
SLOT(unregisterOldQtCreatorDocumentation()));
m_splitter = new Core::MiniSplitter; m_splitter = new Core::MiniSplitter;
m_centralWidget = new Help::Internal::CentralWidget(); m_centralWidget = new Help::Internal::CentralWidget();
@@ -385,16 +387,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
void HelpPlugin::extensionsInitialized() 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; QStringList filesToRegister;
// Explicitly register qml.qch if located in creator directory. This is only // 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 // 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 // we might need to register creators inbuild help
filesToRegister.append(QDir::cleanPath(appPath filesToRegister.append(QDir::cleanPath(appPath
+ QLatin1String(DOCPATH "qtcreator.qch"))); + QLatin1String(DOCPATH "qtcreator.qch")));
helpManager->registerDocumentation(filesToRegister); Core::HelpManager::instance()->registerDocumentation(filesToRegister);
} }
ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown()
@@ -428,6 +420,23 @@ ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown()
return SynchronousShutdown; 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() void HelpPlugin::setupUi()
{ {
// side bar widgets and shortcuts // side bar widgets and shortcuts

View File

@@ -81,6 +81,8 @@ public:
ShutdownFlag aboutToShutdown(); ShutdownFlag aboutToShutdown();
private slots: private slots:
void unregisterOldQtCreatorDocumentation();
void showExternalWindow(); void showExternalWindow();
void modeChanged(Core::IMode *mode, Core::IMode *old); void modeChanged(Core::IMode *mode, Core::IMode *old);