From ea6a2424fb454eafb80a731e5fdce4e4a50cb606 Mon Sep 17 00:00:00 2001 From: Julian Schraner Date: Tue, 23 Jan 2018 16:32:51 -0700 Subject: [PATCH] Add option to sort for original date Summary: Takes the original date a photo was taken out of the data provided by Baloo & makes it available to the user FEATURE: 303645 {F5671033} Test Plan: - Works with a batch of time-tagged photos - Can be hidden/shown/sorted like any other property Reviewers: #dolphin, ngraham, elvisangelaccio Reviewed By: #dolphin, ngraham, elvisangelaccio Subscribers: elvisangelaccio, ngraham Differential Revision: https://phabricator.kde.org/D10059 --- src/kitemviews/kfileitemlistwidget.cpp | 2 +- src/kitemviews/kfileitemmodel.cpp | 1 + src/kitemviews/kfileitemmodel.h | 2 +- src/kitemviews/private/kbaloorolesprovider.cpp | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index fa98093b55..5fa3e548c5 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -80,7 +80,7 @@ QString KFileItemListWidgetInformant::roleText(const QByteArray& role, const KIO::filesize_t size = roleValue.value(); text = KFormat().formatByteSize(size); } - } else if (role == "modificationtime" || role == "accesstime" || role == "deletiontime") { + } else if (role == "modificationtime" || role == "accesstime" || role == "deletiontime" || role == "imageDateTime") { const QDateTime dateTime = roleValue.toDateTime(); text = QLocale().toString(dateTime, QLocale::ShortFormat); } else { diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 3947d37077..a5422a7bf5 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -2312,6 +2312,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { "title", TitleRole, I18N_NOOP2_NOSTRIP("@label", "Title"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, { "wordCount", WordCountRole, I18N_NOOP2_NOSTRIP("@label", "Word Count"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, { "lineCount", LineCountRole, I18N_NOOP2_NOSTRIP("@label", "Line Count"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, + { "imageDateTime", ImageDateTimeRole, I18N_NOOP2_NOSTRIP("@label", "Date Photographed"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true }, { "imageSize", ImageSizeRole, I18N_NOOP2_NOSTRIP("@label", "Image Size"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true }, { "orientation", OrientationRole, I18N_NOOP2_NOSTRIP("@label", "Orientation"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true }, { "artist", ArtistRole, I18N_NOOP2_NOSTRIP("@label", "Artist"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true }, diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 8d721aa56c..4589b54224 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -285,7 +285,7 @@ private: NoRole, NameRole, SizeRole, ModificationTimeRole, CreationTimeRole, AccessTimeRole, PermissionsRole, OwnerRole, GroupRole, TypeRole, DestinationRole, PathRole, DeletionTimeRole, // User visible roles available with Baloo: - CommentRole, TagsRole, RatingRole, ImageSizeRole, OrientationRole, + CommentRole, TagsRole, RatingRole, ImageSizeRole, ImageDateTimeRole, OrientationRole, WordCountRole, TitleRole, LineCountRole, ArtistRole, GenreRole, AlbumRole, DurationRole, TrackRole, ReleaseYearRole, BitrateRole, OriginUrlRole, // Non-visible roles: diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index 314c2f06bc..53fc0b3b9c 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -148,6 +148,7 @@ KBalooRolesProvider::KBalooRolesProvider() : { "lineCount", "lineCount" }, { "width", "imageSize" }, { "height", "imageSize" }, + { "imageDateTime", "imageDateTime"}, { "nexif.orientation", "orientation", }, { "artist", "artist" }, { "genre", "genre" },