From 6e0583f9888fcf46bb89735423b02b5ca53f1459 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Thu, 10 Mar 2011 19:55:00 +0100 Subject: Fix some search issues - Always merge the query from the "Find:"-field with the current facet-query. This assures that the facet-query never gets overwritten if the user changes the "Find:"-field. - Always trigger a searching if the text of the "Find:"-field has been cleared. Still a lot of usability issues are left, but this is at least a first step... --- src/search/dolphinsearchbox.cpp | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'src/search/dolphinsearchbox.cpp') diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index dce47c469..8119e821f 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -205,11 +205,7 @@ void DolphinSearchBox::slotConfigurationChanged() void DolphinSearchBox::slotSearchTextChanged(const QString& text) { - if (text.isEmpty()) { - m_startSearchTimer->stop(); - } else { - m_startSearchTimer->start(); - } + m_startSearchTimer->start(); emit searchTextChanged(text); } @@ -355,23 +351,20 @@ KUrl DolphinSearchBox::nepomukUrlForSearching() const #ifdef HAVE_NEPOMUK Nepomuk::Query::AndTerm andTerm; - // Add input from search filter const QString text = m_searchInput->text(); - if (!text.isEmpty()) { - if (m_fileNameButton->isChecked()) { - QString regex = QRegExp::escape(text); - regex.replace("\\*", QLatin1String(".*")); - regex.replace("\\?", QLatin1String(".")); - regex.replace("\\", "\\\\"); - andTerm.addSubTerm(Nepomuk::Query::ComparisonTerm( - Nepomuk::Vocabulary::NFO::fileName(), - Nepomuk::Query::LiteralTerm(regex), - Nepomuk::Query::ComparisonTerm::Regexp)); - } else { - const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(text, Nepomuk::Query::QueryParser::DetectFilenamePattern); - if (customQuery.isValid()) { - andTerm.addSubTerm(customQuery.term()); - } + if (m_fileNameButton->isChecked()) { + QString regex = QRegExp::escape(text); + regex.replace("\\*", QLatin1String(".*")); + regex.replace("\\?", QLatin1String(".")); + regex.replace("\\", "\\\\"); + andTerm.addSubTerm(Nepomuk::Query::ComparisonTerm( + Nepomuk::Vocabulary::NFO::fileName(), + Nepomuk::Query::LiteralTerm(regex), + Nepomuk::Query::ComparisonTerm::Regexp)); + } else { + const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(text, Nepomuk::Query::QueryParser::DetectFilenamePattern); + if (customQuery.isValid()) { + andTerm.addSubTerm(customQuery.term()); } } -- cgit v1.3