[chore] Fix a few luacheck errors (#8461)

pull/8455/head^2
poire-z 2 years ago committed by GitHub
parent 3461f8af31
commit 6f2fdd96f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -816,8 +816,8 @@ function ReaderDictionary:startSdcv(word, dict_names, fuzzy_search)
-- because sdcv cannot handle CJK text properly when fuzzy searching (with -- because sdcv cannot handle CJK text properly when fuzzy searching (with
-- Japanese, it returns hundreds of useless results). -- Japanese, it returns hundreds of useless results).
local shouldnt_fuzzy_search = true local shouldnt_fuzzy_search = true
for _, word in ipairs(words) do for _, w in ipairs(words) do
if not util.hasCJKChar(word) then if not util.hasCJKChar(w) then
shouldnt_fuzzy_search = false shouldnt_fuzzy_search = false
break break
end end

@ -6,51 +6,51 @@ local _ = require("gettext")
local exit_settings = {} local exit_settings = {}
exit_settings.exit_menu = { exit_settings.exit_menu = {
text = _("Exit"), text = _("Exit"),
-- submenu entries will be appended by xyz_menu_order_lua -- submenu entries will be appended by xyz_menu_order_lua
} }
exit_settings.exit = { exit_settings.exit = {
text = _("Exit"), text = _("Exit"),
callback = function() callback = function()
UIManager:broadcastEvent(Event:new("Exit")) UIManager:broadcastEvent(Event:new("Exit"))
end, end,
} }
exit_settings.restart_koreader = { exit_settings.restart_koreader = {
text = _("Restart KOReader"), text = _("Restart KOReader"),
callback = function() callback = function()
UIManager:broadcastEvent(Event:new("Restart")) UIManager:broadcastEvent(Event:new("Restart"))
end, end,
} }
if not Device:canRestart() then if not Device:canRestart() then
exit_settings.exit_menu = exit_settings.exit exit_settings.exit_menu = exit_settings.exit
exit_settings.exit = nil exit_settings.exit = nil
exit_settings.restart_koreader = nil exit_settings.restart_koreader = nil
end end
if Device:canSuspend() then if Device:canSuspend() then
exit_settings.sleep = { exit_settings.sleep = {
text = _("Sleep"), text = _("Sleep"),
callback = function() callback = function()
UIManager:suspend() UIManager:suspend()
end, end,
} }
end end
if Device:canReboot() then if Device:canReboot() then
exit_settings.reboot = { exit_settings.reboot = {
text = _("Reboot the device"), text = _("Reboot the device"),
keep_menu_open = true, keep_menu_open = true,
callback = function() callback = function()
UIManager:broadcastEvent(Event:new("Reboot")) UIManager:broadcastEvent(Event:new("Reboot"))
end end
} }
end end
if Device:canPowerOff() then if Device:canPowerOff() then
exit_settings.poweroff = { exit_settings.poweroff = {
text = _("Power off"), text = _("Power off"),
keep_menu_open = true, keep_menu_open = true,
callback = function() callback = function()
UIManager:broadcastEvent(Event:new("PowerOff")) UIManager:broadcastEvent(Event:new("PowerOff"))
end end
} }
end end
return exit_settings return exit_settings

@ -1,6 +1,5 @@
local BD = require("ui/bidi") local BD = require("ui/bidi")
local Device = require("device") local Device = require("device")
local Event = require("ui/event")
local InfoMessage = require("ui/widget/infomessage") local InfoMessage = require("ui/widget/infomessage")
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local Version = require("version") local Version = require("version")

Loading…
Cancel
Save