┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2022-05-30 23:26:09 +0200
committerMéven Car <[email protected]>2022-05-31 12:21:04 +0000
commit573abcaf25f4629725eafe0282e809e47df1ead3 (patch)
tree55b8bb89e4c610834e9783714cb42d3d04e45cb1
parent7b48a8b6e4282ca3b8571db42b5d0ec9538cfc84 (diff)
kfileitemmodel: sortRoleCompare: allow to sort by access time.
We had all sorts of weird behavior when sorting by access time. The comparison was simply missing in sortRoleCompare.
-rw-r--r--src/kitemviews/kfileitemmodel.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 0f5cffed1..b1a70f6fa 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -2067,6 +2067,17 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
break;
}
+ case AccessTimeRole: {
+ const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1);
+ const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_ACCESS_TIME, -1);
+ if (dateTimeA < dateTimeB) {
+ return -1;
+ } else if (dateTimeA > dateTimeB) {
+ return +1;
+ }
+ break;
+ }
+
case CreationTimeRole: {
const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1);
const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1);