diff options
| author | Méven Car <[email protected]> | 2022-05-30 23:26:09 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2022-05-31 12:21:04 +0000 |
| commit | 573abcaf25f4629725eafe0282e809e47df1ead3 (patch) | |
| tree | 55b8bb89e4c610834e9783714cb42d3d04e45cb1 /src | |
| parent | 7b48a8b6e4282ca3b8571db42b5d0ec9538cfc84 (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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 11 |
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); |
