mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
Dolphin Facet Widgets: Implement date based filtering
This required changes in Baloo which require reindexing. Since the storage location has changed for Beta 3 everyone should be re-indexing everything, so it won't be a problem.
This commit is contained in:
parent
53c48af236
commit
466868efa8
|
@ -111,6 +111,9 @@ DolphinFacetsWidget::~DolphinFacetsWidget()
|
|||
#ifdef HAVE_BALOO
|
||||
Baloo::Term DolphinFacetsWidget::ratingTerm() const
|
||||
{
|
||||
Baloo::Term ratingTerm;
|
||||
Baloo::Term modifiedTerm;
|
||||
|
||||
if (!m_anyRating->isChecked()) {
|
||||
int stars = 1; // represents m_oneOrMore
|
||||
if (m_twoOrMore->isChecked()) {
|
||||
|
@ -124,15 +127,9 @@ Baloo::Term DolphinFacetsWidget::ratingTerm() const
|
|||
}
|
||||
|
||||
const int rating = stars * 2;
|
||||
|
||||
Baloo::Term term("rating", rating, Baloo::Term::GreaterEqual);
|
||||
return term;
|
||||
ratingTerm = Baloo::Term("rating", rating, Baloo::Term::GreaterEqual);
|
||||
}
|
||||
|
||||
return Baloo::Term();
|
||||
|
||||
/*
|
||||
// FIXME: Handle date time filters
|
||||
if (!m_anytime->isChecked()) {
|
||||
QDate date = QDate::currentDate(); // represents m_today
|
||||
if (m_yesterday->isChecked()) {
|
||||
|
@ -145,12 +142,22 @@ Baloo::Term DolphinFacetsWidget::ratingTerm() const
|
|||
date = date.addDays(1 - date.dayOfYear());
|
||||
}
|
||||
|
||||
Nepomuk2::Query::ComparisonTerm term(Nepomuk2::Vocabulary::NIE::lastModified(),
|
||||
Nepomuk2::Query::LiteralTerm(QDateTime(date)),
|
||||
Nepomuk2::Query::ComparisonTerm::GreaterOrEqual);
|
||||
andTerm.addSubTerm(term);
|
||||
modifiedTerm = Baloo::Term("modified", date, Baloo::Term::GreaterEqual);
|
||||
}
|
||||
*/
|
||||
|
||||
if (ratingTerm.isValid() && modifiedTerm.isValid()) {
|
||||
Baloo::Term term(Baloo::Term::And);
|
||||
term.addSubTerm(ratingTerm);
|
||||
term.addSubTerm(modifiedTerm);
|
||||
|
||||
return term;
|
||||
} else if (modifiedTerm.isValid()) {
|
||||
return modifiedTerm;
|
||||
} else if (ratingTerm.isValid()) {
|
||||
return ratingTerm;
|
||||
}
|
||||
|
||||
return Baloo::Term();
|
||||
}
|
||||
|
||||
QStringList DolphinFacetsWidget::facetTypes() const
|
||||
|
|
|
@ -448,7 +448,7 @@ KUrl DolphinSearchBox::balooUrlForSearching() const
|
|||
if (m_contentButton->isChecked()) {
|
||||
query.setSearchString(text);
|
||||
} else {
|
||||
term.addSubTerm(Baloo::Term("filename", text));
|
||||
term.addSubTerm(Baloo::Term(QLatin1String("filename"), text));
|
||||
}
|
||||
|
||||
if (m_fromHereButton->isChecked()) {
|
||||
|
|
Loading…
Reference in a new issue