| 1 |
/* |
| 2 |
* Copyright (C) 2012-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.4 |
| 18 |
import QtContacts 5.0 |
| 19 |
|
| 20 |
import Lomiri.Components 1.3 |
| 21 |
import Lomiri.Content 1.3 as ContentHub |
| 22 |
|
| 23 |
import Lomiri.AddressBook.Base 0.1 |
| 24 |
|
| 25 |
Page { |
| 26 |
id: root |
| 27 |
|
| 28 |
property alias contactModel: exporter.contactModel |
| 29 |
property var contacts |
| 30 |
|
| 31 |
signal canceled() |
| 32 |
signal completed() |
| 33 |
|
| 34 |
// invisible header |
| 35 |
header: Item { height: 0 } |
| 36 |
ContentHub.ContentPeerPicker { |
| 37 |
visible: true |
| 38 |
anchors.fill: parent |
| 39 |
contentType: ContentHub.ContentType.Contacts |
| 40 |
handler: ContentHub.ContentHandler.Share |
| 41 |
|
| 42 |
onPeerSelected: { |
| 43 |
exporter.activeTransfer = peer.request(); |
| 44 |
if (exporter.activeTransfer.state === ContentHub.ContentTransfer.InProgress) { |
| 45 |
exporter.start(root.contacts) |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
onCancelPressed: { |
| 50 |
if (exporter.activeTransfer) { |
| 51 |
exporter.activeTransfer.state = ContentHub.ContentTransfer.Aborted |
| 52 |
} |
| 53 |
if (root.pageStack.removePages) |
| 54 |
root.pageStack.removePages(root) |
| 55 |
else |
| 56 |
root.pageStack.pop() |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
ContactExporter { |
| 61 |
id: exporter |
| 62 |
|
| 63 |
onDone: { |
| 64 |
if (root.pageStack.removePages) |
| 65 |
root.pageStack.removePages(root) |
| 66 |
else |
| 67 |
root.pageStack.pop() |
| 68 |
} |
| 69 |
} |
| 70 |
} |