diff --git a/frontend/apps/filemanager/filemanagermenu.lua b/frontend/apps/filemanager/filemanagermenu.lua index de3aa20e3..430a24ec3 100644 --- a/frontend/apps/filemanager/filemanagermenu.lua +++ b/frontend/apps/filemanager/filemanagermenu.lua @@ -844,6 +844,7 @@ function FileManagerMenu:getSortingMenuTable() local collates = { { _("name"), "strcoll" }, { _("name (natural sorting)"), "natural" }, + { _("last read date"), "access" }, { _("date modified"), "date" }, { _("size"), "size" }, { _("type"), "type" }, diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index e65046d28..0b9caa315 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -193,6 +193,10 @@ function FileChooser:getSortingFunction(collate, reverse_collate) sorting = function(a, b) return natsort(a.text, b.text) end + elseif collate == "access" then + sorting = function(a, b) + return a.attr.access > b.attr.access + end elseif collate == "date" then sorting = function(a, b) return a.attr.modification > b.attr.modification @@ -340,7 +344,9 @@ function FileChooser:getMenuItemMandatory(item, collate) local text if collate then -- file -- display the sorting parameter in mandatory - if collate == "date" then + if collate == "access" then + text = datetime.secondsToDateTime(item.attr.access) + elseif collate == "date" then text = datetime.secondsToDateTime(item.attr.modification) elseif collate == "percent_unopened_first" or collate == "percent_unopened_last" then text = item.opened and string.format("%d %%", 100 * item.percent_finished) or "–"