|
|
|
@ -56,8 +56,15 @@ function ReaderStatus:onEndOfBook()
|
|
|
|
|
local buttons = {
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
text = _("Cancel"),
|
|
|
|
|
text_func = function()
|
|
|
|
|
if self.settings.data.summary and self.settings.data.summary.status == "complete" then
|
|
|
|
|
return _("Mark as reading")
|
|
|
|
|
else
|
|
|
|
|
return _("Mark as read")
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
callback = function()
|
|
|
|
|
self:onMarkBook()
|
|
|
|
|
UIManager:close(choose_action)
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
@ -88,6 +95,12 @@ function ReaderStatus:onEndOfBook()
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
text = _("Cancel"),
|
|
|
|
|
callback = function()
|
|
|
|
|
UIManager:close(choose_action)
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text = _("File browser"),
|
|
|
|
|
callback = function()
|
|
|
|
@ -122,6 +135,12 @@ function ReaderStatus:onEndOfBook()
|
|
|
|
|
end
|
|
|
|
|
elseif settings == "file_browser" then
|
|
|
|
|
self:openFileBrowser()
|
|
|
|
|
elseif settings == "mark_read" then
|
|
|
|
|
self:onMarkBook(true)
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("You've reached the end of the document.\nThe current book is marked as read."),
|
|
|
|
|
timeout = 3
|
|
|
|
|
})
|
|
|
|
|
elseif settings == "book_status_file_browser" then
|
|
|
|
|
local before_show_callback = function() self:openFileBrowser() end
|
|
|
|
|
self:onShowBookStatus(before_show_callback)
|
|
|
|
@ -192,6 +211,27 @@ function ReaderStatus:onShowBookStatus(before_show_callback)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- If mark_read is true then we change status only from reading/abandoned to read (complete).
|
|
|
|
|
-- Otherwise we change status from reading/abandoned to read or from read to reading.
|
|
|
|
|
function ReaderStatus:onMarkBook(mark_read)
|
|
|
|
|
if self.settings.data.summary and self.settings.data.summary.status then
|
|
|
|
|
local current_status = self.settings.data.summary.status
|
|
|
|
|
if current_status == "complete" then
|
|
|
|
|
if mark_read then
|
|
|
|
|
-- Keep mark as read.
|
|
|
|
|
self.settings.data.summary.status = "complete"
|
|
|
|
|
else
|
|
|
|
|
-- Change current status from read (complete) to reading
|
|
|
|
|
self.settings.data.summary.status = "reading"
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.settings.data.summary.status = "complete"
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.settings.data.summary = {status = "complete"}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ReaderStatus:onReadSettings(config)
|
|
|
|
|
self.settings = config
|
|
|
|
|
end
|
|
|
|
|