diff --git a/frontend/ui/network/manager.lua b/frontend/ui/network/manager.lua index 161a4ba8f..826f25851 100644 --- a/frontend/ui/network/manager.lua +++ b/frontend/ui/network/manager.lua @@ -881,14 +881,11 @@ function NetworkMgr:getProxyMenuTable() end, hold_input = { title = _("Enter proxy address"), - type = "text", - hint = proxy() or "", + hint = proxy(), callback = function(input) - if input ~= "" then - self:setHTTPProxy(input) - end + self:setHTTPProxy(input) end, - } + }, } end diff --git a/frontend/ui/widget/container/inputcontainer.lua b/frontend/ui/widget/container/inputcontainer.lua index 9ae27e42d..4454ae9b4 100644 --- a/frontend/ui/widget/container/inputcontainer.lua +++ b/frontend/ui/widget/container/inputcontainer.lua @@ -362,10 +362,10 @@ end function InputContainer:onInput(input, ignore_first_hold_release) local InputDialog = require("ui/widget/inputdialog") self.input_dialog = InputDialog:new{ - title = input.title or "", + title = input.title, input = input.input_func and input.input_func() or input.input, - input_hint = input.hint_func and input.hint_func() or input.hint or "", - input_type = input.type or "number", + input_hint = input.hint_func and input.hint_func() or input.hint, + input_type = input.input_type, buttons = input.buttons or { { { @@ -379,9 +379,10 @@ function InputContainer:onInput(input, ignore_first_hold_release) text = input.ok_text or _("OK"), is_enter_default = true, callback = function() - if input.deny_blank_input and self.input_dialog:getInputText() == "" then return end - input.callback(self.input_dialog:getInputText()) - self:closeInputDialog() + if input.allow_blank_input or self.input_dialog:getInputText() ~= "" then + input.callback(self.input_dialog:getInputText()) + self:closeInputDialog() + end end, }, }, diff --git a/frontend/ui/widget/keyvaluepage.lua b/frontend/ui/widget/keyvaluepage.lua index 630be37ed..1603246c3 100644 --- a/frontend/ui/widget/keyvaluepage.lua +++ b/frontend/ui/widget/keyvaluepage.lua @@ -398,11 +398,10 @@ function KeyValuePage:init() text = "", hold_input = { title = _("Enter page number"), - type = "number", + input_type = "number", hint_func = function() - return "(" .. "1 - " .. self.pages .. ")" + return string.format("(1 - %s)", self.pages) end, - deny_blank_input = true, callback = function(input) local page = tonumber(input) if page and page >= 1 and page <= self.pages then diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index 52c2a6056..d12d319f6 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -814,7 +814,7 @@ function Menu:init() search_string = Utf8Proc.lowercase(util.fixUtf8(search_string, "?")) for k, v in ipairs(self.item_table) do local filename = Utf8Proc.lowercase(util.fixUtf8(FFIUtil.basename(v.path), "?")) - local i, _ = filename:find(search_string) + local i = filename:find(search_string) if i == 1 and not v.is_go_up then self:onGotoPage(self:getPageNumber(k)) break @@ -836,7 +836,7 @@ function Menu:init() text = "", hold_input = { title = title_goto, - type = type_goto, + input_type = type_goto, hint_func = hint_func, buttons = buttons, }, diff --git a/frontend/ui/widget/sortwidget.lua b/frontend/ui/widget/sortwidget.lua index d5fdfdd9a..bcd048c16 100644 --- a/frontend/ui/widget/sortwidget.lua +++ b/frontend/ui/widget/sortwidget.lua @@ -242,11 +242,10 @@ function SortWidget:init() text = "", hold_input = { title = _("Enter page number"), + input_type = "number", hint_func = function() - return "(" .. "1 - " .. self.pages .. ")" + return string.format("(1 - %s)", self.pages) end, - type = "number", - deny_blank_input = true, callback = function(input) local page = tonumber(input) if page and page >= 1 and page <= self.pages then diff --git a/plugins/kosync.koplugin/main.lua b/plugins/kosync.koplugin/main.lua index 06baf7edd..8a6b75843 100644 --- a/plugins/kosync.koplugin/main.lua +++ b/plugins/kosync.koplugin/main.lua @@ -195,7 +195,6 @@ function KOSync:addToMainMenu(menu_items) -- @translators Server address defined by user for progress sync. title = _("Custom progress sync server address"), input = self.settings.custom_server or "https://", - type = "text", callback = function(input) self:setCustomServer(input) end, diff --git a/plugins/statistics.koplugin/calendarview.lua b/plugins/statistics.koplugin/calendarview.lua index ef909c5a3..9f5238c32 100644 --- a/plugins/statistics.koplugin/calendarview.lua +++ b/plugins/statistics.koplugin/calendarview.lua @@ -607,11 +607,10 @@ function CalendarDayView:init() text = "", hold_input = { title = _("Enter page number"), + input_type = "number", hint_func = function() - return "(" .. "1 - " .. self.pages .. ")" + return string.format("(1 - %s)", self.pages) end, - type = "number", - deny_blank_input = true, callback = function(input) local page = tonumber(input) if page and page >= 1 and page <= self.pages then diff --git a/plugins/vocabbuilder.koplugin/main.lua b/plugins/vocabbuilder.koplugin/main.lua index 4beb6681d..4276a0b4d 100644 --- a/plugins/vocabbuilder.koplugin/main.lua +++ b/plugins/vocabbuilder.koplugin/main.lua @@ -9,7 +9,7 @@ local Blitbuffer = require("ffi/blitbuffer") local BottomContainer = require("ui/widget/container/bottomcontainer") local DB = require("db") local Button = require("ui/widget/button") -local ButtonDialogTitle = require("ui/widget/buttondialogtitle") +local ButtonDialog = require("ui/widget/buttondialog") local ButtonTable = require("ui/widget/buttontable") local CenterContainer = require("ui/widget/container/centercontainer") local ConfirmBox = require("ui/widget/confirmbox") @@ -259,7 +259,7 @@ function MenuDialog:setupPluginMenu() } } local type = server.type == "dropbox" and " (DropBox)" or " (WebDAV)" - self.sync_dialogue = ButtonDialogTitle:new{ + self.sync_dialogue = ButtonDialog:new{ title = T(_("Cloud storage:\n%1\n\nFolder path:\n%2\n\nSet up the same cloud folder on each device to sync across your devices."), server.name.." "..type, SyncService.getReadablePath(server)), info_face = Font:getFace("smallinfofont"), @@ -1146,7 +1146,6 @@ function VocabItemWidget:onShowBookAssignment(title_changed_cb) dialog = InputDialog:new{ title = _("Enter book title:"), input = "", - input_type = "text", buttons = { { { @@ -1501,11 +1500,10 @@ function VocabularyBuilderWidget:refreshFooter() text = "", hold_input = { title = _("Enter page number"), + input_type = "number", hint_func = function() - return "(" .. "1 - " .. self.pages .. ")" + return string.format("(1 - %s)", self.pages) end, - type = "number", - deny_blank_input = true, callback = function(input) local page = tonumber(input) if page and page >= 1 and page <= self.pages then @@ -1537,7 +1535,6 @@ function VocabularyBuilderWidget:showSearchDialog() title = _("Search words"), input = self.search_text or "", input_hint = _("Search empty content to exit"), - input_type = "text", buttons = { { { @@ -1817,7 +1814,6 @@ function VocabularyBuilderWidget:showChangeBookTitleDialog(sort_item, onSuccess) dialog = InputDialog:new { title = _("Change book title to:"), input = sort_item.text, - input_type = "text", buttons = { { {