@@ -16,14 +16,10 @@
1616
1717import QtQuick 2.4
1818import Ubuntu.Components 1.3
19−import Ubuntu.Components.Popups 1.3
2019import Ubuntu.Content 1.3
21−import Ubuntu.DownloadManager 1.2
22−
2320import Backend 1.0
2421
2522
26−
2723Page {
2824 id: picker
2925 property var activeTransfer
@@ -32,39 +28,49 @@ Page {
3228 property string handler
3329 property string contentType
3430
35− property var popup
36−
3731 signal cancel()
3832 signal imported(string fileUrl)
3933
40− header: PageHeader {
41− title: i18n.tr("Save with")
34+ header: PageHeader{
35+ title: i18n.tr("Save With")
36+ leadingActionBar.actions:[
37+ Action {
38+ id: backAction
39+ iconName: "back"
40+ text: i18n.tr('Back')
41+ onTriggered:{
42+ Backend.removeDownload(picker.url)
43+ pageStack.pop()
44+ }
45+ }
46+ ]
4247 }
43−
4448 ContentPeerPicker {
4549 anchors { fill: parent; topMargin: picker.header.height }
4650 visible: parent.visible
47− showTitle: true
51+ showTitle: false
4852 contentType: ContentType.All
49− handler: ContentHandler.Destination
53+ handler: ContentHandler.Share
5054
5155 onPeerSelected: {
5256 //peer.selectionType = ContentTransfer.Single
5357 picker.activeTransfer = peer.request()
5458 picker.activeTransfer.stateChanged.connect(function() {
5559 if (picker.activeTransfer.state === ContentTransfer.InProgress) {
56− console.log("In progress");
60+ console.log("In progress " + picker.url);
5761 //picker.activeTransfer.items = picker.activeTransfer.items[0].url = url;
58− console.log(picker.url)
59− picker.activeTransfer.items = [ resultComponent.createObject(parent, {"url": picker.url}) ];
60−
62+ picker.activeTransfer.items = [ resultComponent.createObject(parent, {"url": "file://" + picker.url}) ];
6163 picker.activeTransfer.state = ContentTransfer.Charged;
6264 Backend.removeDownload(picker.url)
6365 pageStack.pop()
6466 }
67+
6568 })
6669 }
70+
71+
6772 onCancelPressed: {
73+ Backend.removeDownload()
6874 Backend.removeDownload(picker.url)
6975 pageStack.pop()
7076 }
@@ -75,59 +81,8 @@ Page {
7581 anchors.fill: parent
7682 activeTransfer: picker.activeTransfer
7783 }
78−
79− SingleDownload {
80− id: singleDownload
81−
82− metadata: Metadata {
83− showInIndicator: true
84− }
85−
86− onFinished: function (path) {
87− picker.url = "file://" + path
88− PopupUtils.close(picker.popup)
89− }
90−
91− onCanceled: function () {
92− PopupUtils.close(picker.popup)
93− pageStack.pop()
94− }
95− }
9684 Component {
9785 id: resultComponent
9886 ContentItem {}
9987 }
100−
101− Component.onCompleted: function () {
102− picker.popup = PopupUtils.open(dialogComponent)
103− singleDownload.metadata.title = url.substring(url.lastIndexOf("/")+1)
104− singleDownload.download(url)
105− }
106−
107− Component {
108− id: dialogComponent
109− Dialog {
110−
111− id: downloadDialog
112− title: i18n.tr("Downloading")
113−
114− ProgressBar {
115− minimumValue: 0
116− maximumValue: 100
117− value: singleDownload.progress
118−
119− anchors {
120− left: parent.left
121− right: parent.right
122− }
123− }
124−
125− Button {
126− text: i18n.tr("Cancel")
127− onClicked: {
128− singleDownload.cancel()
129− }
130− }
131− }
132− }
13388}