~content-hub-team/content-hub/trunk

« back to all changes in this revision

Viewing changes to examples/import-qml/import.qml

  • Committer: Tarmac
  • Author(s): Ken VanDine
  • Date: 2013-09-30 18:39:00 UTC
  • mfrom: (48.1.1 content-hub-lp1231368)
  • Revision ID: tarmac-20130930183900-61vw3dr45uph3six
Pulled back in all the changes that were reverted in rev 47.  Bug (LP: #1231368) seemed to be caused by gallery-app needing a rebuild against this version of content-hub.

Approved by PS Jenkins bot, Günter Schwann.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
import Ubuntu.Content 0.1
6
6
 
7
 
Rectangle {
 
7
MainView {
 
8
    applicationName: "import-qml"
8
9
    width: 300
9
10
    height: 200
10
11
 
17
18
        onClicked: {
18
19
            var peer = ContentHub.defaultSourceForType(ContentType.Pictures);
19
20
            var transfer = ContentHub.importContent(ContentType.Pictures, peer);
 
21
            var store = ContentHub.defaultStoreForType(ContentType.Pictures);
 
22
            console.log("Store is: " + store.uri);
20
23
            if (transfer !== null) {
21
24
                transfer.selectionType = ContentTransfer.Multiple;
 
25
                transfer.setStore(store);
22
26
                activeTransfer = transfer;
23
27
                activeTransfer.start();
24
28
            }
25
29
        }
26
30
    }
27
31
 
 
32
    Button {
 
33
        anchors.left: importButton.right
 
34
        text: "Finalize import"
 
35
        enabled: activeTransfer.state === ContentTransfer.Collected
 
36
        onClicked: activeTransfer.finalize()
 
37
    }
 
38
 
28
39
    ListView {
29
40
        anchors {
30
41
            left: parent.left
55
66
    Connections {
56
67
        target: activeTransfer
57
68
        onStateChanged: {
 
69
            console.log("StateChanged: " + activeTransfer.state);
58
70
            if (activeTransfer.state === ContentTransfer.Charged)
59
71
                importItems = activeTransfer.items;
60
72
        }