mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add option to load last opened file automatically
This commit is contained in:
@@ -60,12 +60,23 @@ function FileManagerMenu:setUpdateItemTable()
|
||||
end
|
||||
|
||||
table.insert(self.tab_item_table.main, {
|
||||
text = _("Toggle hidden files"),
|
||||
text = _("Show hidden files"),
|
||||
checked_func = function() return self.ui.file_chooser.show_hidden end,
|
||||
callback = function()
|
||||
self.ui:toggleHiddenFiles()
|
||||
end
|
||||
})
|
||||
|
||||
table.insert(self.tab_item_table.main, {
|
||||
text = _("Start with last opened file"),
|
||||
checked_func = function() return G_reader_settings:readSetting("open_last") end,
|
||||
enabled_func = function() return G_reader_settings:readSetting("lastfile") ~= nil end,
|
||||
callback = function()
|
||||
local open_last = G_reader_settings:readSetting("open_last") or false
|
||||
G_reader_settings:saveSetting("open_last", not open_last)
|
||||
end
|
||||
})
|
||||
|
||||
if Device:hasFrontlight() then
|
||||
ReaderFrontLight:addToMainMenu(self.tab_item_table)
|
||||
end
|
||||
|
||||
@@ -46,13 +46,29 @@ function TouchMenuItem:init()
|
||||
if self.item.enabled_func then
|
||||
item_enabled = self.item.enabled_func()
|
||||
end
|
||||
local item_checked = self.item.checked
|
||||
if self.item.checked_func then
|
||||
item_checked = self.item.checked_func()
|
||||
end
|
||||
local checked_widget = TextWidget:new{
|
||||
text = "√ ",
|
||||
face = self.face,
|
||||
}
|
||||
local unchecked_widget = TextWidget:new{
|
||||
text = "",
|
||||
face = self.face,
|
||||
}
|
||||
self.item_frame = FrameContainer:new{
|
||||
width = self.dimen.w,
|
||||
bordersize = 0,
|
||||
color = 15,
|
||||
HorizontalGroup:new {
|
||||
align = "center",
|
||||
HorizontalSpan:new{ width = 10 },
|
||||
HorizontalSpan:new{ width = Screen:scaleByDPI(5) },
|
||||
CenterContainer:new{
|
||||
dimen = Geom:new{ w = checked_widget:getSize().w },
|
||||
item_checked and checked_widget or unchecked_widget
|
||||
},
|
||||
TextWidget:new{
|
||||
text = self.item.text or self.item.text_func(),
|
||||
bgcolor = 0.0,
|
||||
|
||||
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/koreader/koreader-base/issues\n"
|
||||
"POT-Creation-Date: 2014-06-05 06:57+0000\n"
|
||||
"POT-Creation-Date: 2014-06-05 11:05+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -196,7 +196,7 @@ msgid ""
|
||||
"File does not exist"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:114
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:125
|
||||
msgid ""
|
||||
"File manager menu"
|
||||
msgstr ""
|
||||
@@ -251,7 +251,7 @@ msgid ""
|
||||
"Go to Page or Location"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:74
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:85
|
||||
#: frontend/apps/reader/modules/readermenu.lua:75
|
||||
msgid ""
|
||||
"Help"
|
||||
@@ -380,7 +380,7 @@ msgid ""
|
||||
"Page"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/ui/widget/touchmenu.lua:366
|
||||
#: frontend/ui/widget/touchmenu.lua:382
|
||||
msgid ""
|
||||
"Page "
|
||||
msgstr ""
|
||||
@@ -400,7 +400,7 @@ msgid ""
|
||||
"Paste"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:77
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:88
|
||||
#: frontend/apps/reader/modules/readermenu.lua:78
|
||||
msgid ""
|
||||
"Please report bugs to \n"
|
||||
@@ -472,11 +472,21 @@ msgid ""
|
||||
"Share"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:63
|
||||
msgid ""
|
||||
"Show hidden files"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/ui/uimanager.lua:298
|
||||
msgid ""
|
||||
"Standby"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:71
|
||||
msgid ""
|
||||
"Start with last opened file"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/reader/modules/readerzooming.lua:292
|
||||
msgid ""
|
||||
"Switch zoom mode"
|
||||
@@ -522,11 +532,6 @@ msgid ""
|
||||
"Toggle"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:63
|
||||
msgid ""
|
||||
"Toggle hidden files"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/reader/modules/readerhighlight.lua:312
|
||||
msgid ""
|
||||
"Translate"
|
||||
@@ -547,7 +552,7 @@ msgid ""
|
||||
"Underscore"
|
||||
msgstr ""
|
||||
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:82
|
||||
#: frontend/apps/filemanager/filemanagermenu.lua:93
|
||||
#: frontend/apps/reader/modules/readermenu.lua:83
|
||||
msgid ""
|
||||
"Version"
|
||||
|
||||
12
reader.lua
12
reader.lua
@@ -120,7 +120,7 @@ function showusage()
|
||||
print("Read all the books on your E-Ink reader")
|
||||
print("")
|
||||
print("-d start in debug mode")
|
||||
print("-p [rows] enable Lua code profiling")
|
||||
print("-p enable Lua code profiling")
|
||||
print("-h show this usage help")
|
||||
print("")
|
||||
print("If you give the name of a directory instead of a file path, a file")
|
||||
@@ -171,6 +171,8 @@ if fontmap ~= nil then
|
||||
end
|
||||
-- last file
|
||||
local last_file = G_reader_settings:readSetting("lastfile")
|
||||
-- load last opened file
|
||||
local open_last = G_reader_settings:readSetting("open_last")
|
||||
|
||||
|
||||
--@TODO we can read version here, refer to commit in master tree: (houqp)
|
||||
@@ -187,10 +189,14 @@ do
|
||||
end
|
||||
|
||||
if ARGV[argidx] and ARGV[argidx] ~= "" then
|
||||
if lfs.attributes(ARGV[argidx], "mode") == "directory" then
|
||||
if lfs.attributes(ARGV[argidx], "mode") == "file" then
|
||||
showReaderUI(ARGV[argidx])
|
||||
elseif open_last and last_file then
|
||||
showReaderUI(last_file)
|
||||
UIManager:run()
|
||||
showHomePage(ARGV[argidx])
|
||||
else
|
||||
showReaderUI(ARGV[argidx])
|
||||
showHomePage(ARGV[argidx])
|
||||
end
|
||||
UIManager:run()
|
||||
elseif last_file then
|
||||
|
||||
Reference in New Issue
Block a user