Dict/Wiki lookup results window: improve the 'pencil' button (#7523)

reviewable/pr7529/r1
hius07 3 years ago committed by GitHub
parent 25b40fd1b6
commit ad924e3c1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,7 @@ local ScrollTextWidget = require("ui/widget/scrolltextwidget")
local Size = require("ui/size")
local TextWidget = require("ui/widget/textwidget")
local TimeVal = require("ui/timeval")
local Translator = require("ui/translator")
local UIManager = require("ui/uimanager")
local VerticalGroup = require("ui/widget/verticalgroup")
local VerticalSpan = require("ui/widget/verticalspan")
@ -1211,6 +1212,27 @@ function DictQuickLookup:lookupInputWord(hint)
input_hint = hint or "",
input_type = "text",
buttons = {
{
{
text = _("Translate"),
is_enter_default = false,
callback = function()
if self.input_dialog:getInputText() == "" then return end
self:closeInputDialog()
Translator:showTranslation(self.input_dialog:getInputText())
end,
},
{
text = _("Search Wikipedia"),
is_enter_default = self.is_wiki,
callback = function()
if self.input_dialog:getInputText() == "" then return end
self.is_wiki = true
self:closeInputDialog()
self:inputLookup()
end,
},
},
{
{
text = _("Cancel"),
@ -1219,16 +1241,16 @@ function DictQuickLookup:lookupInputWord(hint)
end,
},
{
text = self.is_wiki and _("Search Wikipedia") or _("Search dictionary"),
is_enter_default = true,
text = _("Search dictionary"),
is_enter_default = not self.is_wiki,
callback = function()
if self.input_dialog:getInputText() == "" then return end
self.is_wiki = false
self:closeInputDialog()
self:onClose()
self:inputLookup()
end,
},
}
},
},
}
UIManager:show(self.input_dialog)

Loading…
Cancel
Save