Libreoffice: improvement + add features

This commit is contained in:
lxsang
2022-08-24 13:34:57 +02:00
parent 6e020484a8
commit 96ef0ac0de
10 changed files with 177 additions and 30 deletions

View File

@ -9,4 +9,9 @@ It support a wide range of documents.
![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true)
## Change log
- v 0.1.1-a:
* improve UI handling
* add Save as option
* add traditional AntOS application File menu
* fetch supported mimes from discovery URL
- v 0.1.0-a: Initial version

View File

@ -1,11 +1,14 @@
local args=...
--LOG_ROOT = ulib.getenv("HOME")
if not args then
args = REQUEST
end
local vfs = require("vfs")
local DLCMD="wget --no-check-certificate -O"
local handle = {}
--local logger = Logger:new{ levels = {INFO = true, ERROR = true, DEBUG = false}}
local result = function(data)
return { error = false, result = data }
end
@ -24,6 +27,21 @@ handle.token = function(data)
return result(ret)
end
handle.duplicate = function(data)
if not data.src or not data.dest then
return error("Unknow source or destination file")
end
local real_src = vfs.ospath(data.src)
local real_dest = vfs.ospath(data.dest)
if not ulib.exists(real_src) then
return error("Source file doesnt exist")
end
if not ulib.send_file(real_src, real_dest) then
return error("Unable to duplicate file")
end
return result(true)
end
handle.discover = function(data)
local tmpfile = "/tmp/libreoffice_discover.xml"
local cmd = DLCMD.." "..tmpfile..' '..data.uri
@ -67,7 +85,8 @@ handle.file = function(data)
Size = math.floor(stat.size),
UserCanWrite = vfs.checkperm(data.file,"write"),
mime = stat.mime,
PostMessageOrigin = "*"
PostMessageOrigin = "*",
UserCanNotWriteRelative = false
}
else
return error("Unknown request")
@ -75,6 +94,8 @@ handle.file = function(data)
end
--logger:info(JSON.encode(REQUEST))
if args.action and handle[args.action] then
return handle[args.action](args.args)
else

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.0-a",
"version":"0.1.1-a",
"category":"Office",
"icon":"icon.png",
"mimes":[