bool synchronizeDocs(QHelpEngineCore &collection, QHelpEngineCore &cachedCollection, CmdLineParser &cmd) { TRACE_OBJ const QDateTime &lastCollectionRegisterTime = CollectionConfiguration::lastRegisterTime(collection); if (!lastCollectionRegisterTime.isValid() || lastCollectionRegisterTime < CollectionConfiguration::lastRegisterTime(cachedCollection)) return true; const QStringList &docs = collection.registeredDocumentations(); const QStringList &cachedDocs = cachedCollection.registeredDocumentations(); /* * Ensure that the cached collection contains all docs that * the collection contains. */ foreach (const QString &doc, docs) { if (!cachedDocs.contains(doc)) { const QString &docFile = collection.documentationFileName(doc); if (!cachedCollection.registerDocumentation(docFile)) { cmd.showMessage(QCoreApplication::translate("Assistant", "Error registering documentation file '%1': %2"). arg(docFile).arg(cachedCollection.error()), true); return false; } } } CollectionConfiguration::updateLastRegisterTime(cachedCollection); return true; }
bool rebuildSearchIndex(QCoreApplication *app, const QString &collectionFile, CmdLineParser &cmd) { TRACE_OBJ QHelpEngine engine(collectionFile); if (!engine.setupData()) { cmd.showMessage(QCoreApplication::translate("Assistant", "Error: %1") .arg(engine.error()), true); return false; } QHelpSearchEngine * const searchEngine = engine.searchEngine(); QObject::connect(searchEngine, SIGNAL(indexingFinished()), app, SLOT(quit())); searchEngine->reindexDocumentation(); return app->exec() == 0; }