mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
FileChooser: re-add file sort by "last date read" (#10682)
Revert bits from eb299c30.
This commit is contained in:
@@ -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 "–"
|
||||
|
||||
Reference in New Issue
Block a user