diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 38c631ba484cc1a20d396c3b1b03a546f86f0100..4119fa8f90bf627306c4c4f0ef22976c8bfaf86d 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -50,6 +50,7 @@ #include <coreplugin/icore.h> #include <coreplugin/minisplitter.h> #include <coreplugin/modemanager.h> +#include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/rightpane.h> #include <coreplugin/sidebar.h> #include <coreplugin/uniqueidmanager.h> @@ -60,6 +61,7 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> +#include <QtCore/QFuture> #include <QtCore/QLibraryInfo> #include <QtCore/QTranslator> #include <QtCore/qplugin.h> @@ -73,6 +75,7 @@ #include <QtGui/QToolBar> #include <QtHelp/QHelpEngine> +#include <QtHelp/QHelpSearchEngine> #if defined(QT_NO_WEBKIT) # include <QtGui/QApplication> @@ -643,6 +646,11 @@ void HelpPlugin::extensionsInitialized() filesToRegister += addedDocs.split(QLatin1Char(';')); } + connect(m_helpEngine->searchEngine(), SIGNAL(indexingStarted()), this, + SLOT(indexingStarted())); + connect(m_helpEngine->searchEngine(), SIGNAL(indexingFinished()), this, + SLOT(indexingFinished())); + if (!updateDocumentation()) { // if no documentation has been added, we need to force a setup data, // otherwise it has already been run in updateDocumentation @@ -771,6 +779,24 @@ void HelpPlugin::updateViewerComboBoxIndex(int index) m_documentsCombo->setCurrentIndex(index); } +void HelpPlugin::indexingStarted() +{ + Core::ICore::instance()->progressManager() ->addTask(m_progress.future(), + tr("Indexing"), QLatin1String("Help.Indexer")); + m_progress.setProgressRange(0, 2); + m_progress.setProgressValueAndText(1, tr("Indexing Documentation...")); + m_progress.reportStarted(); + + m_watcher.setFuture(m_progress.future()); + connect(&m_watcher, SIGNAL(canceled()), m_helpEngine->searchEngine(), + SLOT(cancelIndexing())); +} + +void HelpPlugin::indexingFinished() +{ + m_progress.reportFinished(); +} + HelpViewer* HelpPlugin::viewerForContextMode() { using namespace Core; diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 645dd08a9c92d75ee04bc599bf0a29fcc29ddfbf..c5781c8a6f10f169ae03263321fb70db1cf2dc3a 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -31,6 +31,8 @@ #include <extensionsystem/iplugin.h> +#include <QtCore/QFutureInterface> +#include <QtCore/QFutureWatcher> #include <QtCore/QMap> #include <QtCore/QStringList> @@ -129,6 +131,9 @@ private slots: void removeViewerFromComboBox(int index); void updateViewerComboBoxIndex(int index); + void indexingStarted(); + void indexingFinished(); + private: bool updateDocumentation(); @@ -169,6 +174,9 @@ private: HelpManager *helpManager; QStringList filesToRegister; + + QFutureWatcher<void> m_watcher; + QFutureInterface<void> m_progress; }; } // namespace Internal