~michael-sheldon/content-hub/peer_picker_ui_weaved

« back to all changes in this revision

Viewing changes to examples/export-qml/app-exporter.qml

  • Committer: Michael Sheldon
  • Date: 2014-03-20 21:17:18 UTC
  • mfrom: (71.4.71 peer_picker_ui)
  • Revision ID: michael.sheldon@canonical.com-20140320211718-4n2yjluhq7xh5b7q
Weave merge peer_picker_ui

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
MainView {
8
8
    id: root
9
 
    applicationName: "com.ubuntu.developer.ken-vandine.hub-exporter"
 
9
    applicationName: "app-exporter"
10
10
    width: units.gu(50)
11
11
    height: units.gu(60)
12
12
 
14
14
    property var selectedItems: []
15
15
    property var activeTransfer
16
16
 
17
 
    function __returnResult() {
18
 
        activeTransfer.items = selectedItems;
19
 
        activeTransfer.state = ContentTransfer.Charged;
20
 
    }
21
 
 
22
17
    ListModel {
23
18
        id: images
24
19
 
122
117
                    contentWidth: childrenRect.width
123
118
 
124
119
                    actions: ActionList {
125
 
                      Action {
126
 
                          text: "Open with..."
127
 
                          onTriggered: {
128
 
                              print(text + ": " + src);
129
 
                              activeTransfer = ContentHub.exportContent(ContentType.Pictures, picDest);
130
 
                              activeTransfer.items = [ resultComponent.createObject(root, {"url": src}) ];
131
 
                              actPop.hide();
132
 
                          }
133
 
                      }
134
 
                      Action {
135
 
                          text: "Share"
136
 
                          onTriggered: {
137
 
                              print(text + ": " + src);
138
 
                              activeTransfer = ContentHub.shareContent(ContentType.Pictures, picShare);
139
 
                              activeTransfer.items = [ resultComponent.createObject(root, {"url": src}) ];
140
 
                              actPop.hide();
141
 
                          }
142
 
                      }
 
120
                        Action {
 
121
                            text: "Open with..."
 
122
                            onTriggered: {
 
123
                                print(text + ": " + src);
 
124
                                activeTransfer = picDest.request();
 
125
                                activeTransfer.items = [ resultComponent.createObject(root, {"url": src}) ];
 
126
                                activeTransfer.state = ContentTransfer.Charged;
 
127
                                actPop.hide();
 
128
                            }
 
129
                        }
 
130
                        Action {
 
131
                            text: "Share"
 
132
                            onTriggered: {
 
133
                                print(text + ": " + src);
 
134
                                activeTransfer = picShare.request();
 
135
                                activeTransfer.items = [ resultComponent.createObject(root, {"url": src}) ];
 
136
                                activeTransfer.state = ContentTransfer.Charged;
 
137
                                actPop.hide();
 
138
                            }
 
139
                        }
143
140
                    }
144
141
                }
145
142
            }
148
145
 
149
146
    ContentPeer {
150
147
        id: picDest
151
 
        appId: "com.ubuntu.developer.ken-vandine.hub-importer_hub-importer_0.2"
 
148
        // well know content type
 
149
        contentType: ContentType.Pictures
 
150
        // Type of handler: Source, Destination, or Share
 
151
        handler: ContentHandler.Destination
 
152
        // Optional appId, if this isn't specified the hub will use the default
 
153
        //appId: ""
152
154
    }
153
155
 
154
156
    ContentPeer {
155
157
        id: picShare
156
 
        appId: "com.ubuntu.developer.ken-vandine.hub-share_hub-share_0.2"
 
158
        // well know content type
 
159
        contentType: ContentType.Pictures
 
160
        // Type of handler: Source, Destination, or Share
 
161
        handler: ContentHandler.Share
 
162
        // Optional appId, if this isn't specified the hub will use the default
 
163
        appId: "pkg_app_version"
157
164
    }
158
165
 
159
 
    ContentImportHint {
 
166
    // Provides overlay showing another app is being used to complete the request
 
167
    // formerly named ContentImportHint
 
168
    ContentTransferHint {
160
169
        anchors.fill: parent
161
170
        activeTransfer: activeTransfer
162
171
    }