InputContainer: consistent input type in onInput() (#12012)

reviewable/pr12002/r2
hius07 2 weeks ago committed by GitHub
parent 57c6fb6355
commit ded709e3a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

@ -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,
},
},

@ -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

@ -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,
},

@ -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

@ -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,

@ -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

@ -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 = {
{
{

Loading…
Cancel
Save