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