diff options
| author | Peter Penz <[email protected]> | 2009-11-13 23:21:47 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-11-13 23:21:47 +0000 |
| commit | 041a2f059422d6e7b600510a086a3527f3b5dd1c (patch) | |
| tree | ec2aad61a3483bb29287d14ce3f781060c39b25e /src/search/searchcriterionselector.cpp | |
| parent | 3d7b54b21a47e98d1d02c7d21061a6bd43b8d1c7 (diff) | |
* allow searching for ratings
* minor general cleanups
svn path=/trunk/KDE/kdebase/apps/; revision=1048809
Diffstat (limited to 'src/search/searchcriterionselector.cpp')
| -rw-r--r-- | src/search/searchcriterionselector.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/search/searchcriterionselector.cpp b/src/search/searchcriterionselector.cpp index 104f83c1c..a0d7b73e7 100644 --- a/src/search/searchcriterionselector.cpp +++ b/src/search/searchcriterionselector.cpp @@ -91,7 +91,14 @@ QString SearchCriterionSelector::toString() const QString criterion = comp.prefix + descr.identifier() + comp.operation; if (!m_valueWidget->value().isEmpty()) { - criterion += '"' + m_valueWidget->value() + '"'; + const QString value = m_valueWidget->value(); + if (value.contains(' ')) { + criterion += '"' + value + '"'; + } else { + // Don't surround the value by " if no space is part of the value. + // This increases the readability of the search-URL. + criterion += value; + } } return criterion; } @@ -173,6 +180,8 @@ void SearchCriterionSelector::createDescriptions() "lastModified", dateComps, dateValue); + Q_ASSERT(static_cast<int>(SearchCriterionSelector::Date) == 0); + m_descriptions.append(date); // add "Size" description QList<SearchCriterionDescription::Comparator> sizeComps = defaultComps; @@ -184,11 +193,14 @@ void SearchCriterionSelector::createDescriptions() "contentSize", sizeComps, sizeValue); + Q_ASSERT(static_cast<int>(SearchCriterionSelector::Size) == 1); + m_descriptions.append(size); // add "Tag" description QList<SearchCriterionDescription::Comparator> tagComps; tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label All (tags)", "All"))); - tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Equal to"), ":")); + tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Equal to"), ":", "+")); + tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Not Equal to"), ":", "-")); TagValue* tagValue = new TagValue(this); tagValue->hide(); @@ -196,14 +208,22 @@ void SearchCriterionSelector::createDescriptions() "tag", tagComps, tagValue); - - Q_ASSERT(static_cast<int>(SearchCriterionSelector::Date) == 0); - Q_ASSERT(static_cast<int>(SearchCriterionSelector::Size) == 1); Q_ASSERT(static_cast<int>(SearchCriterionSelector::Tag) == 2); - m_descriptions.append(date); - m_descriptions.append(size); m_descriptions.append(tag); + // add "Rating" description + QList<SearchCriterionDescription::Comparator> ratingComps = defaultComps; + ratingComps.insert(0, SearchCriterionDescription::Comparator(i18nc("@label Any (rating)", "Any"))); + + RatingValue* ratingValue = new RatingValue(this); + ratingValue->hide(); + SearchCriterionDescription rating(i18nc("@label", "Rating:"), + "rating", + ratingComps, + ratingValue); + Q_ASSERT(static_cast<int>(SearchCriterionSelector::Rating) == 3); + m_descriptions.append(rating); + // add all descriptions to the combo box and connect the value widgets int i = 0; foreach (const SearchCriterionDescription& desc, m_descriptions) { |
