From 3d713dc34c0f568f1a028eaa951cd5c92da1176e Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Thu, 6 May 2021 18:28:54 +0300 Subject: [PATCH] Dictionary: disable 'Clean history' when the history is empty (#7636) --- frontend/apps/reader/modules/readerdictionary.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index 9a0d12910..cd72bbf01 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -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,