Dictionary: disable 'Clean history' when the history is empty (#7636)

pull/7419/head^2
hius07 3 years ago committed by GitHub
parent c129354ca3
commit 3d713dc34c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -287,14 +287,18 @@ function ReaderDictionary:addToMainMenu(menu_items)
}, },
{ {
text = _("Clean dictionary lookup history"), text = _("Clean dictionary lookup history"),
enabled_func = function()
return lookup_history:has("lookup_history")
end,
keep_menu_open = true, keep_menu_open = true,
callback = function() callback = function(touchmenu_instance)
UIManager:show(ConfirmBox:new{ UIManager:show(ConfirmBox:new{
text = _("Clean dictionary lookup history?"), text = _("Clean dictionary lookup history?"),
ok_text = _("Clean"), ok_text = _("Clean"),
ok_callback = function() ok_callback = function()
-- empty data table to replace current one -- empty data table to replace current one
lookup_history:reset{} lookup_history:reset{}
touchmenu_instance:updateItems()
end, end,
}) })
end, end,

Loading…
Cancel
Save