diff --git a/frontend/apps/opdscatalog/opdscatalog.lua b/frontend/apps/opdscatalog/opdscatalog.lua index 50ec13910..30620b9d5 100644 --- a/frontend/apps/opdscatalog/opdscatalog.lua +++ b/frontend/apps/opdscatalog/opdscatalog.lua @@ -6,6 +6,9 @@ local Screen = require("device").screen local DEBUG = require("dbg") local _ = require("gettext") local Blitbuffer = require("ffi/blitbuffer") +local ReaderUI = require("apps/reader/readerui") +local ConfirmBox = require("ui/widget/confirmbox") +local T = require("ffi/util").template local OPDSCatalog = InputContainer:extend{ title = _("OPDS Catalog"), @@ -43,6 +46,16 @@ function OPDSCatalog:init() is_borderless = true, has_close_button = true, close_callback = function() return self:onClose() end, + file_downloaded_callback = function(downloaded_file) + UIManager:show(ConfirmBox:new{ + text = T(_("File saved to:\n %1\nWould you like to read the downloaded book now?"), + downloaded_file), + ok_callback = function() + self:onClose() + ReaderUI:showReader(downloaded_file) + end + }) + end, } self[1] = FrameContainer:new{ diff --git a/frontend/ui/widget/opdsbrowser.lua b/frontend/ui/widget/opdsbrowser.lua index e20cae258..a110c01a3 100644 --- a/frontend/ui/widget/opdsbrowser.lua +++ b/frontend/ui/widget/opdsbrowser.lua @@ -479,10 +479,9 @@ function OPDSBrowser:downloadFile(item, format, remote_url) if c == 200 then DEBUG("file downloaded to", local_path) - UIManager:show(InfoMessage:new{ - text = _("File saved to:\n") .. local_path, - timeout = 3, - }) + if self.file_downloaded_callback then + self.file_downloaded_callback(local_path) + end else DEBUG("response", {r, c, h}) UIManager:show(InfoMessage:new{ @@ -514,7 +513,7 @@ function OPDSBrowser:showDownloads(item) UIManager:close(self.download_dialog) UIManager:show(InfoMessage:new{ text = _("Downloading may take several minutes…"), - timeout = 3, + timeout = 1, }) end table.insert(line, button)