[owncloud-devel] Ubuntu Touch app - Need a few answers.

Vincent Petry pvince81 at owncloud.com
Mon Nov 17 19:39:16 GMT 2014


Hi,

It all depends what QML provides. If you have access to the binary data
of the file you might be able to send a PUT request through WebDAV to
ownCloud to upload a file.

From what I see here QML might be able to read local files:
http://askubuntu.com/questions/331270/how-to-read-file-
contents-in-qml
But someone commented there in 2013 that it's only for text files and
not binary files.
Also it means reading the WHOLE file into memory before sending it to
ownCloud, which is less than optimal for bigger files.

Maybe something to try, if QML supports it:
http://stackoverflow.com/questions/7255719/downloading-binary-data-using-xmlhttprequest-without-overridemimetype

Also from what I read in the past when wanting to write a QML + JS KDE
plasmoid I had the feeling that QML in itself isn't enough to write this
type of app, but requires to write the lower-level parts in C++ and call
the functions from QML. This also means that writing a pure JS library
might be quite tricky if not impossible.

If this was NodeJS I guess there are some libraries to read binary files
and streaming, but it seems QML might be lacking these.

Another API to look at: http://remotestorage.io/
At some point ownCloud had a remote storage API, but you might run into
the same shortcomings related to binary data.

Cheers,

Vincent

On 11/17/2014 08:23 PM, Daniel Holm wrote:
> Hi again,
>
>> I'm not aware of any existing Javascript library but I thought about
>> writing one at some point (server-side JS, not browser JS).
>> Something like https://github.com/PVince81/pyocclient but for
>> Javascript.
> That would indeed be awesome!
>> If QML's JS supports XMLHttpRequest it should be possible to write a
>> generic library based on such calls (goal would be to make it work
>> with QML, Node JS and later browsers)
>>
> QML's JS does support XmlHttpRequest from what I've understood. I think
> I've actually used it so I am fairly certain.
>
>
>> At some point I remember researching QML + Python (for writing a KDE
>> plasmoid) but I'm not sure they work together very well.
> I also think that PySide (or PyOtherSide) has made some progress with
> Qt5 and Python.
>
> Also, Michael:
> Thanks for the tip.
>
> But still, before this possible JS library is made, what would be the
> best way of uploading files?
>
> Sincerely,
> Daniel
>> Cheers,
>>
>> Vincent
>>
>> On 11/17/2014 05:11 PM, Daniel Holm wrote:
>>
>>> Hello everyone, 
>>>
>>> I'm, together with a team of five, developing a ownCloud integration
>>> service and application for Ubuntu Touch. 
>>>
>>> The project contains of two parts: 
>>> 1. A account provider and multiple services (contacts, calendar,
>>> files) 
>>> 2. The app - browser of files and such. 
>>>
>>> The app is, right now, just a WebView showing the actual web page of
>>> the OC instance. 
>>> That works fine, whle usig OC7 and we might make it use WebDAV
>>> further in the future. 
>>>
>>> Now, we want to upload files to the OC instance. I was thinking of
>>> using a cURL library in JavaaScript and upload using something
>>> like: 
>>> curl -X PUT -u username:password
>>> "http://yourserver.com/owncloud/remote.php/webdav/file.zip" -F
>>> myfile=@"/Users/Javi/Downloads/file.zip" 
>>>
>>> But I just wanted to ask: Is there an easier way of uploading
>>> files? 
>>>
>>> Our app uses QML and JavaScript ONLY. 
>>>
>>> Every time I seach for ownCloud and API I find like ShareAPI, which
>>> is for existing files in the cloud, and API for creating apps for
>>> the actual ownCloud web service. Correct me if I am wrong. 
>>>
>>> Any help would be highly appreciated. 
>>>
>>> I have no Android or iOS development experiance and am completely
>>> unable to understand any of that code. But I understand that the
>>> Android app has it's own library. 
>>>
>>> Project: https://launchpad.net/owncloud-app 
>>>
>>> Yours sincerely, 
>>> Daniel HolmHello everyone, 
>>>
>>> I'm, together with a team of five, developing a ownCloud integration
>>> service and application for Ubuntu Touch. 
>>>
>>> The project contains of two parts: 
>>> 1. A account provider and multiple services (contacts, calendar,
>>> files) 
>>> 2. The app - browser of files and such. 
>>>
>>> The app is, right now, just a WebView showing the actual web page of
>>> the OC instance. 
>>> That works fine, whle usig OC7 and we might make it use WebDAV
>>> further in the future. 
>>>
>>> Now, we want to upload files to the OC instance. I was thinking of
>>> using a cURL library in JavaaScript and upload using something
>>> like: 
>>> curl -X PUT -u username:password
>>> "http://yourserver.com/owncloud/remote.php/webdav/file.zip" -F
>>> myfile=@"/Users/Javi/Downloads/file.zip" 
>>>
>>> But I just wanted to ask: Is there an easier way of uploading
>>> files? 
>>>
>>> Our app uses QML and JavaScript ONLY. 
>>>
>>> Every time I seach for ownCloud and API I find like ShareAPI, which
>>> is for existing files in the cloud, and API for creating apps for
>>> the actual ownCloud web service. Correct me if I am wrong. 
>>>
>>> Any help would be highly appreciated. 
>>>
>>> I have no Android or iOS development experiance and am completely
>>> unable to understand any of that code. But I understand that the
>>> Android app has it's own library. 
>>>
>>> Project: https://launchpad.net/owncloud-app 
>>>
>>> Yours sincerely, 
>>> Daniel Holm 
>>>
>>>
>>>
>>> _______________________________________________
>>> Devel mailing list
>>> Devel at owncloud.org
>>> http://mailman.owncloud.org/mailman/listinfo/devel
>> _______________________________________________
>> Devel mailing list
>> Devel at owncloud.org
>> http://mailman.owncloud.org/mailman/listinfo/devel




More information about the Devel mailing list