diff --git a/frontend/apps/filemanager/filemanagerhistory.lua b/frontend/apps/filemanager/filemanagerhistory.lua index 0174a6269..b86154799 100644 --- a/frontend/apps/filemanager/filemanagerhistory.lua +++ b/frontend/apps/filemanager/filemanagerhistory.lua @@ -4,6 +4,7 @@ local Menu = require("ui/widget/menu") local Screen = require("ui/screen") local UIManager = require("ui/uimanager") local DocSettings = require("docsettings") +local DEBUG = require("dbg") local _ = require("gettext") local FileManagerHistory = InputContainer:extend{ @@ -55,22 +56,27 @@ function FileManagerHistory:addToMainMenu(tab_item_table) end function FileManagerHistory:updateItemTable() - function readHistDir(order_arg, re) - for f in lfs.dir("./history") do - local filemode = lfs.attributes(f, "mode") - - if filemode ~= "directory" then -- we can't use filemode == "file" here, when it should be "file" it is actually nil, weird - table.insert(re, { - dir = DocSettings:getPathFromHistory(f), - name = DocSettings:getNameFromHistory(f), - }) - end + function readHistDir(re) + local sorted_files = {} + local history_dir = "./history/" + for f in lfs.dir(history_dir) do + local path = history_dir..f + if lfs.attributes(path, "mode") == "file" then + table.insert(sorted_files, {file = f, date = lfs.attributes(path, "modification")}) + end + end + table.sort(sorted_files, function(v1,v2) return v1.date > v2.date end) + for _, v in pairs(sorted_files) do + table.insert(re, { + dir = DocSettings:getPathFromHistory(v.file), + name = DocSettings:getNameFromHistory(v.file), + }) end end self.hist = {} local last_files = {} - readHistDir("-c", last_files) + readHistDir(last_files) for _,v in pairs(last_files) do table.insert(self.hist, { text = v.name, @@ -81,4 +87,4 @@ function FileManagerHistory:updateItemTable() end end -return FileManagerHistory +return FileManagerHistory \ No newline at end of file diff --git a/frontend/ui/device.lua b/frontend/ui/device.lua index 8b5536ca9..b1b125151 100644 --- a/frontend/ui/device.lua +++ b/frontend/ui/device.lua @@ -46,7 +46,7 @@ function Device:getModel() local k4_set = Set { "0E", "23" } local touch_set = Set { "0F", "11", "10", "12" } local pw_set = Set { "24", "1B", "1D", "1F", "1C", "20" } - local pw2_set = Set { "D4", "5A", "D5" } + local pw2_set = Set { "D4", "5A", "D5", "D7", "D8", "F2" } if k2_set[kindle_devcode] then self.model = "Kindle2" diff --git a/koreader-base b/koreader-base index 730c13093..ff2c9a2b0 160000 --- a/koreader-base +++ b/koreader-base @@ -1 +1 @@ -Subproject commit 730c130930e758b3d838687ad03ba9607731d655 +Subproject commit ff2c9a2b02f73b7d3467040696777fb72f510d04