diff options
| author | Vishesh Handa <[email protected]> | 2015-05-05 16:32:23 +0200 |
|---|---|---|
| committer | Vishesh Handa <[email protected]> | 2015-05-11 10:31:49 +0200 |
| commit | 9d4ad66abeb77072135a409c33c745f680856332 (patch) | |
| tree | eca01b817ba02c0d1cee59ba1d8121df8218d94e /src/search/dolphinsearchbox.cpp | |
| parent | e69d3489751ea15c0477fe1d41fcc252c775d377 (diff) | |
Move away from Baloo::Term
Baloo is set to become a framework and wants to only export the bare
minimum number of classes as it will need to provide ABI + API
guarentees forever. The Term class is now no longer exported. It can be
added back again.
REVIEW: 123643
Diffstat (limited to 'src/search/dolphinsearchbox.cpp')
| -rw-r--r-- | src/search/dolphinsearchbox.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index b67d1e65f..fca9b6be3 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -441,24 +441,23 @@ QUrl DolphinSearchBox::balooUrlForSearching() const Baloo::Query query; query.addType(m_facetsWidget->facetType()); - Baloo::Term term(Baloo::Term::And); - - Baloo::Term ratingTerm = m_facetsWidget->ratingTerm(); - if (ratingTerm.isValid()) { - term.addSubTerm(ratingTerm); + QStringList queryStrings; + QString ratingQuery = m_facetsWidget->ratingTerm(); + if (!ratingQuery.isEmpty()) { + queryStrings << ratingQuery; } if (m_contentButton->isChecked()) { - query.setSearchString(text); + queryStrings << text; } else if (!text.isEmpty()) { - term.addSubTerm(Baloo::Term(QLatin1String("filename"), text)); + queryStrings << QString::fromLatin1("filename:\"%1\"").arg(text); } if (m_fromHereButton->isChecked()) { query.setIncludeFolder(m_searchPath.toLocalFile()); } - query.setTerm(term); + query.setSearchString(queryStrings.join(" ")); return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", "Query Results from '%1'", text)); @@ -471,7 +470,6 @@ void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url) { #ifdef HAVE_BALOO const Baloo::Query query = Baloo::Query::fromSearchUrl(url); - const Baloo::Term term = query.term(); // Block all signals to avoid unnecessary "searchRequest" signals // while we adjust the search text and the facet widget. @@ -491,11 +489,11 @@ void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url) m_facetsWidget->setFacetType(types.first()); } - foreach (const Baloo::Term& subTerm, term.subTerms()) { - const QString property = subTerm.property(); - - if (property == QLatin1String("filename")) { - setText(subTerm.value().toString()); + const QStringList subTerms = query.searchString().split(' ', QString::SkipEmptyParts); + foreach (const QString& subTerm, subTerms) { + if (subTerm.startsWith("filename:")) { + const QString value = subTerm.mid(9); + setText(value); } else if (m_facetsWidget->isRatingTerm(subTerm)) { m_facetsWidget->setRatingTerm(subTerm); } |
