return item->item.time(KFileItem::ModificationTime);
});
break;
+ case CreationTimeRole:
+ m_groups = timeRoleGroups([](const ItemData *item) {
+ return item->item.time(KFileItem::CreationTime);
+ });
+ break;
case AccessTimeRole:
m_groups = timeRoleGroups([](const ItemData *item) {
return item->item.time(KFileItem::AccessTime);
data.insert(sharedValue("modificationtime"), dateTime);
}
+ if (m_requestRole[CreationTimeRole]) {
+ // Don't use KFileItem::timeString() as this is too expensive when
+ // having several thousands of items. Instead the formatting of the
+ // date-time will be done on-demand by the view when the date will be shown.
+ const QDateTime dateTime = item.time(KFileItem::CreationTime);
+ data.insert(sharedValue("creationtime"), dateTime);
+ }
+
if (m_requestRole[AccessTimeRole]) {
// Don't use KFileItem::timeString() as this is too expensive when
// having several thousands of items. Instead the formatting of the
break;
}
+ case CreationTimeRole: {
+ const QDateTime dateTimeA = itemA.time(KFileItem::CreationTime);
+ const QDateTime dateTimeB = itemB.time(KFileItem::CreationTime);
+ if (dateTimeA < dateTimeB) {
+ result = -1;
+ } else if (dateTimeA > dateTimeB) {
+ result = +1;
+ }
+ break;
+ }
+
case DeletionTimeRole: {
const QDateTime dateTimeA = a->values.value("deletiontime").toDateTime();
const QDateTime dateTimeB = b->values.value("deletiontime").toDateTime();
{ "text", NameRole, I18N_NOOP2_NOSTRIP("@label", "Name"), 0, 0, false, false },
{ "size", SizeRole, I18N_NOOP2_NOSTRIP("@label", "Size"), 0, 0, false, false },
{ "modificationtime", ModificationTimeRole, I18N_NOOP2_NOSTRIP("@label", "Modified"), 0, 0, false, false },
+ { "creationtime", CreationTimeRole, I18N_NOOP2_NOSTRIP("@label", "Created"), 0, 0, false, false },
{ "accesstime", AccessTimeRole, I18N_NOOP2_NOSTRIP("@label", "Accessed"), 0, 0, false, false },
{ "type", TypeRole, I18N_NOOP2_NOSTRIP("@label", "Type"), 0, 0, false, false },
{ "rating", RatingRole, I18N_NOOP2_NOSTRIP("@label", "Rating"), 0, 0, true, false },