Debian Codegraph @

qml/components/SharePopover.qml

raw
1 /*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 import QtQuick 2.12
18 import Lomiri.Components 1.3
19 import Lomiri.Components.Popups 1.3
20 import Lomiri.Content 1.3
21
22 PopupBase {
23 property var transferContentType
24 property var transferItems
25
26 signal contentPeerSelected()
27
28 fadingAnimation: LomiriNumberAnimation { duration: LomiriAnimation.SnapDuration }
29
30 Component.onCompleted: {
31 contentPeerPicker.peerSelected.connect(contentPeerSelected);
32 }
33
34 ContentPeerPicker {
35 id: contentPeerPicker
36 // FIXME: ContentPeerPicker should define an implicit size and not refer to its parent
37 Component.onCompleted: {
38 contentType = parent.transferContentType;
39 }
40 handler: ContentHandler.Share
41
42 onPeerSelected: {
43 var transfer = peer.request();
44 if (transfer.state === ContentTransfer.InProgress) {
45 transfer.items = parent.transferItems;
46 transfer.state = ContentTransfer.Charged;
47 }
48 PopupUtils.close(sharePopover);
49 }
50 onCancelPressed: PopupUtils.close(sharePopover);
51 }
52 }
53