mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Gesture manager: add action - show book information (#4777)
As requested by @ersi. Cf. https://github.com/koreader/koreader/issues/4727#issuecomment-471766024
This commit is contained in:
@@ -28,16 +28,7 @@ function BookInfo:addToMainMenu(menu_items)
|
||||
menu_items.book_info = {
|
||||
text = self.bookinfo_menu_title,
|
||||
callback = function()
|
||||
-- Get them directly from ReaderUI's doc_settings
|
||||
local doc_props = self.ui.doc_settings:readSetting("doc_props")
|
||||
-- Make a copy, so we don't add "pages" to the original doc_props
|
||||
-- that will be saved at some point by ReaderUI.
|
||||
local book_props = {}
|
||||
for k, v in pairs(doc_props) do
|
||||
book_props[k] = v
|
||||
end
|
||||
book_props.pages = self.ui.doc_settings:readSetting("doc_pages")
|
||||
self:show(self.document.file, book_props)
|
||||
self:onShowBookInfo()
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -203,4 +194,17 @@ function BookInfo:show(file, book_props)
|
||||
UIManager:show(widget)
|
||||
end
|
||||
|
||||
function BookInfo:onShowBookInfo()
|
||||
-- Get them directly from ReaderUI's doc_settings
|
||||
local doc_props = self.ui.doc_settings:readSetting("doc_props")
|
||||
-- Make a copy, so we don't add "pages" to the original doc_props
|
||||
-- that will be saved at some point by ReaderUI.
|
||||
local book_props = {}
|
||||
for k, v in pairs(doc_props) do
|
||||
book_props[k] = v
|
||||
end
|
||||
book_props.pages = self.ui.doc_settings:readSetting("doc_pages")
|
||||
self:show(self.document.file, book_props)
|
||||
end
|
||||
|
||||
return BookInfo
|
||||
|
||||
@@ -36,6 +36,7 @@ local action_strings = {
|
||||
toc = _("Table of contents"),
|
||||
bookmarks = _("Bookmarks"),
|
||||
reading_progress = _("Reading progress"),
|
||||
book_info = _("Book information"),
|
||||
book_status = _("Book status"),
|
||||
|
||||
history = _("History"),
|
||||
@@ -320,6 +321,7 @@ function ReaderGesture:buildMenu(ges, default)
|
||||
{ "toc", not self.is_docless},
|
||||
{"bookmarks", not self.is_docless},
|
||||
{"reading_progress", ReaderGesture.getReaderProgress ~= nil},
|
||||
{"book_info", not self.is_docless},
|
||||
{"book_status", not self.is_docless, true},
|
||||
|
||||
{"history", true},
|
||||
@@ -623,6 +625,8 @@ function ReaderGesture:gestureAction(action, ges)
|
||||
self.ui:handleEvent(Event:new("ShowBookmark"))
|
||||
elseif action == "history" then
|
||||
self.ui:handleEvent(Event:new("ShowHist"))
|
||||
elseif action == "book_info" then
|
||||
self.ui:handleEvent(Event:new("ShowBookInfo"))
|
||||
elseif action == "book_status" then
|
||||
self.ui:handleEvent(Event:new("ShowBookStatus"))
|
||||
elseif action == "page_jmp_fwd_10" then
|
||||
|
||||
Reference in New Issue
Block a user