From d5a2df3c0447e94d02d10b98b17f04b9351b81fc Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Sun, 30 May 2021 06:21:28 +0300 Subject: [PATCH] OPDS: Add a button to display an entry's content block in the download popup (#7767) --- plugins/opds.koplugin/opdsbrowser.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/opds.koplugin/opdsbrowser.lua b/plugins/opds.koplugin/opdsbrowser.lua index d8b0ac00f..8715a23d5 100644 --- a/plugins/opds.koplugin/opdsbrowser.lua +++ b/plugins/opds.koplugin/opdsbrowser.lua @@ -612,6 +612,7 @@ end function OPDSBrowser:createNewDownloadDialog(path, buttons) self.download_dialog = ButtonDialogTitle:new{ title = T(_("Download folder:\n%1\n\nDownload file type:"), BD.dirpath(path)), + use_info_style = true, buttons = buttons } end @@ -650,10 +651,10 @@ function OPDSBrowser:showDownloads(item) table.insert(buttons, line) end table.insert(buttons, {}) - -- Set download folder button. + -- Set download folder and book info buttons. table.insert(buttons, { { - text = _("Select another folder"), + text = _("Select folder"), callback = function() require("ui/downloadmgr"):new{ onConfirm = function(path) @@ -667,7 +668,18 @@ function OPDSBrowser:showDownloads(item) end, }:chooseDir() end, - } + }, + { + text = _("Book information"), + enabled = type(item.content) == "string", + callback = function() + local TextViewer = require("ui/widget/textviewer") + UIManager:show(TextViewer:new{ + title = item.text, + text = util.htmlToPlainTextIfHtml(item.content), + }) + end, + }, }) self:createNewDownloadDialog(self.getCurrentDownloadDir(), buttons)