2017-09-03 13:40:50 +00:00
local ConfirmBox = require ( " ui/widget/confirmbox " )
2014-11-21 14:41:14 +00:00
local Device = require ( " device " )
local InfoMessage = require ( " ui/widget/infomessage " )
local UIManager = require ( " ui/uimanager " )
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 = { }
2016-03-13 15:42:58 +00:00
if Device : isKindle ( ) or Device : isKobo ( ) or Device : isPocketBook ( )
or Device : isAndroid ( ) 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-04-15 12:45:56 +00:00
local version = require ( " version " ) : getCurrentRevision ( )
2017-03-03 06:41:10 +00:00
common_info.version = {
2014-11-21 14:41:14 +00:00
text = _ ( " Version " ) ,
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 = version ,
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
}
2017-06-24 07:55:31 +00:00
common_info.more_plugins = {
text = _ ( " More plugins " ) ,
}
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 {
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/ " ) , version ) ,
2018-09-18 19:48:39 +00:00
icon_file = " resources/ko-icon.png "
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 ( )
2017-04-03 21:52:47 +00:00
local model = Device.model
2014-11-21 14:41:14 +00:00
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 " ) ,
version , model ) ,
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
if Device : isKindle ( ) or Device : isKobo ( ) then
common_info.sleep = {
text = _ ( " Sleep " ) ,
callback = function ( )
UIManager : suspend ( )
end ,
}
end
2018-09-07 23:37:04 +00:00
if Device : isKobo ( ) or Device : isSonyPRSTUX ( ) 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 ( )
2017-09-03 13:40:50 +00:00
UIManager : show ( ConfirmBox : new {
text = _ ( " Are you sure you want to reboot the device? " ) ,
ok_text = _ ( " Reboot " ) ,
ok_callback = function ( )
UIManager : nextTick ( UIManager.reboot_action )
end ,
} )
2017-05-14 16:43:08 +00:00
end
}
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 ( )
2017-09-03 13:40:50 +00:00
UIManager : show ( ConfirmBox : new {
text = _ ( " Are you sure you want to power off the device? " ) ,
ok_text = _ ( " Power off " ) ,
ok_callback = function ( )
UIManager : nextTick ( UIManager.poweroff_action )
end ,
} )
2017-05-14 16:43:08 +00:00
end
}
end
2014-11-21 14:41:14 +00:00
return common_info