2


I'm writing an app and I'm trying to incorporate content hub into it.
My app downloads various file formats so I want to be able to export images, videos and other types of content to other apps.
I followed this content hub guide but found it lacking in examples for exporting content.
Anyway, when I'm trying to export any content, the transfer's state always changes to "aborted" immediately and I have no idea why.
Here is my OpenContentPopup component:

PopupBase {
    id: root

    property var activeTransfer
    property var items: []
    property alias contentType: peerPicker.contentType

    Connections {
        target: activeTransfer
        onStateChanged: {
            console.log("Transfer state changed to " + activeTransfer.state)
        }
    }

    ContentPeerPicker {
        id: peerPicker
        handler: ContentHandler.Destination

        onPeerSelected: {
            for (var i = 0; i < items.length; i++) {
                console.log("Sharing item with name: " + items[i].name + ", url: " + items[i].url)
            }

            activeTransfer = peer.request()
            activeTransfer.items = root.items
            activeTransfer.state = ContentTransfer.Charged
            PopupUtils.close(root)
        }

        onCancelPressed: {
            PopupUtils.close(root)
        }
    }
}

When I'm trying to export an image the ContentPeerPicker gives me the option to open the Gallery app, but when I select the gallery app the gallery app isn't opened and it appears that the transfer's state is aborted (or 5..).
My logs in the code example give me:

<debug> Sharing item with name: name, url: file:///home/phablet/.local/share/com.nogzatalz.downow/download/Cover.jpg
<debug> Transfer state changed to 5

manifest.json:

{
    "name": "com.nogzatalz.downow",
    "description": "Torrent downloading app",
    "framework": "ubuntu-sdk-14.10-qml-dev3",
    "architecture": "armhf",
    "title": "DowNow",
    "hooks": {
        "downow": {
            "desktop": "downow.desktop",
            "apparmor": "apparmor.json",
            "urls": "urldispatcher.json",
            "content-hub": "content-hub.json"
        }
    },
    "version": "0.1.28",
    "maintainer": "DowNow Support <[email protected]>"
}

content-hub.json:

{
    "source": [
        "pictures",
        "videos"
    ]
}

apparmor.json:

{
    "policy_groups": [
        "networking",
        "content_exchange",
        "content_exchange_source",
        "audio"
    ],
    "policy_version": 1.2
}

I really think we need better error messages..
Any help is appreciated!
Thanks, Tal

6
  • Shouldn't it be activeTransfer.start() ? Aug 15, 2014 at 11:26
  • I see you've taken it out of webbrowser-app Aug 15, 2014 at 11:36
  • Here are the files for the Sharing in webbrowser-app: bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/files/… Aug 15, 2014 at 11:41
  • Yeah, I did use the ContentShareDialog.qml file from webbrowser-app as a base. Although I can't see what I'm doing wrong here..
    – meta221
    Aug 15, 2014 at 12:56
  • I tried also adding activeTransfer.start() but that did not help.
    – meta221
    Aug 15, 2014 at 12:57

2 Answers 2

1

I think the problem is you are trying to charge it before the transfer is ready. Look at this as an example:

http://bazaar.launchpad.net/~ken-vandine/+junk/hub-exporter/view/head:/hub-exporter.qml#L426

0

Apparently the code I shared was correct.
In my main function I had:

setenv("APP_ID", "com.nogzatalz.downow", /*overwrite*/ true);

I guess that messed up app armor..
I only put it there because I used to get errors about APP_ID not being set or something..
Anyway, Thanks for all your help everyone! =)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .