diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-03-17 15:08:25 +0100 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-03-17 15:08:25 +0100 |
commit | b26792217337bf738edfbb98016038b6c535ff77 (patch) | |
tree | cc10cfa280841630cc2d3b2dc1c6e69cb1439887 /src/plugins/qmljseditor | |
parent | 562a619721a3c2f8065b21450d780bc336405dad (diff) | |
download | qt-creator-b26792217337bf738edfbb98016038b6c535ff77.tar.gz |
QmlJS find usages: Don't pop up a result window if we don't search.
Task-number: QTCREATORBUG-4090
Diffstat (limited to 'src/plugins/qmljseditor')
-rw-r--r-- | src/plugins/qmljseditor/qmljsfindreferences.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp index 069edae3d4..6408dc22a5 100644 --- a/src/plugins/qmljseditor/qmljsfindreferences.cpp +++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp @@ -645,6 +645,10 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future, if (!scope) return; + // report a dummy usage to indicate the search is starting + FindReferences::Usage usage; + future.reportResult(usage); + QStringList files; foreach (const Document::Ptr &doc, snapshot) { // ### skip files that don't contain the name token @@ -663,18 +667,11 @@ static void find_helper(QFutureInterface<FindReferences::Usage> &future, void FindReferences::findUsages(const QString &fileName, quint32 offset) { - Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchOnly); - - connect(search, SIGNAL(activated(Find::SearchResultItem)), - this, SLOT(openEditor(Find::SearchResultItem))); - findAll_helper(fileName, offset); } void FindReferences::findAll_helper(const QString &fileName, quint32 offset) { - _resultWindow->popup(true); - ModelManagerInterface *modelManager = ModelManagerInterface::instance(); @@ -682,16 +679,26 @@ void FindReferences::findAll_helper(const QString &fileName, quint32 offset) &find_helper, modelManager->workingCopy(), modelManager->snapshot(), fileName, offset); m_watcher.setFuture(result); - - Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); - Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching"), - QmlJSEditor::Constants::TASK_SEARCH); - - connect(progress, SIGNAL(clicked()), _resultWindow, SLOT(popup())); } void FindReferences::displayResults(int first, int last) { + // the first usage is always a dummy to indicate we now start searching + if (first == 0) { + Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchOnly); + connect(search, SIGNAL(activated(Find::SearchResultItem)), + this, SLOT(openEditor(Find::SearchResultItem))); + _resultWindow->popup(true); + + Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); + Core::FutureProgress *progress = progressManager->addTask( + m_watcher.future(), tr("Searching"), + QmlJSEditor::Constants::TASK_SEARCH); + connect(progress, SIGNAL(clicked()), _resultWindow, SLOT(popup())); + + ++first; + } + for (int index = first; index != last; ++index) { Usage result = m_watcher.future().resultAt(index); _resultWindow->addResult(result.path, |