diff options
| author | Peter Penz <[email protected]> | 2007-06-22 16:42:34 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-06-22 16:42:34 +0000 |
| commit | 743590a944bfce0d886a372a0e8a99e6a88593b3 (patch) | |
| tree | 36c1d6b6c96e848be3de72b55249538bbf94e0ed /src/dolphinitemcategorizer.cpp | |
| parent | b22d9b7b9c72749ec245ff55d8d90989428067fc (diff) | |
Implement sorting by "tags". Same performance problems occur as when using sorting by "rating", but we must get a feeling first how we use the Nepomuk API before thinking about caching...
svn path=/trunk/KDE/kdebase/apps/; revision=678957
Diffstat (limited to 'src/dolphinitemcategorizer.cpp')
| -rw-r--r-- | src/dolphinitemcategorizer.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/dolphinitemcategorizer.cpp b/src/dolphinitemcategorizer.cpp index a6d329f6d..c83f9383f 100644 --- a/src/dolphinitemcategorizer.cpp +++ b/src/dolphinitemcategorizer.cpp @@ -21,6 +21,7 @@ #include "dolphinitemcategorizer.h" #include "dolphinview.h" +#include "dolphinsortfilterproxymodel.h" #ifdef HAVE_NEPOMUK #include <config-nepomuk.h> @@ -34,7 +35,8 @@ #include <klocale.h> #include <kurl.h> -#include <QtGui/QSortFilterProxyModel> +#include <QList> +#include <QSortFilterProxyModel> DolphinItemCategorizer::DolphinItemCategorizer() : KItemCategorizer() @@ -164,19 +166,19 @@ QString DolphinItemCategorizer::categoryForItem(const QModelIndex& index, #ifdef HAVE_NEPOMUK case DolphinView::SortByRating: { - KFileItem* item = dirModel->itemForIndex(index); - if (item != 0) { - const Nepomuk::Resource resource(item->url().url(), Nepomuk::NFO::File()); - const quint32 rating = resource.rating(); - if (!rating) - retString = i18n("Not yet rated"); - else - retString = i18np("1 star", "%1 stars", rating); + const quint32 rating = DolphinSortFilterProxyModel::ratingForIndex(index); + if (rating) { + retString = i18np("1 star", "%1 stars", rating); + } else { + retString = i18n("Not yet rated"); } break; } - case DolphinView::SortByTags: + + case DolphinView::SortByTags: { + retString = DolphinSortFilterProxyModel::tagsForIndex(index); break; + } #endif } |
