13
12
property list<ContentItem> importItems
14
13
property var activeTransfer
15
property list<ContentPeer> peers
18
function _importFromPeer(peer) {
19
/* if peer is null, choose default */
21
peer = ContentHub.defaultSourceForType(ContentType.Pictures);
22
var transfer = ContentHub.importContent(ContentType.Pictures, peer);
23
var store = ContentHub.defaultStoreForType(ContentType.Pictures);
24
console.log("Store is: " + store.uri);
25
if (transfer !== null) {
26
transfer.selectionType = ContentTransfer.Multiple;
27
transfer.setStore(store);
28
activeTransfer = transfer;
29
activeTransfer.start();
33
Component.onCompleted: {
34
peers = ContentHub.knownSourcesForType(ContentType.Pictures);
18
// well know content type
19
contentType: ContentType.Pictures
20
// Type of handler: Source, Destination, or Share
21
handler: ContentHandler.Source
22
// Optional appId, if this isn't specified the hub will use the default
26
// Optional store to use for persistent storage of content
29
scope: ContentScope.App
32
// Provides a list<ContentPeer> suitable for use as a model
35
// Type of handler: Source, Destination, or Share
36
handler: ContentHandler.Source
37
// well know content type
38
contentType: ContentType.Pictures
42
46
top: importButtons.bottom
44
48
height: childrenRect.height
49
model: picSources.peers
47
51
delegate: ListItem.Standard {
48
52
text: modelData.name
52
_importFromPeer(modelData);
56
// Request the transfer, it needs to be created and dispatched from the hub
57
activeTransfer = modelData.request();
65
70
text: "Import from default"
67
_importFromPeer(null);
72
// Request the transfer, it needs to be created and dispatched from the hub
73
// Specify a location to use for permanent storage
74
activeTransfer = picSource.request(appStore);
117
// Provides overlay showing another app is being used to complete the request
118
// formerly named ContentImportHint
119
ContentTransferHint {
112
120
anchors.fill: parent
113
activeTransfer: root.activeTransfer
121
activeTransfer: activeTransfer
117
target: root.activeTransfer
125
target: activeTransfer
118
126
onStateChanged: {
119
127
console.log("StateChanged: " + activeTransfer.state);
120
128
if (activeTransfer.state === ContentTransfer.Charged)