]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add option to sort for original date
authorJulian Schraner <juliquadrat@gmail.com>
Tue, 23 Jan 2018 23:32:51 +0000 (16:32 -0700)
committerNathaniel Graham <pointedstick@zoho.com>
Tue, 23 Jan 2018 23:33:30 +0000 (16:33 -0700)
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
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/kitemviews/private/kbaloorolesprovider.cpp

index fa98093b55bf85e91ee9242b11b2e7eb3c3f56be..5fa3e548c5989dd5df6ce56e867850a8bc3b6184 100644 (file)
@@ -80,7 +80,7 @@ QString KFileItemListWidgetInformant::roleText(const QByteArray& role,
             const KIO::filesize_t size = roleValue.value<KIO::filesize_t>();
             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 {
index 3947d37077a0be7a3b51e1578e1028b2a534c7b9..a5422a7bf5280f703002e5979c2cf58ef99c12f8 100644 (file)
@@ -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  },
index 8d721aa56caf7784d6d8a9a48be20984a5e5bd0a..4589b542241e8b65181bd8dffc09a764cf996796 100644 (file)
@@ -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:
index 314c2f06bcd23c48a050466063fb7d812073aefc..53fc0b3b9cac1d95540756cdeb4ed706ede102ee 100644 (file)
@@ -148,6 +148,7 @@ KBalooRolesProvider::KBalooRolesProvider() :
         { "lineCount",     "lineCount" },
         { "width",         "imageSize" },
         { "height",        "imageSize" },
+        { "imageDateTime",   "imageDateTime"},
         { "nexif.orientation", "orientation", },
         { "artist",     "artist" },
         { "genre",     "genre"  },