mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
PocketBook: Open links in the on-device web browser (#11787)
Many PocketBook devices include a web browser, but when clicking a link in KOReader, there was no option to open the link in the browser, there was only an option to show a QR code (which can then be scanned by a smartphone). This commit implements `canOpenLink`/`openLink` on PocketBook using the "browser.app", if available. Tested on PB740 (InkPad 3). Fixes: https://github.com/koreader/koreader/issues/11782 Related: https://github.com/koreader/koreader/issues/6597
This commit is contained in:
@@ -428,6 +428,25 @@ function PocketBook:setEventHandlers(uimgr)
|
||||
end
|
||||
end
|
||||
|
||||
local function getBrowser()
|
||||
if util.pathExists("/usr/bin/browser.app") then
|
||||
return true, "/usr/bin/browser.app"
|
||||
elseif util.pathExists("/ebrmain/bin/browser.app") then
|
||||
return true, "/ebrmain/bin/browser.app"
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function PocketBook:canOpenLink()
|
||||
return inkview.MultitaskingSupported() and getBrowser()
|
||||
end
|
||||
|
||||
function PocketBook:openLink(link)
|
||||
local found, bin = getBrowser()
|
||||
if not found or not link or type(link) ~= "string" then return end
|
||||
inkview.OpenBook(bin, link, 0)
|
||||
end
|
||||
|
||||
-- Pocketbook HW rotation modes start from landsape, CCW
|
||||
local function landscape_ccw() return {
|
||||
1, 0, 3, 2, -- PORTRAIT, LANDSCAPE, PORTRAIT_180, LANDSCAPE_180
|
||||
|
||||
Reference in New Issue
Block a user