mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
style: move functions around
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user