mirror of
https://github.com/koreader/koreader
synced 2024-11-13 19:11:25 +00:00
c36a2929ac
Refactoring: -removed duplicated code -removed passing of username/password through all the modules -logical order of the methods -some optimizing and drying -comments New features: -subcatalog link can be saved to the list of servers (eg: direct link to the catalog of books by an author) -more book information can be fetched and shown (Book information) -fixed access to the Standard library (by @KGKopli, closes #9372)
52 lines
1.3 KiB
Lua
52 lines
1.3 KiB
Lua
local Dispatcher = require("dispatcher")
|
|
local UIManager = require("ui/uimanager")
|
|
local WidgetContainer = require("ui/widget/container/widgetcontainer")
|
|
local _ = require("gettext")
|
|
|
|
local OPDS = WidgetContainer:extend{
|
|
name = "opds",
|
|
is_doc_only = false,
|
|
}
|
|
|
|
function OPDS:onDispatcherRegisterActions()
|
|
Dispatcher:registerAction("opds_show_catalog",
|
|
{category="none", event="ShowOPDSCatalog", title=_("OPDS Catalog"), filemanager=true,}
|
|
)
|
|
end
|
|
|
|
function OPDS:init()
|
|
self:onDispatcherRegisterActions()
|
|
self.ui.menu:registerToMainMenu(self)
|
|
end
|
|
|
|
function OPDS:showCatalog()
|
|
local OPDSCatalog = require("opdscatalog")
|
|
local filemanagerRefresh = function() self.ui:onRefresh() end
|
|
function OPDSCatalog:onClose()
|
|
UIManager:close(self)
|
|
local FileManager = require("apps/filemanager/filemanager")
|
|
if FileManager.instance then
|
|
filemanagerRefresh()
|
|
else
|
|
FileManager:showFiles(G_reader_settings:readSetting("download_dir"))
|
|
end
|
|
end
|
|
OPDSCatalog:showCatalog()
|
|
end
|
|
|
|
function OPDS:onShowOPDSCatalog()
|
|
self:showCatalog()
|
|
return true
|
|
end
|
|
|
|
function OPDS:addToMainMenu(menu_items)
|
|
if not self.ui.view then
|
|
menu_items.opds = {
|
|
text = _("OPDS catalog"),
|
|
callback = function() self:showCatalog() end
|
|
}
|
|
end
|
|
end
|
|
|
|
return OPDS
|