/srv/irclogs.ubuntu.com/2015/07/12/#ubuntu-app-devel.txt

=== c-nv-s_ is now known as c-nv-s
akiva-thinkpad!ping10:05
ubot5pong!10:05
akiva-thinkpadcool10:05
akiva-thinkpadports no longer blocked10:05
aquariusOK, who, other than Ken, knows about the Content Hub? I can't work out for the life of me how to use it :(18:09
ahayzenaquarius, what are you trying todo with it?18:33
aquariusahayzen, I have a list of the filenames of files in my app's data folder, and I show them in a ListView. I would like tapping a filename to show a list of apps on the phone which I can share that file to, and then choosing an app to open that file in that app.18:51
ahayzenok18:51
aquariusahayzen, and I cannot work out how. A ContentPeerPicker presumably has something to do with it.18:51
ahayzenyeah it will do... i've only done an import (need to still implement export for music)..but this may be useful..18:52
aquariusAlso, every example I can find shows a Page with a ContentPeerPicker in it, and the app pushes that Page onto a PageStack. But my app doesn't have a PageStack, it has Tabs, so I don't know how to even show the Picker, even if I could get it working, which I can't. :)18:52
ahayzenhttps://code.launchpad.net/~ken-vandine/+junk/hub-exporter18:52
aquariusYeah, I've done import; Readability appears in the browser's Share menu. It's being a source for sharing (without being a source for other apps that want to import a file) that I can't work out.18:53
aquariusYup, I've been looking at the hub exporter code, which as far as I can tell is the nearest thing to actual documentation of this stuff, but it's pretty impenetrable :(18:53
ahayzenso what have you got working so far?18:54
aquariusnothing. The actual ContentHub code is complaining about not having peers, but Ken's hub-importer doesn't even *mention* PeerModelLoader, so I have no idea where one of those comes from18:55
aquariusI can't even get started -- I can work out so little about this stuff that I don't even know what I don't know, if you see what I mean!18:55
ahayzenhe has a ContentPeerPicker {}18:56
ahayzenIIRC the way his works is to load up activeTransfer with the items to transfer18:57
ahayzenthen it then picker is shown18:57
ahayzenthen it calls __exportItems(url)18:57
aquariusHe does, and I have one too, but when I try to use it, I get "file:///usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Content/ContentPeerPicker.qml:229: TypeError: Cannot read property 'peers' of null"... and that code line is  "model: customPeerModelLoader ? customPeerModelLoader.item.peers : peerModelLoader.item.peers"... that is, it's expecting to have a PeerModelLoader or a CustomPeerModelLoader, and Ken doesn't18:58
aquariushave one, so I don't get how any of it works :)18:58
ahayzenugh i fear i'm going to have to figure this out for music soon as well :-)19:01
* ahayzen wonders if that is a type "customer" https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Content.ContentPeerPicker/#customerPeerModelLoader-prop19:03
ahayzen*typo lol19:03
aquariusI have been assuming that that's meant to be "custom", yeah :)19:03
ahayzenit says *optional*19:03
aquariusbut that is far from the worst fault in the documentation19:03
aquariusya, I *think* that if you want to provide your own peermodelloader you can set that to override the system one19:04
aquariusbut I don't seem to *have* the system one, and I don't know how to set it up, because the hub-importer never mentions it!19:04
ahayzenwhen you look at this page https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Content/ your just like which Content* thing do i want?!19:04
aquariusthis stuff is totally indecipherable; the docs are either low-level API docs or high-level handwavy "the content hub is for exchanging files between apps" stuff. There are no explanations of *how to use it* :(19:05
ahayzenwhat does you code look like currently?19:05
aquariushttp://pastebin.ubuntu.com/11868377/19:06
aquariusbut that's not useful19:06
aquariusbecause I'm literally just altering stuff at random ;)19:06
aquariusand clicking the listitem throws "ContentPeerPicker.qml:229: TypeError: Cannot read property 'peers' of null"19:06
ahayzen"ContentType.Uknown" https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Content.ContentType/19:08
ahayzenwho wrote these docs ? lol19:08
aquariusis there an app which can share a file to other apps, so I can look at the source? mzanetti's Tagger does it, I think, but I don't understand that either :)19:08
ahayzenyeah camera, gallery do as well IIRC19:09
mzanettiaquarius, huh? you mean content hub?19:09
ahayzenyup19:09
aquariusmzanetti, I do19:09
mzanettiaquarius, ~mzanetti/+junk/contenthubtest19:10
mzanettithis is a test app I use when I do something with contenthub19:10
aquariusooh, that sounds useful ;)19:10
mzanettiit can share and receive anything19:10
mzanettinot 100% finished yet19:10
aquariusthank you! I shall look at that19:10
mzanettiI plan to publish to store once it's ready... but should work fine for most parts already19:10
ahayzenaquarius, also just found this which is a text only exporter http://bazaar.launchpad.net/~ken-vandine/+junk/hub-text-exporter/view/head:/Main.qml which looks quite simple compared to the others19:12
aquariusmzanetti, what's the difference between "share" and "export"?19:15
ahayzenhaha19:15
aquariusthat's in the content hub api, it's not a peculiarity of mzanetti's app. But nothing describes what the difference is!19:16
ahayzeni did know the difference at one point...19:16
mzanettiaquarius, export is to "save" a file, share is to post it to facebook etc19:19
mzanettiaquarius, depending on which one you select you'll notice different apps showing up in the ContentPeerPicker19:19
ahayzenmzanetti, how does that filter it? by the type of content?19:20
mzanettitwo things. ContentType and handler (share vs export)19:20
ahayzenah ok so by having destination: [music] .. we only appear under export IIRC ?19:21
mzanettinot necessarily... every app accepting content can specify both19:21
mzanettiyou can also write an app to share music19:22
ahayzenyeah i need to make music a source of music at some point19:22
ahayzenso then you could go from the Clock and pick a track for your alarm19:22
ahayzenor your ringtone whatever19:23
aquariussince my app is basically like the file manager, I think I'd want a combination of both, but I don't know how to do that either..19:26
mzanettiaquarius, for sending things to other apps you need: the apparmor policy content_exchange_source19:28
mzanettiin your app have a "share" button, onClicked show a ContentPeerPicker with contentType: ContentType.All (or restrict to whatever) and handler ContentType.Share19:29
mzanettionPeerPicked, create a new ContentItem, set the url property to your file and and set it's state to Charged19:30
aquariusok, that makes sense; let me try that19:31
mzanettithen you can add a "save" or "open with..." button and do exactly the same, but set the picker's handler property to ContentHandler.Destination19:33
mzanettifor receiving content it's a bit different then...19:33
aquariusSimplest imaginable approach: all I want to do is show a ContentPeerPicker (I'm not even trying to do the transfer yet, so we'll screw up when a peer is picked), code at http://pastebin.ubuntu.com/11868561/ and it throws error "ContentPeerPicker.qml:229: TypeError: Cannot read property 'peers' of null" on startup... presumably because I don't set a PeerModel? Or something? Confused19:42
mzanettiaquarius, hmm... are you running it on the desktop?19:50
aquariusah. I am. That may be it. I'll try it on the phone, then...19:51
aquariussame error...19:54
aquariusContentPeerPicker10.qml:186: TypeError: Cannot read property 'peers' of null19:55
aquariuslet me try your contenthubtest and work out what's different :)20:12

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!