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

This commit is contained in:
hius07
2021-05-06 18:28:54 +03:00
committed by GitHub
parent c129354ca3
commit 3d713dc34c

View File

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