File: export.qml

package info (click to toggle)
content-hub 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,856 kB
  • sloc: cpp: 7,324; xml: 307; sh: 69; makefile: 35; ansic: 19
file content (62 lines) | stat: -rw-r--r-- 1,638 bytes parent folder | download | duplicates (3)
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
56
57
58
59
60
61
62
import QtQuick 2.0
import Lomiri.Components 0.1
import Lomiri.Content 0.1

MainView {
    id: root
    width: 300
    height: 200

    property bool pickMode: activeTransfer.state === ContentTransfer.InProgress
    property list<ContentItem> selectedItems
    property var activeTransfer

    Button {
        id: button1
        anchors.top: parent.top
        anchors.left: parent.left
        enabled: pickMode
        text: "Return URL1"
        onClicked: {
            selectedItems = [ resultComponent.createObject(root, {"url": "file:///picture_1.jpg"}) ];
            activeTransfer.items = selectedItems;
        }
    }

    Button {
        id: button2
        anchors.top: parent.top
        anchors.right: parent.right
        enabled: pickMode
        text: "Return Url2"
        onClicked: {
            selectedItems.push(resultComponent.createObject(root, {"url": "file:///picture_1.jpg"}));
            selectedItems.push(resultComponent.createObject(root, {"url": "file:///picture_2.jpg"}));
            console.log(selectedItems[0].url + "/" + selectedItems[1].url)
            activeTransfer.items = selectedItems;
        }
    }

    Button {
        id: buttonAbort
        anchors.bottom: parent.bottom
        anchors.horizontalCenter: parent.horizontalCenter
        enabled: pickMode
        text: "Cancel"
        onClicked: {
            activeTransfer.state = ContentTransfer.Aborted;
        }
    }

    Component {
        id: resultComponent
        ContentItem {}
    }

    Connections {
        target: ContentHub
        onExportRequested: {
            activeTransfer = transfer
        }
    }
}