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/panels/search/searchpanel.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/panels/search/searchpanel.cpp')
| -rw-r--r-- | src/panels/search/searchpanel.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/panels/search/searchpanel.cpp b/src/panels/search/searchpanel.cpp index 715f683a4..bfcaeacb7 100644 --- a/src/panels/search/searchpanel.cpp +++ b/src/panels/search/searchpanel.cpp @@ -72,8 +72,16 @@ bool SearchPanel::urlChanged() } if (isVisible() && DolphinSearchInformation::instance().isIndexingEnabled()) { - setQuery(Nepomuk::Query::Query()); + const Nepomuk::Query::FileQuery query(m_unfacetedRestQuery && m_facetWidget->queryTerm()); + if (query.toSearchUrl() == url()) { + // The new URL has been triggered by the SearchPanel itself in + // slotQueryTermChanged() and no further handling is required. + return true; + } + // Reset the current query and disable the facet-widget until + // the new query has been determined by KIO::stat(): + setQuery(Nepomuk::Query::Query()); delete m_lastSetUrlStatJob; m_lastSetUrlStatJob = KIO::stat(url(), KIO::HideProgressInfo); @@ -178,9 +186,12 @@ void SearchPanel::slotSetUrlStatFinished(KJob* job) const KIO::UDSEntry uds = static_cast<KIO::StatJob*>(job)->statResult(); const QString nepomukQueryStr = uds.stringValue(KIO::UDSEntry::UDS_NEPOMUK_QUERY); + const Nepomuk::Query::Term facetQueryTerm = m_facetWidget->queryTerm(); Nepomuk::Query::FileQuery nepomukQuery; if (!nepomukQueryStr.isEmpty()) { - nepomukQuery = Nepomuk::Query::Query::fromString(nepomukQueryStr); + // Always merge the query that has been retrieved by SearchPanel::setUrl() with + // the current facet-query, so that the user settings don't get lost. + nepomukQuery = Nepomuk::Query::Query::fromString(nepomukQueryStr) && facetQueryTerm; } else if (url().isLocalFile()) { // Fallback query for local file URLs: List all files Nepomuk::Query::ComparisonTerm compTerm( @@ -192,7 +203,13 @@ void SearchPanel::slotSetUrlStatFinished(KJob* job) } nepomukQuery.setTerm(compTerm); } + setQuery(nepomukQuery); + + if (facetQueryTerm.isValid()) { + Nepomuk::Query::FileQuery query(m_unfacetedRestQuery && facetQueryTerm); + emit urlActivated(query.toSearchUrl()); + } } void SearchPanel::slotQueryTermChanged(const Nepomuk::Query::Term& term) |
