From e3f978be2c3771d421268f7bae0ba720b35aacfa Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Thu, 11 Jun 2020 11:37:14 +0200 Subject: [PATCH] Allow automatically marking the book as read on end of doc (#6256) Keep showing the "mark as" option/button, though, because that one is a toggle, it doesn't enforce the "read" status. --- frontend/apps/reader/modules/readerstatus.lua | 6 ++++++ frontend/ui/elements/common_settings_menu_table.lua | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerstatus.lua b/frontend/apps/reader/modules/readerstatus.lua index 64908872e..b3abbb5c2 100644 --- a/frontend/apps/reader/modules/readerstatus.lua +++ b/frontend/apps/reader/modules/readerstatus.lua @@ -54,6 +54,12 @@ function ReaderStatus:onEndOfBook() if G_reader_settings:readSetting("collate") == "access" then collate = false end + + -- Should we start by marking the book as read? + if G_reader_settings:isTrue("end_document_auto_mark") then + self:onMarkBook(true) + end + if settings == "pop-up" or settings == nil then local buttons = { { diff --git a/frontend/ui/elements/common_settings_menu_table.lua b/frontend/ui/elements/common_settings_menu_table.lua index 5b867bba6..be29ce51f 100644 --- a/frontend/ui/elements/common_settings_menu_table.lua +++ b/frontend/ui/elements/common_settings_menu_table.lua @@ -465,6 +465,16 @@ common_settings.document = { { text = _("End of document action"), sub_item_table = { + { + text = _("Always mark as read"), + checked_func = function() + return G_reader_settings:isTrue("end_document_auto_mark") + end, + callback = function() + G_reader_settings:flipNilOrFalse("end_document_auto_mark") + end, + separator = true, + }, { text = _("Ask with pop-up dialog"), checked_func = function() @@ -562,7 +572,7 @@ common_settings.document = { return G_reader_settings:isTrue("highlight_action_on_single_word") end, callback = function() - G_reader_settings:flipNilOrFalse("highlight_action_on_single_word", nil) + G_reader_settings:flipNilOrFalse("highlight_action_on_single_word") end, separator = true, },