[kobo]: add reboot and poweroff menu actions (#2888)

pull/2772/head^2
Martín Fernández 7 years ago committed by Qingping Hou
parent 79830f3041
commit 474c011f21

@ -161,6 +161,9 @@ function Device:resume() end
-- Hardware specific method to power off the device -- Hardware specific method to power off the device
function Device:powerOff() end function Device:powerOff() end
-- Hardware specific method to reboot the device
function Device:reboot() end
-- Hardware specific method to initialize network manager module -- Hardware specific method to initialize network manager module
function Device:initNetworkManager() end function Device:initNetworkManager() end

@ -517,6 +517,10 @@ function Kobo:powerOff()
os.execute("poweroff") os.execute("poweroff")
end end
function Kobo:reboot()
os.execute("reboot")
end
-------------- device probe ------------ -------------- device probe ------------
local codename = Kobo:getCodeName() local codename = Kobo:getCodeName()

@ -49,5 +49,19 @@ common_info.report_bug = {
}) })
end end
} }
if Device:isKobo() then
common_info.reboot = {
text = _("Reboot the device"),
callback = function()
UIManager:nextTick(UIManager.reboot_action)
end
}
common_info.poweroff = {
text = _("Power off"),
callback = function()
UIManager:nextTick(UIManager.poweroff_action)
end
}
end
return common_info return common_info

@ -57,11 +57,15 @@ local order = {
"history", "history",
"open_last_document", "open_last_document",
"----------------------------", "----------------------------",
"ota_update", -- if Device:isKindle() or Device:isKobo() or Device:isPocketBook() or Device:isAndroid() "ota_update", --[[ if Device:isKindle() or Device:isKobo() or
Device:isPocketBook() or Device:isAndroid() ]]--
"version", "version",
"help", "help",
"system_statistics", "system_statistics",
"----------------------------", "----------------------------",
"poweroff", -- if Device:isKobo()
"reboot", -- if Device:isKobo()
"----------------------------",
"exit", "exit",
}, },
help = { help = {

@ -75,11 +75,15 @@ local order = {
"history", "history",
"book_status", "book_status",
"----------------------------", "----------------------------",
"ota_update", -- if Device:isKindle() or Device:isKobo() or Device:isPocketBook() or Device:isAndroid() "ota_update", --[[ if Device:isKindle() or Device:isKobo() or
Device:isPocketBook() or Device:isAndroid() ]]--
"version", "version",
"help", "help",
"system_statistics", "system_statistics",
"----------------------------", "----------------------------",
"poweroff", -- if Device:isKobo()
"reboot", -- if Device:isKobo()
"----------------------------",
"exit", "exit",
}, },
help = { help = {

@ -57,6 +57,16 @@ function UIManager:init()
Device:powerOff() Device:powerOff()
end) end)
end end
self.reboot_action = function()
self._entered_poweroff_stage = true;
Screen:setRotationMode(0)
require("ui/screensaver"):show("reboot", _("Rebooting..."))
Screen:refreshFull()
UIManager:nextTick(function()
self:broadcastEvent(Event:new("Close"))
Device:reboot()
end)
end
if Device:isKobo() then if Device:isKobo() then
-- We do not want auto suspend procedure to waste battery during -- We do not want auto suspend procedure to waste battery during
-- suspend. So let's unschedule it when suspending, and restart it after -- suspend. So let's unschedule it when suspending, and restart it after

Loading…
Cancel
Save