mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[UX] Add Device:openLink() stub for Linux SDL (#4822)
References #4821.
This commit is contained in:
@@ -614,6 +614,11 @@ function ReaderLink:onGotoLink(link, neglect_current_location, allow_footnote_po
|
||||
return true
|
||||
end
|
||||
|
||||
-- try opening link in native browser
|
||||
if Device:openLink(link_url) then
|
||||
return true
|
||||
end
|
||||
|
||||
-- Not supported
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("Invalid or external link:\n%1"), link_url),
|
||||
|
||||
@@ -64,6 +64,8 @@ local Device = {
|
||||
|
||||
-- set to yes on devices that support over-the-air incremental updates.
|
||||
hasOTAUpdates = no,
|
||||
|
||||
openLink = no,
|
||||
}
|
||||
|
||||
function Device:new(o)
|
||||
|
||||
@@ -17,6 +17,10 @@ local Device = Generic:new{
|
||||
needsScreenRefreshAfterResume = no,
|
||||
hasColorScreen = yes,
|
||||
hasEinkScreen = no,
|
||||
openLink = function(self, link)
|
||||
if not link or type(link) ~= "string" then return end
|
||||
return os.execute("xdg-open '"..link.."'") == 0
|
||||
end,
|
||||
}
|
||||
|
||||
local AppImage = Device:new{
|
||||
|
||||
@@ -236,7 +236,7 @@ function OTAManager:fetchAndProcessUpdate()
|
||||
android.notification(T(_("Downloading %1"), ota_package))
|
||||
end
|
||||
elseif Device:isSDL() then
|
||||
os.execute("xdg-open '"..link.."'")
|
||||
Device:openLink(link)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user