2013-03-04 23:23:37 +08:00
|
|
|
|
|
|
|
|
ReaderCoptListener = EventListener:new{}
|
|
|
|
|
|
2013-06-28 17:12:04 +08:00
|
|
|
function ReaderCoptListener:onReadSettings(config)
|
2013-03-04 23:23:37 +08:00
|
|
|
local embedded_css = config:readSetting("copt_embedded_css")
|
2013-06-28 17:12:04 +08:00
|
|
|
if embedded_css == 0 then
|
2013-03-04 23:23:37 +08:00
|
|
|
table.insert(self.ui.postInitCallback, function()
|
2013-06-28 17:12:04 +08:00
|
|
|
self.ui:handleEvent(Event:new("ToggleEmbeddedStyleSheet", false))
|
2013-03-04 23:23:37 +08:00
|
|
|
end)
|
|
|
|
|
end
|
2013-06-28 17:12:04 +08:00
|
|
|
|
2013-03-04 23:23:37 +08:00
|
|
|
local view_mode = config:readSetting("copt_view_mode")
|
|
|
|
|
if view_mode == 0 then
|
|
|
|
|
table.insert(self.ui.postInitCallback, function()
|
|
|
|
|
self.ui:handleEvent(Event:new("SetViewMode", "page"))
|
|
|
|
|
end)
|
|
|
|
|
elseif view_mode == 1 then
|
|
|
|
|
table.insert(self.ui.postInitCallback, function()
|
|
|
|
|
self.ui:handleEvent(Event:new("SetViewMode", "scroll"))
|
|
|
|
|
end)
|
|
|
|
|
end
|
2013-06-28 17:12:04 +08:00
|
|
|
|
|
|
|
|
local copt_font_size = config:readSetting("copt_font_size")
|
|
|
|
|
if copt_font_size then
|
|
|
|
|
table.insert(self.ui.postInitCallback, function()
|
|
|
|
|
self.ui:handleEvent(Event:new("SetFontSize", copt_font_size))
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local copt_margins = config:readSetting("copt_page_margins")
|
|
|
|
|
if copt_margins then
|
|
|
|
|
table.insert(self.ui.postInitCallback, function()
|
|
|
|
|
self.ui:handleEvent(Event:new("SetPageMargins", copt_margins))
|
|
|
|
|
end)
|
|
|
|
|
end
|
2013-03-04 23:23:37 +08:00
|
|
|
end
|