forked from qt-creator/qt-creator
Also remove old Qt Creator filters.
This commit is contained in:
@@ -574,9 +574,13 @@ void HelpPlugin::extensionsInitialized()
|
|||||||
bool needsSetup = false;
|
bool needsSetup = false;
|
||||||
bool assistantInternalDocRegistered = false;
|
bool assistantInternalDocRegistered = false;
|
||||||
QStringList documentationToRemove;
|
QStringList documentationToRemove;
|
||||||
|
QStringList filtersToRemove;
|
||||||
|
|
||||||
const QString &docInternal = QString("com.nokia.qtcreator.%1%2%3")
|
const QString &docInternal = QString("com.nokia.qtcreator.%1%2%3")
|
||||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
||||||
|
const QString filterInternal = QString("Qt Creator %1.%2.%3")
|
||||||
|
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
||||||
|
const QRegExp filterRegExp("Qt Creator \\d*\\.\\d*\\.\\d*");
|
||||||
const QStringList &docs = m_helpEngine->registeredDocumentations();
|
const QStringList &docs = m_helpEngine->registeredDocumentations();
|
||||||
foreach (const QString &ns, docs) {
|
foreach (const QString &ns, docs) {
|
||||||
if (ns == docInternal) {
|
if (ns == docInternal) {
|
||||||
@@ -585,20 +589,26 @@ void HelpPlugin::extensionsInitialized()
|
|||||||
documentationToRemove << ns;
|
documentationToRemove << ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
foreach (const QString &filter, m_helpEngine->customFilters()) {
|
||||||
|
if (filterRegExp.exactMatch(filter) && filter != filterInternal) {
|
||||||
|
filtersToRemove << filter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//remove any qtcreator documentation that doesn't belong to current version
|
//remove any qtcreator documentation that doesn't belong to current version
|
||||||
if (!documentationToRemove.isEmpty()) {
|
if (!documentationToRemove.isEmpty() || !filtersToRemove.isEmpty() || !assistantInternalDocRegistered) {
|
||||||
QHelpEngineCore hc(m_helpEngine->collectionFile());
|
QHelpEngineCore hc(m_helpEngine->collectionFile());
|
||||||
hc.setupData();
|
hc.setupData();
|
||||||
foreach (const QString &ns, documentationToRemove) {
|
foreach (const QString &ns, documentationToRemove) {
|
||||||
if (hc.unregisterDocumentation(ns))
|
if (hc.unregisterDocumentation(ns))
|
||||||
needsSetup = true;
|
needsSetup = true;
|
||||||
}
|
}
|
||||||
|
foreach (const QString &filter, filtersToRemove) {
|
||||||
|
if (hc.removeCustomFilter(filter))
|
||||||
|
needsSetup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!assistantInternalDocRegistered) {
|
if (!assistantInternalDocRegistered) {
|
||||||
QFileInfo fi(m_helpEngine->collectionFile());
|
|
||||||
|
|
||||||
const QString qchFileName =
|
const QString qchFileName =
|
||||||
QDir::cleanPath(QCoreApplication::applicationDirPath()
|
QDir::cleanPath(QCoreApplication::applicationDirPath()
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
@@ -606,15 +616,11 @@ void HelpPlugin::extensionsInitialized()
|
|||||||
#else
|
#else
|
||||||
+ QLatin1String("../../share/doc/qtcreator/qtcreator.qch"));
|
+ QLatin1String("../../share/doc/qtcreator/qtcreator.qch"));
|
||||||
#endif
|
#endif
|
||||||
QHelpEngineCore hc(fi.absoluteFilePath());
|
|
||||||
hc.setupData();
|
|
||||||
QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName);
|
|
||||||
if (!fileNamespace.isEmpty()
|
|
||||||
&& !hc.registeredDocumentations().contains(fileNamespace)) {
|
|
||||||
if (!hc.registerDocumentation(qchFileName))
|
if (!hc.registerDocumentation(qchFileName))
|
||||||
qDebug() << hc.error();
|
qDebug() << hc.error();
|
||||||
needsSetup = true;
|
needsSetup = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QLatin1String key("UnfilteredFilterInserted");
|
QLatin1String key("UnfilteredFilterInserted");
|
||||||
|
|||||||
Reference in New Issue
Block a user