diff --git a/frontend/apps/filemanager/filemanagerhistory.lua b/frontend/apps/filemanager/filemanagerhistory.lua index 7ff646cf5..7dfe9c076 100644 --- a/frontend/apps/filemanager/filemanagerhistory.lua +++ b/frontend/apps/filemanager/filemanagerhistory.lua @@ -20,6 +20,40 @@ function FileManagerHistory:init() self.ui.menu:registerToMainMenu(self) end +function FileManagerHistory:addToMainMenu(tab_item_table) + -- insert table to info tab of filemanager menu + table.insert(tab_item_table.info, { + text = self.hist_menu_title, + callback = function() + self:onShowHist() + end, + }) +end + +function FileManagerHistory:updateItemTable() + local ReaderUI = require("apps/reader/readerui") + self.hist = {} + + for f in lfs.dir(history_dir) do + local path = joinPath(history_dir, f) + if lfs.attributes(path, "mode") == "file" then + local name = DocSettings:getNameFromHistory(f) + table.insert(self.hist, { + date = lfs.attributes(path, "modification"), + text = name, + histfile = f, + callback = function() + ReaderUI:showReader( + DocSettings:getPathFromHistory(f).. "/" .. name) + end + }) + end + end + table.sort(self.hist, function(v1, v2) return v1.date > v2.date end) + + self.hist_menu:swithItemTable(self.hist_menu_title, self.hist) +end + function FileManagerHistory:onSetDimensions(dimen) self.dimen = dimen end @@ -68,38 +102,4 @@ function FileManagerHistory:onShowHist() return true end -function FileManagerHistory:addToMainMenu(tab_item_table) - -- insert table to info tab of filemanager menu - table.insert(tab_item_table.info, { - text = self.hist_menu_title, - callback = function() - self:onShowHist() - end, - }) -end - -function FileManagerHistory:updateItemTable() - local ReaderUI = require("apps/reader/readerui") - self.hist = {} - - for f in lfs.dir(history_dir) do - local path = joinPath(history_dir, f) - if lfs.attributes(path, "mode") == "file" then - local name = DocSettings:getNameFromHistory(f) - table.insert(self.hist, { - date = lfs.attributes(path, "modification"), - text = name, - histfile = f, - callback = function() - ReaderUI:showReader( - DocSettings:getPathFromHistory(f).. "/" .. name) - end - }) - end - end - table.sort(self.hist, function(v1, v2) return v1.date > v2.date end) - - self.hist_menu:swithItemTable(self.hist_menu_title, self.hist) -end - return FileManagerHistory diff --git a/frontend/apps/reader/modules/readermenu.lua b/frontend/apps/reader/modules/readermenu.lua index 19f2bd58a..0d4724290 100644 --- a/frontend/apps/reader/modules/readermenu.lua +++ b/frontend/apps/reader/modules/readermenu.lua @@ -16,18 +16,18 @@ local ReaderMenu = InputContainer:new{ function ReaderMenu:init() self.tab_item_table = { - setting = { - icon = "resources/icons/appbar.settings.png", - }, navi = { icon = "resources/icons/appbar.page.corner.bookmark.png", }, - info = { - icon = "resources/icons/appbar.pokeball.png", - }, typeset = { icon = "resources/icons/appbar.page.text.png", }, + setting = { + icon = "resources/icons/appbar.settings.png", + }, + info = { + icon = "resources/icons/appbar.pokeball.png", + }, plugins = { icon = "resources/icons/appbar.tools.png", },