diff options
| author | Peter Penz <[email protected]> | 2011-03-10 19:55:00 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-03-10 19:58:26 +0100 |
| commit | 6e0583f9888fcf46bb89735423b02b5ca53f1459 (patch) | |
| tree | cdb66ef20c02223a2e917479c101b4784f09d16c /src/search/dolphinsearchbox.cpp | |
| parent | 1aa14306fc8429e718a5015044cb98fb61cfd318 (diff) | |
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...
Diffstat (limited to 'src/search/dolphinsearchbox.cpp')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
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()); } } |
