From 777caf77575ae3d8ec4fe524e0d3f8acda3365ca Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Mon, 5 Dec 2011 21:07:22 +0100 Subject: [PATCH] Don't start a global search if text is empty; start otherwise, even for short queries (cherry picked from commit 99bcb5c2a2921f54a515fbf2f286d31f69b5345a) --- src/globalsearch/globalsearchwidget.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/globalsearch/globalsearchwidget.cpp b/src/globalsearch/globalsearchwidget.cpp index 8f73dcf13..067a0d535 100644 --- a/src/globalsearch/globalsearchwidget.cpp +++ b/src/globalsearch/globalsearchwidget.cpp @@ -225,12 +225,6 @@ void GlobalSearchWidget::TextEdited(const QString& text) { const QString trimmed_text = text.trimmed(); closed_since_search_began_ = false; - if (trimmed_text.length() < 3) { - RepositionPopup(); - last_id_ = -1; - return; - } - // Add results to the back model, switch models after some delay. back_model_->clear(); combine_cache_[back_model_]->Clear(); @@ -241,6 +235,11 @@ void GlobalSearchWidget::TextEdited(const QString& text) { // Cancel the last search (if any) and start the new one. engine_->CancelSearch(last_id_); + // If text query is empty, don't start a new search + if (trimmed_text.isEmpty()) { + last_id_ = -1; + return; + } last_id_ = engine_->SearchAsync(trimmed_text); }