mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderUI: Refresh key_events handlers on keyboard hotplug
This commit is contained in:
@@ -35,9 +35,7 @@ local ReaderToc = InputContainer:extend{
|
||||
}
|
||||
|
||||
function ReaderToc:init()
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.ShowToc = { { "T" } }
|
||||
end
|
||||
self:registerKeyEvents(true)
|
||||
|
||||
if G_reader_settings:hasNot("toc_items_per_page") then
|
||||
-- The TOC items per page and items' font size can now be
|
||||
@@ -62,6 +60,17 @@ end
|
||||
|
||||
function ReaderToc:onGesture() end
|
||||
|
||||
function ReaderToc:registerKeyEvents(init)
|
||||
if Device:hasKeyboard() then
|
||||
self.key_events.ShowToc = { { "T" } }
|
||||
elseif not init then
|
||||
self.key_events.ShowToc = nil
|
||||
end
|
||||
end
|
||||
|
||||
ReaderToc.onPhysicalKeyboardConnected = ReaderToc.registerKeyEvents
|
||||
ReaderToc.onPhysicalKeyboardDisconnected = ReaderToc.registerKeyEvents
|
||||
|
||||
function ReaderToc:onReadSettings(config)
|
||||
self.toc_ticks_ignored_levels = config:readSetting("toc_ticks_ignored_levels") or {}
|
||||
self.toc_chapter_navigation_bind_to_ticks = config:readSetting("toc_chapter_navigation_bind_to_ticks")
|
||||
|
||||
Reference in New Issue
Block a user