mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
MultiDialog: Fix an extremely nasty API misuse
Stuff was poking at the class object, not the instance's :s. Fix #9599
This commit is contained in:
@@ -142,7 +142,7 @@ Some of the previously generated long-lived tokens are still valid.]])
|
||||
{
|
||||
text = _("Save"),
|
||||
callback = function()
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = self.settings_dialog:getFields()
|
||||
if item then
|
||||
callback(item, fields)
|
||||
else
|
||||
|
||||
@@ -140,7 +140,7 @@ Username and password are optional.]])
|
||||
{
|
||||
text = text_button_right,
|
||||
callback = function()
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = self.settings_dialog:getFields()
|
||||
if fields[1] ~= "" and fields[2] ~= "" then
|
||||
if item then
|
||||
-- edit
|
||||
|
||||
@@ -125,7 +125,7 @@ The start folder is appended to the server path.]])
|
||||
{
|
||||
text = text_button_ok,
|
||||
callback = function()
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = self.settings_dialog:getFields()
|
||||
|
||||
-- make sure the URL is a valid path
|
||||
if fields[5] ~= "" then
|
||||
|
||||
@@ -146,7 +146,7 @@ function SetDefaultsWidget:init()
|
||||
callback = function()
|
||||
UIManager:close(set_dialog)
|
||||
local new_table = {}
|
||||
for _, field in ipairs(MultiInputDialog:getFields()) do
|
||||
for _, field in ipairs(set_dialog:getFields()) do
|
||||
local key, value = field:match("^[^= ]+"), field:match("[^= ]+$")
|
||||
new_table[tonumber(key) or key] = tonumber(value) or value
|
||||
end
|
||||
|
||||
@@ -652,7 +652,7 @@ function ReaderFooter:set_custom_text(touchmenu_instance)
|
||||
{
|
||||
text = _("Set"),
|
||||
callback = function()
|
||||
local inputs = MultiInputDialog:getFields()
|
||||
local inputs = text_dialog:getFields()
|
||||
local new_text, new_repetitions = inputs[1], inputs[2]
|
||||
if new_text == "" then
|
||||
new_text = " "
|
||||
|
||||
@@ -46,7 +46,7 @@ Example for input of two strings and a number:
|
||||
{
|
||||
text = _("Use settings"),
|
||||
callback = function(touchmenu_instance)
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = sample_input:getFields()
|
||||
-- check for user input
|
||||
if fields[1] ~= "" and fields[2] ~= ""
|
||||
and fields[3] ~= 0 then
|
||||
@@ -205,7 +205,7 @@ end
|
||||
function MultiInputDialog:getFields()
|
||||
local fields = {}
|
||||
for i, field in ipairs(self.input_field) do
|
||||
table.insert(fields, field.text)
|
||||
table.insert(fields, field:getText())
|
||||
end
|
||||
return fields
|
||||
end
|
||||
|
||||
@@ -168,7 +168,7 @@ function OPDSBrowser:addNewCatalog()
|
||||
callback = function()
|
||||
self.add_server_dialog:onClose()
|
||||
UIManager:close(self.add_server_dialog)
|
||||
self:addServerFromInput(MultiInputDialog:getFields())
|
||||
self:addServerFromInput(self.add_server_dialog:getFields())
|
||||
end
|
||||
},
|
||||
},
|
||||
@@ -219,7 +219,7 @@ function OPDSBrowser:editCalibreServer()
|
||||
callback = function()
|
||||
self.add_server_dialog:onClose()
|
||||
UIManager:close(self.add_server_dialog)
|
||||
self:editCalibreFromInput(MultiInputDialog:getFields())
|
||||
self:editCalibreFromInput(self.add_server_dialog:getFields())
|
||||
end
|
||||
},
|
||||
},
|
||||
@@ -1012,7 +1012,7 @@ function OPDSBrowser:editOPDSServer(item)
|
||||
callback = function()
|
||||
self.edit_server_dialog:onClose()
|
||||
UIManager:close(self.edit_server_dialog)
|
||||
self:editServerFromInput(item, MultiInputDialog:getFields())
|
||||
self:editServerFromInput(item, self.edit_server_dialog:getFields())
|
||||
end
|
||||
},
|
||||
},
|
||||
|
||||
@@ -145,7 +145,7 @@ function PerceptionExpander:showSettingsDialog()
|
||||
{
|
||||
text = _("Apply"),
|
||||
callback = function()
|
||||
self:saveSettings(MultiInputDialog:getFields())
|
||||
self:saveSettings(self.settings_dialog:getFields())
|
||||
self.settings_dialog:onClose()
|
||||
UIManager:close(self.settings_dialog)
|
||||
self:createUI()
|
||||
|
||||
@@ -119,7 +119,7 @@ function Aliases:editAlias(alias_name, alias_command)
|
||||
{
|
||||
text = _("Save"),
|
||||
callback = function()
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = alias_input:getFields()
|
||||
local name = fields[1] and util.trim(fields[1])
|
||||
local value = fields[2] and util.trim(fields[2])
|
||||
if name ~= "" and value ~= "" then
|
||||
@@ -150,7 +150,7 @@ function Aliases:editAlias(alias_name, alias_command)
|
||||
{
|
||||
text = _("Execute"),
|
||||
callback = function()
|
||||
local fields = MultiInputDialog:getFields()
|
||||
local fields = alias_input:getFields()
|
||||
local value = fields[2] and util.trim(fields[2])
|
||||
if value ~= "" then
|
||||
UIManager:close(alias_input)
|
||||
|
||||
@@ -1061,7 +1061,7 @@ Restart KOReader after editing the config file.]]), BD.dirpath(DataStorage:getSe
|
||||
{
|
||||
text = _("Apply"),
|
||||
callback = function()
|
||||
local myfields = MultiInputDialog:getFields()
|
||||
local myfields = self.settings_dialog:getFields()
|
||||
self.server_url = myfields[1]
|
||||
self.client_id = myfields[2]
|
||||
self.client_secret = myfields[3]
|
||||
@@ -1104,7 +1104,7 @@ function Wallabag:editClientSettings()
|
||||
{
|
||||
text = _("Apply"),
|
||||
callback = function()
|
||||
local myfields = MultiInputDialog:getFields()
|
||||
local myfields = self.client_settings_dialog:getFields()
|
||||
self.articles_per_sync = math.max(1, tonumber(myfields[1]) or self.articles_per_sync)
|
||||
self:saveSettings(myfields)
|
||||
self.client_settings_dialog:onClose()
|
||||
|
||||
Reference in New Issue
Block a user