From 2257b94e4fc425a62bcdc065791566a20c517052 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 9 Feb 2016 22:11:00 +0100 Subject: [PATCH] Support KFileMetadata OriginUrl as "Downloaded From" This brings back the functionality to show where a file originally was downloaded from using xattr originUrl. REVIEW: 126927 --- src/kitemviews/kfileitemmodel.cpp | 2 +- src/kitemviews/kfileitemmodel.h | 2 +- src/kitemviews/private/kbaloorolesprovider.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 5f6fed0dcb..b8b39603c3 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -2200,7 +2200,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { "track", TrackRole, I18N_NOOP2_NOSTRIP("@label", "Track"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true }, { "path", PathRole, I18N_NOOP2_NOSTRIP("@label", "Path"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, { "destination", DestinationRole, I18N_NOOP2_NOSTRIP("@label", "Link Destination"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, - { "copiedFrom", CopiedFromRole, I18N_NOOP2_NOSTRIP("@label", "Copied From"), I18N_NOOP2_NOSTRIP("@label", "Other"), true, false }, + { "originUrl", OriginUrlRole, I18N_NOOP2_NOSTRIP("@label", "Downloaded From"), I18N_NOOP2_NOSTRIP("@label", "Other"), true, false }, { "permissions", PermissionsRole, I18N_NOOP2_NOSTRIP("@label", "Permissions"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, { "owner", OwnerRole, I18N_NOOP2_NOSTRIP("@label", "Owner"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, { "group", GroupRole, I18N_NOOP2_NOSTRIP("@label", "User Group"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false }, diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 167f508cff..e06313aa92 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -285,7 +285,7 @@ private: // User visible roles available with Baloo: CommentRole, TagsRole, RatingRole, ImageSizeRole, OrientationRole, WordCountRole, LineCountRole, ArtistRole, AlbumRole, DurationRole, TrackRole, - CopiedFromRole, + OriginUrlRole, // Non-visible roles: IsDirRole, IsLinkRole, IsExpandedRole, IsExpandableRole, ExpandedParentsCountRole, // Mandatory last entry: diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index 920ce0671d..b494994830 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -109,6 +109,9 @@ QHash KBalooRolesProvider::roleValues(const Baloo::File& f if (roles.contains("comment")) { values.insert("comment", md.userComment()); } + if (roles.contains("originUrl")) { + values.insert("originUrl", md.originUrl()); + } return values; } @@ -143,8 +146,8 @@ KBalooRolesProvider::KBalooRolesProvider() : { "artist", "artist" }, { "album", "album" }, { "duration", "duration" }, - { "trackNumber", "track" } - // { "http://www.semanticdesktop.org/ontologies/2010/04/30/ndo#copiedFrom", "copiedFrom" } + { "trackNumber", "track" }, + { "originUrl", "originUrl" } }; for (unsigned int i = 0; i < sizeof(propertyInfoList) / sizeof(PropertyInfo); ++i) {