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.
This commit is contained in:
Méven Car 2022-05-30 23:26:09 +02:00 committed by Méven Car
parent 7b48a8b6e4
commit 573abcaf25

View file

@ -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);