~rick-rickspencer3/+junk/flash2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import QtQuick 2.0
import Ubuntu.Components 1.1
import Ubuntu.Components.Popups 1.0
import Ubuntu.Content 1.1

Dialog {
    id: addSoundDialog
    property var activeTransfer
    property var importedSound
    signal soundImported(string setName)

    title: "Add Sound"
    Column{
        height: mainView.height
        width: mainView.width
            Connections {
                target: activeTransfer
                onStateChanged:{
                     if(activeTransfer.state === ContentTransfer.Charged) {
                        importedSound = activeTransfer.items[0]
                        peerPicker.visible = false
                         if (activeTransfer.items.length > 0) {
                                             var soundUri = activeTransfer.items[0].url;
                                             print(soundUri);
                                         }

                         PopupUtils.close(soundDialog)
                         //fire the signal
                    }
                }
            }
             ContentPeerPicker {
                            id: peerPicker
                            visible: true

                            // Type of handler: Source, Destination, or Share
                            handler: ContentHandler.Source

                            // well know content type
                            contentType: ContentType.All

                            onPeerSelected: {
                                peer.selectionType = ContentTransfer.Single
                                activeTransfer = peer.request(soundStore);
                            }
                            onCancelPressed: {
                                PopupUtils.close(soundDialog)
                            }
                        }
         }
        ContentStore {
            id: soundStore
            scope: ContentScope.App
        }
}