mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
feat: Would you like to read the downloaded book for OPDS (#2370)
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user