┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
diff options
context:
space:
mode:
authorJulian Schraner <[email protected]>2018-04-01 11:26:49 -0600
committerNathaniel Graham <[email protected]>2018-04-01 11:27:44 -0600
commit1441fefc07f126c1c9eddc3e9f1babff8b762b28 (patch)
treefbd20b104e95874d6d766814c47d3ebfdfa364df /src/kitemviews/kfileitemmodel.cpp
parent6f3b0e3d00e12c8f6d6cbc3953ee31d3c4cfa7c7 (diff)
Split Image Size into Width/Height
Summary: This patch splits the single property "Image Size" into "Width" and "Height", providing more fine-tuned control for power users. FEATURE: 374559 Test Plan: - Sorting works correctly - No real change, only exposed differently Reviewers: #dolphin, elvisangelaccio, ngraham Reviewed By: #dolphin, elvisangelaccio, ngraham Subscribers: ngraham, elvisangelaccio Differential Revision: https://phabricator.kde.org/D11816
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index b6a001642..844954d6a 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -1846,16 +1846,10 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
break;
}
- case RatingRole: {
- result = a->values.value("rating").toInt() - b->values.value("rating").toInt();
- break;
- }
-
- case ImageSizeRole: {
- // Alway use a natural comparing to interpret the numbers of a string like
- // "1600 x 1200" for having a correct sorting.
- result = collator.compare(a->values.value("imageSize").toString(),
- b->values.value("imageSize").toString());
+ case RatingRole:
+ case WidthRole:
+ case HeightRole: {
+ result = a->values.value(roleForType(m_sortRole)).toInt() - b->values.value(roleForType(m_sortRole)).toInt();
break;
}
@@ -2305,7 +2299,8 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count)
{ "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 },
+ { "width", WidthRole, I18N_NOOP2_NOSTRIP("@label", "Width"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true },
+ { "height", HeightRole, I18N_NOOP2_NOSTRIP("@label", "Height"), 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 },
{ "genre", GenreRole, I18N_NOOP2_NOSTRIP("@label", "Genre"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },