2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

configdialog: keep original options intact (#12093)

This commit is contained in:
hius07 2024-06-26 15:22:23 +03:00 committed by GitHub
parent 48c41fccee
commit 0ae84642e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -546,10 +546,14 @@ function ConfigOption:init()
local row_count = self.options[c].row_count or 1
local toggle_height = Screen:scaleBySize(self.options[c].height
or (30 * row_count))
local toggle, args = {}, {} -- keep options intact
for i = 1, #self.options[c].toggle do
toggle[i] = self.options[c].toggle[i]
args[i] = self.options[c].args[i]
end
if self.options[c].more_options then
table.insert(self.options[c].toggle, "")
table.insert(self.options[c].args, "")
self.options[c].more_options = false
table.insert(toggle, "")
table.insert(args, "")
end
local switch = ToggleSwitch:new{
width = math.min(max_toggle_width, toggle_width),
@ -558,17 +562,17 @@ function ConfigOption:init()
font_size = item_font_size,
name = self.options[c].name,
name_text = name_text,
toggle = self.options[c].toggle,
toggle = toggle,
alternate = self.options[c].alternate,
values = self.options[c].values,
args = self.options[c].args,
args = args,
event = self.options[c].event,
hide_on_apply = self.options[c].hide_on_apply,
config = self.config,
enabled = enabled,
row_count = row_count,
callback = function(arg)
if self.options[c].toggle[arg] == "" then
if toggle[arg] == "" then
if self.options[c].show_true_value_func and not self.options[c].more_options_param.show_true_value_func then
self.options[c].more_options_param.show_true_value_func = self.options[c].show_true_value_func
end