+ return containsModified || containsRating;
+}
+
+void DolphinFacetsWidget::setRatingTerm(const QString& term)
+{
+ // If term has sub terms, then the sub terms are always "rating" and "modified" terms.
+ // If term has no sub terms, then the term itself is either a "rating" term or a "modified"
+ // term. To avoid code duplication we add term to subTerms list, if the list is empty.
+ QStringList subTerms = term.split(' ', QString::SkipEmptyParts);
+
+ foreach (const QString& subTerm, subTerms) {
+ if (subTerm.startsWith(QLatin1String("modified>="))) {
+ const QString value = subTerm.mid(10);
+ const QDate date = QDate::fromString(value, Qt::ISODate);
+ setTimespan(date);
+ } else if (subTerm.startsWith(QLatin1String("rating>="))) {
+ const QString value = subTerm.mid(8);
+ const int stars = value.toInt() / 2;
+ setRating(stars);
+ }