From 887138f57f57e411d5f5f65e9ec372bd4ca3a220 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 24 May 2021 22:48:15 +0200 Subject: [PATCH] ReaderDictionary: Handle all dictionaries being disabled better. (#7737) By showing a warning, instead of not passing any -u flag to sdcv and letting it query *all* dictionaries if FS order... Co-authored-by: Frans de Jonge --- .../apps/reader/modules/readerdictionary.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index cd72bbf01..06293296b 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -800,7 +800,7 @@ function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search) -- dummy results final_results = { { - dict = "", + dict = _("Not available"), word = word, definition = lookup_cancelled and _("Dictionary lookup interrupted.") or _("No results."), no_result = true, @@ -849,6 +849,22 @@ function ReaderDictionary:stardictLookup(word, dict_names, fuzzy_search, box, li return end + -- If the user disabled all the dictionaries, go away. + if dict_names and #dict_names == 0 then + -- Dummy result + local nope = { + { + dict = _("Not available"), + word = word, + definition = _("There are no enabled dictionaries.\nPlease check the 'Dictionary settings' menu."), + no_result = true, + lookup_cancelled = false, + } + } + self:showDict(word, nope, box, link) + return + end + self:showLookupInfo(word, self.lookup_msg_delay) self._lookup_start_tv = UIManager:getTime()