+QString DolphinSortFilterProxyModel::tagsForIndex(const QModelIndex& index)
+{
+#ifdef HAVE_NEPOMUK
+ QString tagsString;
+
+ const KDirModel* dirModel = static_cast<const KDirModel*>(index.model());
+ KFileItem* item = dirModel->itemForIndex(index);
+ if (item != 0) {
+ const Nepomuk::Resource resource(item->url().url(), Nepomuk::NFO::File());
+ const QList<Nepomuk::Tag> tags = resource.tags();
+ QStringList stringList;
+ foreach (const Nepomuk::Tag& tag, tags) {
+ stringList.append(tag.label());
+ }
+ stringList.sort();
+
+ foreach (const QString& str, stringList) {
+ tagsString += str;
+ tagsString += ' ';
+ }
+ }
+
+ if (tagsString.isEmpty()) {
+ tagsString = i18n("(no tags)");
+ }
+
+ return tagsString;
+#else
+ return QString();
+#endif
+}
+