FileChooser: re-add file sort by "last date read" (#10682)

Revert bits from eb299c30.
reviewable/pr10689/r1
Glen Sawyer 10 months ago committed by GitHub
parent d0e705a582
commit 73c4f09a88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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" },

@ -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 ""

Loading…
Cancel
Save