mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
allow disable highlight by default
minor code change typo
This commit is contained in:
@@ -8,6 +8,7 @@ local UIManager = require("ui/uimanager")
|
||||
local ButtonDialog = require("ui/widget/buttondialog")
|
||||
local DEBUG = require("dbg")
|
||||
local _ = require("gettext")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
|
||||
local ReaderHighlight = InputContainer:new{}
|
||||
|
||||
@@ -99,7 +100,8 @@ function ReaderHighlight:genHighlightDrawerMenu()
|
||||
end,
|
||||
callback = function()
|
||||
self.view.highlight.disabled = not self.view.highlight.disabled
|
||||
end
|
||||
end,
|
||||
hold_callback = function() self:makeDefault(not self.view.highlight.disabled) end,
|
||||
},
|
||||
get_highlight_style("lighten"),
|
||||
get_highlight_style("underscore"),
|
||||
@@ -520,7 +522,11 @@ end
|
||||
|
||||
function ReaderHighlight:onReadSettings(config)
|
||||
self.view.highlight.saved_drawer = config:readSetting("highlight_drawer") or self.view.highlight.saved_drawer
|
||||
self.view.highlight.disabled = config:readSetting("highlight_disabled") or false
|
||||
local disable_highlight = config:readSetting("highlight_disabled")
|
||||
if disable_highlight == nil then
|
||||
disable_highlight = G_reader_settings:readSetting("highlight_disabled") or false
|
||||
end
|
||||
self.view.highlight.disabled = disable_highlight
|
||||
end
|
||||
|
||||
function ReaderHighlight:onSaveSettings()
|
||||
@@ -534,4 +540,20 @@ function ReaderHighlight:onClose()
|
||||
self:clear()
|
||||
end
|
||||
|
||||
function ReaderHighlight:makeDefault(highlight_disabled)
|
||||
local new_text
|
||||
if highlight_disabled then
|
||||
new_text = _("Disable highlight by default.")
|
||||
else
|
||||
new_text = _("Enable highlight by default.")
|
||||
end
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = new_text,
|
||||
ok_callback = function()
|
||||
G_reader_settings:saveSetting("highlight_disabled", highlight_disabled)
|
||||
end,
|
||||
})
|
||||
self.view.highlight.disabled = highlight_disabled
|
||||
end
|
||||
|
||||
return ReaderHighlight
|
||||
|
||||
Reference in New Issue
Block a user