2020-01-04 00:18:51 +00:00
local BD = require ( " ui/bidi " )
2014-11-21 14:41:14 +00:00
local Device = require ( " device " )
2020-07-12 18:47:49 +00:00
local Event = require ( " ui/event " )
2014-11-21 14:41:14 +00:00
local InfoMessage = require ( " ui/widget/infomessage " )
local UIManager = require ( " ui/uimanager " )
2020-08-29 03:20:28 +00:00
local Version = require ( " version " )
2014-11-21 14:41:14 +00:00
local _ = require ( " gettext " )
2017-04-03 21:52:47 +00:00
local T = require ( " ffi/util " ) . template
2014-11-21 14:41:14 +00:00
local common_info = { }
2018-10-06 05:55:35 +00:00
if Device : hasOTAUpdates ( ) then
2014-11-21 14:41:14 +00:00
local OTAManager = require ( " ui/otamanager " )
2017-03-03 06:41:10 +00:00
common_info.ota_update = OTAManager : getOTAMenuTable ( )
2014-11-21 14:41:14 +00:00
end
2017-03-03 06:41:10 +00:00
common_info.version = {
2020-08-29 03:20:28 +00:00
text = T ( _ ( " Version: %1 " ) , Version : getShortVersion ( ) ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2014-11-21 14:41:14 +00:00
callback = function ( )
UIManager : show ( InfoMessage : new {
2020-08-29 03:20:28 +00:00
text = Version : getCurrentRevision ( ) ,
2014-11-21 14:41:14 +00:00
} )
end
2017-02-28 21:46:32 +00:00
}
2017-03-03 06:41:10 +00:00
common_info.help = {
2014-11-21 14:41:14 +00:00
text = _ ( " Help " ) ,
2017-04-03 21:52:47 +00:00
}
2020-06-19 18:40:40 +00:00
common_info.more_tools = {
2020-06-18 10:21:09 +00:00
text = _ ( " More tools " ) ,
2017-06-24 07:55:31 +00:00
}
2018-08-11 20:47:33 +00:00
common_info.device = {
text = _ ( " Device " ) ,
}
2017-04-15 12:45:56 +00:00
common_info.quickstart_guide = {
text = _ ( " Quickstart guide " ) ,
callback = function ( )
2017-04-24 06:27:29 +00:00
local QuickStart = require ( " ui/quickstart " )
2017-04-15 12:45:56 +00:00
local ReaderUI = require ( " apps/reader/readerui " )
ReaderUI : showReader ( QuickStart : getQuickStart ( ) )
end
}
2017-04-03 21:52:47 +00:00
common_info.about = {
text = _ ( " About " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2017-04-03 21:52:47 +00:00
callback = function ( )
UIManager : show ( InfoMessage : new {
2020-08-29 03:20:28 +00:00
text = T ( _ ( " KOReader %1 \n \n A document viewer for E Ink devices. \n \n Licensed under Affero GPL v3. All dependencies are free software. \n \n http://koreader.rocks/ " ) , BD.ltr ( Version : getCurrentRevision ( ) ) ) ,
2020-12-19 11:18:30 +00:00
icon = " koreader " ,
2017-04-03 21:52:47 +00:00
} )
end
}
common_info.report_bug = {
text = _ ( " Report a bug " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2014-11-21 14:41:14 +00:00
callback = function ( )
UIManager : show ( InfoMessage : new {
2017-04-03 21:52:47 +00:00
text = T ( _ ( " Please report bugs to \n https://github.com/koreader/koreader/issues \n \n Version: \n %1 \n \n Detected device: \n %2 " ) ,
2020-08-29 03:20:28 +00:00
Version : getCurrentRevision ( ) , Device : info ( ) ) ,
2014-11-21 14:41:14 +00:00
} )
end
2017-02-28 21:46:32 +00:00
}
2017-09-03 13:40:50 +00:00
2020-06-19 07:41:50 +00:00
if Device : canSuspend ( ) then
2017-09-03 13:40:50 +00:00
common_info.sleep = {
text = _ ( " Sleep " ) ,
callback = function ( )
UIManager : suspend ( )
end ,
}
end
2019-08-15 12:49:15 +00:00
if Device : canReboot ( ) then
2017-05-14 16:43:08 +00:00
common_info.reboot = {
text = _ ( " Reboot the device " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2017-05-14 16:43:08 +00:00
callback = function ( )
2020-07-12 18:47:49 +00:00
UIManager : broadcastEvent ( Event : new ( " Reboot " ) )
2017-05-14 16:43:08 +00:00
end
}
2019-08-15 12:49:15 +00:00
end
if Device : canPowerOff ( ) then
2017-05-14 16:43:08 +00:00
common_info.poweroff = {
text = _ ( " Power off " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2017-05-14 16:43:08 +00:00
callback = function ( )
2020-07-12 18:47:49 +00:00
UIManager : broadcastEvent ( Event : new ( " PowerOff " ) )
2017-05-14 16:43:08 +00:00
end
}
end
2014-11-21 14:41:14 +00:00
return common_info