Merge lp:~renatofilho/address-book-app/contact-share into lp:~phablet-team/address-book-app/staging
- contact-share
- Merge into staging
Status: | Merged |
---|---|
Merged at revision: | 185 |
Proposed branch: | lp:~renatofilho/address-book-app/contact-share |
Merge into: | lp:~phablet-team/address-book-app/staging |
Diff against target: |
608 lines (+137/-247) 14 files modified
CMakeLists.txt (+0/-1) click/address-book-content.json (+3/-0) debian/control (+0/-1) src/app/CMakeLists.txt (+0/-7) src/app/addressbookapp.cpp (+0/-10) src/app/addressbookapp.h (+0/-3) src/app/contentcommunicator.cpp (+0/-140) src/app/contentcommunicator.h (+0/-61) src/imports/CMakeLists.txt (+1/-0) src/imports/ContactList/ContactListPage.qml (+43/-18) src/imports/ContactShare/CMakeLists.txt (+10/-0) src/imports/ContactShare/ContactSharePage.qml (+62/-0) src/imports/ContactView/ContactView.qml (+11/-0) src/imports/MainWindow.qml (+7/-6) |
To merge this branch: | bzr merge lp:~renatofilho/address-book-app/contact-share |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Michael Sheldon (community) | Approve | ||
Review via email: mp+222879@code.launchpad.net |
This proposal supersedes a proposal from 2014-06-02.
Commit message
Implemented contact share.
Replaced ContentHub API with QML API.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:235
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Michael Sheldon (michael-sheldon) wrote : Posted in a previous version of this proposal | # |
Couple of issue, when sharing I'm now getting:
file://
And when either exporting to another application or sharing, the exported .vcf file contains *all* contacts, not just the selected/shared ones.
Also as a minor thing the import of Ubuntu.
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
Are there any related MPs required for this MP to build/function as expected? YES
lp:~renatofilho/address-book-app/new-designer-contact-list
Is your branch in sync with latest trunk: YES
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES
Did you successfully run all tests found in your component's Test Plan on device or emulator? ?YES
If you changed the UI, was the change specified/approved by design? NO UI CHANGE
If you changed the packaging (debian), did you subscribe a core-dev to this MP? NO PACKAGE CHANGE
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
Are there any related MPs required for this MP to build/function as expected? YES
lp:~renatofilho/address-book-app/new-designer-contact-list
Is your branch in sync with latest trunk: YES
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator? YES
Did you successfully run all tests found in your component's Test Plan on device or emulator? ?YES
If you changed the UI, was the change specified/approved by design? NO UI CHANGE
If you changed the packaging (debian), did you subscribe a core-dev to this MP? YES
Michael Sheldon (michael-sheldon) wrote : Posted in a previous version of this proposal | # |
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
* Yes
Did CI run pass? If not, please explain why.
* Failed due to unrelated issues (old SDK package in Jenkins)
Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
* Yes
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:236
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:236
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:236
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:237
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:184
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Michael Sheldon (michael-sheldon) wrote : | # |
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
* Yes
Did CI run pass? If not, please explain why.
* Yes
Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
* Yes
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:185
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Preview Diff
1 | === modified file 'CMakeLists.txt' |
2 | --- CMakeLists.txt 2014-06-05 16:35:45 +0000 |
3 | +++ CMakeLists.txt 2014-06-12 12:40:31 +0000 |
4 | @@ -17,7 +17,6 @@ |
5 | find_package(Qt5Quick) |
6 | find_package(Qt5DBus) |
7 | find_package(PkgConfig REQUIRED) |
8 | -pkg_check_modules(CONTENTHUB REQUIRED libcontent-hub) |
9 | |
10 | set(ADDRESS_BOOK_APP_DIR ${CMAKE_INSTALL_DATADIR}/address-book-app) |
11 | set(ADDRESS_BOOK_APP_FULL_DIR ${CMAKE_INSTALL_FULL_DATADIR}/address-book-app) |
12 | |
13 | === modified file 'click/address-book-content.json' |
14 | --- click/address-book-content.json 2014-03-12 01:34:34 +0000 |
15 | +++ click/address-book-content.json 2014-06-12 12:40:31 +0000 |
16 | @@ -1,4 +1,7 @@ |
17 | { |
18 | + "destination": [ |
19 | + "contacts" |
20 | + ], |
21 | "source": [ |
22 | "contacts" |
23 | ] |
24 | |
25 | === modified file 'debian/control' |
26 | --- debian/control 2014-06-06 21:02:16 +0000 |
27 | +++ debian/control 2014-06-12 12:40:31 +0000 |
28 | @@ -5,7 +5,6 @@ |
29 | Build-Depends: cmake, |
30 | debhelper (>= 9), |
31 | dh-translations, |
32 | - libcontent-hub-dev, |
33 | libgl1-mesa-dev | libgl-dev, |
34 | libgles2-mesa-dev, |
35 | python3, |
36 | |
37 | === modified file 'src/app/CMakeLists.txt' |
38 | --- src/app/CMakeLists.txt 2014-05-28 20:25:19 +0000 |
39 | +++ src/app/CMakeLists.txt 2014-06-12 12:40:31 +0000 |
40 | @@ -4,14 +4,11 @@ |
41 | |
42 | include_directories( |
43 | ${CMAKE_BINARY_DIR} |
44 | - ${CONTENTHUB_INCLUDE_DIRS} |
45 | ) |
46 | |
47 | set(ADDRESS_BOOK_APP_SRCS |
48 | addressbookapp.h |
49 | addressbookapp.cpp |
50 | - contentcommunicator.h |
51 | - contentcommunicator.cpp |
52 | imagescalethread.h |
53 | imagescalethread.cpp |
54 | main.cpp |
55 | @@ -23,10 +20,6 @@ |
56 | |
57 | qt5_use_modules(${ADDRESS_BOOK_APP_BIN} Gui Core Qml Quick DBus) |
58 | |
59 | -target_link_libraries(${ADDRESS_BOOK_APP_BIN} |
60 | - ${CONTENTHUB_LIBRARIES} |
61 | -) |
62 | - |
63 | install(TARGETS ${ADDRESS_BOOK_APP_BIN} |
64 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
65 | ) |
66 | |
67 | === modified file 'src/app/addressbookapp.cpp' |
68 | --- src/app/addressbookapp.cpp 2014-06-05 19:22:08 +0000 |
69 | +++ src/app/addressbookapp.cpp 2014-06-12 12:40:31 +0000 |
70 | @@ -17,7 +17,6 @@ |
71 | #include "config.h" |
72 | #include "addressbookapp.h" |
73 | #include "imagescalethread.h" |
74 | -#include "contentcommunicator.h" |
75 | |
76 | #include <QDir> |
77 | #include <QUrl> |
78 | @@ -94,7 +93,6 @@ |
79 | AddressBookApp::AddressBookApp(int &argc, char **argv) |
80 | : QGuiApplication(argc, argv), |
81 | m_view(0), |
82 | - m_contentComm(0), |
83 | m_syncMonitor(0), |
84 | m_pickingMode(false), |
85 | m_testMode(false), |
86 | @@ -151,10 +149,7 @@ |
87 | qCritical("Library qttestability load failed!"); |
88 | } |
89 | m_testMode = true; |
90 | - } else { |
91 | - m_contentComm = new ContentCommunicator(this); |
92 | } |
93 | - |
94 | /* Ubuntu APP Manager gathers info on the list of running applications from the .desktop |
95 | file specified on the command line with the desktop_file_hint switch, and will also pass a stage hint |
96 | So app will be launched like this: |
97 | @@ -186,7 +181,6 @@ |
98 | m_view->setTitle("AddressBook"); |
99 | m_view->engine()->addImportPath(QCoreApplication::applicationDirPath() + "/" + importPath("")); |
100 | m_view->rootContext()->setContextProperty("QTCONTACTS_MANAGER_OVERRIDE", defaultManager); |
101 | - m_view->rootContext()->setContextProperty("contactContentHub", m_contentComm); |
102 | m_view->rootContext()->setContextProperty("application", this); |
103 | m_view->rootContext()->setContextProperty("contactKey", contactKey); |
104 | m_view->rootContext()->setContextProperty("TEST_DATA", testData); |
105 | @@ -220,10 +214,6 @@ |
106 | if (m_view) { |
107 | delete m_view; |
108 | } |
109 | - |
110 | - if (m_contentComm) { |
111 | - delete m_contentComm; |
112 | - } |
113 | } |
114 | |
115 | void AddressBookApp::onViewStatusChanged(QQuickView::Status status) |
116 | |
117 | === modified file 'src/app/addressbookapp.h' |
118 | --- src/app/addressbookapp.h 2014-05-09 20:00:09 +0000 |
119 | +++ src/app/addressbookapp.h 2014-06-12 12:40:31 +0000 |
120 | @@ -22,8 +22,6 @@ |
121 | #include <QtGui/QGuiApplication> |
122 | #include <QtQuick/QQuickView> |
123 | |
124 | -class ContentCommunicator; |
125 | - |
126 | class AddressBookApp : public QGuiApplication |
127 | { |
128 | Q_OBJECT |
129 | @@ -62,7 +60,6 @@ |
130 | |
131 | private: |
132 | QQuickView *m_view; |
133 | - ContentCommunicator *m_contentComm; |
134 | QDBusInterface *m_syncMonitor; |
135 | QString m_initialArg; |
136 | bool m_viewReady; |
137 | |
138 | === removed file 'src/app/contentcommunicator.cpp' |
139 | --- src/app/contentcommunicator.cpp 2014-03-12 00:58:11 +0000 |
140 | +++ src/app/contentcommunicator.cpp 1970-01-01 00:00:00 +0000 |
141 | @@ -1,140 +0,0 @@ |
142 | -/* |
143 | - * Copyright (C) 2013 Canonical, Ltd. |
144 | - * |
145 | - * This program is free software; you can redistribute it and/or modify |
146 | - * it under the terms of the GNU General Public License as published by |
147 | - * the Free Software Foundation; version 3. |
148 | - * |
149 | - * This program is distributed in the hope that it will be useful, |
150 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
151 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
152 | - * GNU General Public License for more details. |
153 | - * |
154 | - * You should have received a copy of the GNU General Public License |
155 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
156 | - * |
157 | - */ |
158 | - |
159 | -#include <contentcommunicator.h> |
160 | - |
161 | -#include <QDebug> |
162 | -#include <QTemporaryFile> |
163 | -#include <QDir> |
164 | - |
165 | -#include <com/ubuntu/content/hub.h> |
166 | -#include <com/ubuntu/content/item.h> |
167 | -#include <com/ubuntu/content/transfer.h> |
168 | - |
169 | -using namespace com::ubuntu::content; |
170 | - |
171 | -/*! |
172 | - * \brief ContentCommunicator::ContentCommunicator |
173 | - * \param parent |
174 | - */ |
175 | -ContentCommunicator::ContentCommunicator(QObject *parent) |
176 | - : ImportExportHandler(parent), |
177 | - m_transfer(0) |
178 | -{ |
179 | - Hub *hub = Hub::Client::instance(); |
180 | - if (hub) { |
181 | - hub->register_import_export_handler(this); |
182 | - } else { |
183 | - qWarning() << "Fail to get Hub client instance"; |
184 | - } |
185 | -} |
186 | - |
187 | -/*! |
188 | - * \brief \reimp |
189 | - */ |
190 | -void ContentCommunicator::handle_import(content::Transfer *) |
191 | -{ |
192 | - qDebug() << Q_FUNC_INFO << "address book app does not import content"; |
193 | -} |
194 | - |
195 | -/*! |
196 | - * \brief \reimp |
197 | - */ |
198 | -void ContentCommunicator::handle_export(content::Transfer *transfer) |
199 | -{ |
200 | - if (m_transfer != 0) { |
201 | - qWarning() << "address book app does only one content export at a time"; |
202 | - transfer->abort(); |
203 | - m_transfer = 0; |
204 | - return; |
205 | - } |
206 | - |
207 | - if (transfer) { |
208 | - m_transfer = transfer; |
209 | - connect(m_transfer, SIGNAL(selectionTypeChanged()), SIGNAL(multipleItemsChanged())); |
210 | - } else { |
211 | - qWarning() << "Transfer pointer is null in handle_export"; |
212 | - } |
213 | - Q_EMIT contactRequested(); |
214 | - Q_EMIT activeChanged(); |
215 | - Q_EMIT multipleItemsChanged(); |
216 | -} |
217 | - |
218 | -/*! |
219 | - * \brief \reimp |
220 | - */ |
221 | -void ContentCommunicator::handle_share(content::Transfer *) |
222 | -{ |
223 | - qDebug() << Q_FUNC_INFO << "address book app does not share content"; |
224 | -} |
225 | - |
226 | -/*! |
227 | - * \brief ContentCommunicator::cancelTransfer aborts the current transfer |
228 | - */ |
229 | -void ContentCommunicator::cancelTransfer() |
230 | -{ |
231 | - if (!m_transfer) { |
232 | - qWarning() << "No ongoing transfer to cancel"; |
233 | - return; |
234 | - } |
235 | - |
236 | - m_transfer->abort(); |
237 | - m_transfer = 0; |
238 | - Q_EMIT activeChanged(); |
239 | -} |
240 | - |
241 | -/*! |
242 | - * \brief ContentCommunicator::returnContacts returns the given contacts |
243 | - * via content hub to the requester |
244 | - * \param urls |
245 | - */ |
246 | -void ContentCommunicator::returnContacts(const QUrl &contactsFile) |
247 | -{ |
248 | - if (!m_transfer) { |
249 | - qWarning() << "No ongoing transfer to return a contact"; |
250 | - return; |
251 | - } |
252 | - |
253 | - QVector<Item> items; |
254 | - items << contactsFile; |
255 | - m_transfer->charge(items); |
256 | - m_transfer = 0; |
257 | - Q_EMIT activeChanged(); |
258 | -} |
259 | - |
260 | -bool ContentCommunicator::isActive() const |
261 | -{ |
262 | - return (m_transfer != 0); |
263 | -} |
264 | - |
265 | -bool ContentCommunicator::isMultipleItems() const |
266 | -{ |
267 | - return (m_transfer && m_transfer->selectionType() == Transfer::multiple); |
268 | -} |
269 | - |
270 | -QUrl ContentCommunicator::createTemporaryFile() const |
271 | -{ |
272 | - QTemporaryFile tmp(QDir::tempPath() + "/vcard_XXXXXX.vcf"); |
273 | - tmp.setAutoRemove(false); |
274 | - if (!tmp.open()) { |
275 | - qWarning() << "Fail to create temporary file for vcard."; |
276 | - return QUrl(); |
277 | - } |
278 | - QString tmpFileName = tmp.fileName(); |
279 | - tmp.close(); |
280 | - return QUrl::fromLocalFile(tmpFileName); |
281 | -} |
282 | |
283 | === removed file 'src/app/contentcommunicator.h' |
284 | --- src/app/contentcommunicator.h 2014-03-12 00:58:11 +0000 |
285 | +++ src/app/contentcommunicator.h 1970-01-01 00:00:00 +0000 |
286 | @@ -1,61 +0,0 @@ |
287 | -/* |
288 | - * Copyright (C) 2013 Canonical, Ltd. |
289 | - * |
290 | - * This program is free software; you can redistribute it and/or modify |
291 | - * it under the terms of the GNU General Public License as published by |
292 | - * the Free Software Foundation; version 3. |
293 | - * |
294 | - * This program is distributed in the hope that it will be useful, |
295 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
296 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
297 | - * GNU General Public License for more details. |
298 | - * |
299 | - * You should have received a copy of the GNU General Public License |
300 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
301 | - * |
302 | - */ |
303 | - |
304 | -#ifndef CONTENTCOMMUNICATOR_H |
305 | -#define CONTENTCOMMUNICATOR_H |
306 | - |
307 | -#include <com/ubuntu/content/import_export_handler.h> |
308 | -#include <com/ubuntu/content/transfer.h> |
309 | - |
310 | -#include <QStringList> |
311 | - |
312 | -using namespace com::ubuntu; |
313 | - |
314 | -/*! |
315 | - * Class to handle the communication with the content manager |
316 | - */ |
317 | -class ContentCommunicator : public content::ImportExportHandler |
318 | -{ |
319 | - Q_OBJECT |
320 | - Q_PROPERTY(bool active READ isActive NOTIFY activeChanged) |
321 | - Q_PROPERTY(bool multipleItems READ isMultipleItems NOTIFY multipleItemsChanged) |
322 | - |
323 | -public: |
324 | - ContentCommunicator(QObject *parent = 0); |
325 | - |
326 | - virtual void handle_import(content::Transfer*); |
327 | - virtual void handle_export(content::Transfer *transfer); |
328 | - virtual void handle_share(content::Transfer*); |
329 | - |
330 | - bool isActive() const; |
331 | - bool isMultipleItems() const; |
332 | - |
333 | -public Q_SLOTS: |
334 | - void cancelTransfer(); |
335 | - void returnContacts(const QUrl &contactsFile); |
336 | - QUrl createTemporaryFile() const; |
337 | - |
338 | -Q_SIGNALS: |
339 | - void contactRequested(); |
340 | - void activeChanged(); |
341 | - void multipleItemsChanged(); |
342 | - |
343 | -private: |
344 | - content::Transfer *m_transfer; |
345 | -}; |
346 | - |
347 | -#endif // CONTENTCOMMUNICATOR_H |
348 | |
349 | === modified file 'src/imports/CMakeLists.txt' |
350 | --- src/imports/CMakeLists.txt 2013-11-12 15:52:18 +0000 |
351 | +++ src/imports/CMakeLists.txt 2014-06-12 12:40:31 +0000 |
352 | @@ -13,4 +13,5 @@ |
353 | add_subdirectory(ContactList) |
354 | add_subdirectory(ContactView) |
355 | add_subdirectory(ContactEdit) |
356 | +add_subdirectory(ContactShare) |
357 | add_subdirectory(Ubuntu) |
358 | |
359 | === modified file 'src/imports/ContactList/ContactListPage.qml' |
360 | --- src/imports/ContactList/ContactListPage.qml 2014-06-11 22:05:50 +0000 |
361 | +++ src/imports/ContactList/ContactListPage.qml 2014-06-12 12:40:31 +0000 |
362 | @@ -21,6 +21,7 @@ |
363 | import Ubuntu.Components.ListItems 0.1 as ListItem |
364 | import Ubuntu.Contacts 0.1 as ContactsUI |
365 | import Ubuntu.Components.Popups 0.1 as Popups |
366 | +import Ubuntu.Content 0.1 as ContentHub |
367 | import "../ContactEdit" |
368 | import "../Common" |
369 | |
370 | @@ -29,6 +30,7 @@ |
371 | objectName: "contactListPage" |
372 | |
373 | property bool pickMode: false |
374 | + property alias contentHubTransfer: contactExporter.activeTransfer |
375 | property bool pickMultipleContacts: false |
376 | property var onlineAccountsMessageDialog: null |
377 | property QtObject contactIndex: null |
378 | @@ -126,7 +128,7 @@ |
379 | detailToPick: ContactDetail.PhoneNumber |
380 | multiSelectionEnabled: true |
381 | multipleSelection: !pickMode || |
382 | - ((contactContentHub && contactContentHub.multipleItems) || mainPage.pickMultipleContacts) |
383 | + mainPage.pickMultipleContacts || (contactExporter.active && contactExporter.isMultiple) |
384 | |
385 | anchors.fill: parent |
386 | |
387 | @@ -181,9 +183,7 @@ |
388 | for (var i=0; i < items.count; i++) { |
389 | contacts.push(items.get(i).model.contact) |
390 | } |
391 | - exporter.contactModel = contactList.listModel |
392 | - exporter.contacts = contacts |
393 | - exporter.start() |
394 | + contactExporter.exportContacts(contacts) |
395 | } else { |
396 | var contacts = [] |
397 | |
398 | @@ -198,8 +198,8 @@ |
399 | |
400 | onSelectionCanceled: { |
401 | if (pickMode) { |
402 | - if (contactContentHub) { |
403 | - contactContentHub.cancelTransfer() |
404 | + if (contentHubTransfer) { |
405 | + contentHubTransfer.state = ContentTransfer.Aborted |
406 | } |
407 | pageStack.pop() |
408 | application.returnVcard("") |
409 | @@ -430,20 +430,37 @@ |
410 | } |
411 | } |
412 | |
413 | - ContactExporter { |
414 | - id: exporter |
415 | - contactModel: contactList.listModel ? contactList.listModel : null |
416 | - outputFile: contactContentHub ? contactContentHub.createTemporaryFile() : "/tmp/vcard_address_book_app.vcf" |
417 | - onCompleted: { |
418 | - if (contactContentHub) { |
419 | - if (error == ContactModel.ExportNoError) { |
420 | - contactContentHub.returnContacts(exporter.outputFile) |
421 | - } else { |
422 | - contactContentHub.cancelTransfer() |
423 | - } |
424 | + |
425 | + QtObject { |
426 | + id: contactExporter |
427 | + |
428 | + property var activeTransfer: null |
429 | + readonly property bool active: activeTransfer && (activeTransfer.state === ContentHub.ContentTransfer.InProgress && activeTransfer.direction === ContentHub.ContentTransfer.Import) |
430 | + readonly property bool isMultiple: activeTransfer && (activeTransfer.selectionType === ContentHub.ContentTransfer.Multiple) |
431 | + |
432 | + function exportContacts(contacts) |
433 | + { |
434 | + if (activeTransfer) { |
435 | + var exportUrl = "file:///tmp/address_book_app_export.vcf" |
436 | + mainPage.contactModel.exportCompleted.connect(contactExporter.onExportCompleted) |
437 | + mainPage.contactModel.exportContacts(exportUrl, [], contacts) |
438 | + } else { |
439 | + console.error("Export requested with noo active transfer") |
440 | + } |
441 | + } |
442 | + |
443 | + function onExportCompleted(error, url) |
444 | + { |
445 | + mainPage.contactModel.exportCompleted.disconnect(contactExporter.onExportCompleted) |
446 | + if (error === ContactModel.ExportNoError) { |
447 | + var obj = Qt.createQmlObject("import Ubuntu.Content 0.1; ContentItem { url: '" + url + "' }", contactExporter) |
448 | + activeTransfer.items = [obj] |
449 | + activeTransfer.state = ContentHub.ContentTransfer.Charged |
450 | + } else { |
451 | + console.error("Fail to export contacts:" + error) |
452 | } |
453 | pageStack.pop() |
454 | - application.returnVcard(exporter.outputFile) |
455 | + application.returnVcard(url) |
456 | } |
457 | } |
458 | |
459 | @@ -459,5 +476,13 @@ |
460 | if (TEST_DATA != "") { |
461 | contactList.listModel.importContacts("file://" + TEST_DATA) |
462 | } |
463 | + |
464 | + if (!pickMode) { |
465 | + mainPage.setBottomEdgePage(Qt.resolvedUrl("../ContactEdit/ContactEditor.qml"), |
466 | + {model: contactList.listModel, |
467 | + contact: mainPage.createEmptyContact(""), |
468 | + active: false, |
469 | + enabled: false}) |
470 | + } |
471 | } |
472 | } |
473 | |
474 | === added directory 'src/imports/ContactShare' |
475 | === added file 'src/imports/ContactShare/CMakeLists.txt' |
476 | --- src/imports/ContactShare/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
477 | +++ src/imports/ContactShare/CMakeLists.txt 2014-06-12 12:40:31 +0000 |
478 | @@ -0,0 +1,10 @@ |
479 | +set(CONTACT_SHARE_QMLS |
480 | + ContactSharePage.qml |
481 | +) |
482 | + |
483 | +install(FILES ${CONTACT_SHARE_QMLS} |
484 | + DESTINATION ${ADDRESS_BOOK_APP_DIR}/imports/ContactShare |
485 | +) |
486 | + |
487 | +# make the files visible on qtcreator |
488 | +add_custom_target(contact_share_QmlFiles ALL SOURCES ${CONTACT_SHARE_QMLS}) |
489 | |
490 | === added file 'src/imports/ContactShare/ContactSharePage.qml' |
491 | --- src/imports/ContactShare/ContactSharePage.qml 1970-01-01 00:00:00 +0000 |
492 | +++ src/imports/ContactShare/ContactSharePage.qml 2014-06-12 12:40:31 +0000 |
493 | @@ -0,0 +1,62 @@ |
494 | +/* |
495 | + * Copyright (C) 2012-2014 Canonical, Ltd. |
496 | + * |
497 | + * This program is free software; you can redistribute it and/or modify |
498 | + * it under the terms of the GNU General Public License as published by |
499 | + * the Free Software Foundation; version 3. |
500 | + * |
501 | + * This program is distributed in the hope that it will be useful, |
502 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
503 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
504 | + * GNU General Public License for more details. |
505 | + * |
506 | + * You should have received a copy of the GNU General Public License |
507 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
508 | + */ |
509 | + |
510 | +import QtQuick 2.2 |
511 | +import QtContacts 5.0 |
512 | +import Ubuntu.Components 0.1 |
513 | +import Ubuntu.Content 0.1 as ContentHub |
514 | + |
515 | +Page { |
516 | + id: picker |
517 | + |
518 | + property var contactModel |
519 | + property var contact |
520 | + property var curTransfer |
521 | + |
522 | + ContentHub.ContentPeerPicker { |
523 | + visible: true |
524 | + anchors.fill: parent |
525 | + contentType: ContentHub.ContentType.Contacts |
526 | + handler: ContentHub.ContentHandler.Share |
527 | + |
528 | + onPeerSelected: { |
529 | + picker.curTransfer = peer.request(); |
530 | + if (picker.curTransfer.state === ContentHub.ContentTransfer.InProgress) { |
531 | + var vCardUrl = "file:///tmp/vcard_" + encodeURIComponent(contact.contactId) + ".vcf" |
532 | + picker.contactModel.exportContacts(vCardUrl, [], [picker.contact]) |
533 | + } |
534 | + } |
535 | + |
536 | + onCancelPressed: pageStack.pop() |
537 | + } |
538 | + |
539 | + Connections { |
540 | + target: picker.contactModel |
541 | + onExportCompleted: { |
542 | + if (picker.curTransfer && (picker.curTransfer.state === ContentHub.ContentTransfer.InProgress)) { |
543 | + if (error === ContactModel.ExportNoError) { |
544 | + var obj = Qt.createQmlObject("import Ubuntu.Content 0.1; ContentItem { url: '" + url + "' }", picker) |
545 | + picker.curTransfer.items = [ obj ] |
546 | + picker.curTransfer.state = ContentHub.ContentTransfer.Charged |
547 | + } else { |
548 | + picker.curTransfer = ContentHub.ContentTransfer.Aborted |
549 | + console.error("Fail to export contact:" + error) |
550 | + } |
551 | + } |
552 | + pageStack.pop() |
553 | + } |
554 | + } |
555 | +} |
556 | |
557 | === modified file 'src/imports/ContactView/ContactView.qml' |
558 | --- src/imports/ContactView/ContactView.qml 2014-06-10 12:27:54 +0000 |
559 | +++ src/imports/ContactView/ContactView.qml 2014-06-12 12:40:31 +0000 |
560 | @@ -202,6 +202,17 @@ |
561 | tools: ToolbarItems { |
562 | ToolbarButton { |
563 | action: Action { |
564 | + objectName: "share" |
565 | + text: i18n.tr("Share") |
566 | + iconName: "share" |
567 | + onTriggered: { |
568 | + pageStack.push(Qt.resolvedUrl("../ContactShare/ContactSharePage.qml"), |
569 | + { contactModel: root.model, contact: root.contact}) |
570 | + } |
571 | + } |
572 | + } |
573 | + ToolbarButton { |
574 | + action: Action { |
575 | objectName: "edit" |
576 | text: i18n.tr("Edit") |
577 | iconSource: "artwork:/edit.png" |
578 | |
579 | === modified file 'src/imports/MainWindow.qml' |
580 | --- src/imports/MainWindow.qml 2014-06-05 19:20:12 +0000 |
581 | +++ src/imports/MainWindow.qml 2014-06-12 12:40:31 +0000 |
582 | @@ -18,6 +18,7 @@ |
583 | import QtContacts 5.0 |
584 | import Ubuntu.Components 0.1 |
585 | import Ubuntu.Components.Popups 0.1 as Popups |
586 | +import Ubuntu.Content 0.1 as ContentHub |
587 | |
588 | MainView { |
589 | id: mainWindow |
590 | @@ -110,12 +111,12 @@ |
591 | } |
592 | |
593 | Connections { |
594 | - target: contactContentHub |
595 | - onActiveChanged: { |
596 | - if (contactContentHub && contactContentHub.active) { |
597 | - // enter in pick mode |
598 | - mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), {pickMode: true}) |
599 | - } |
600 | + target: ContentHub.ContentHub |
601 | + onExportRequested: { |
602 | + // enter in pick mode |
603 | + mainStack.push(Qt.createComponent("ContactList/ContactListPage.qml"), |
604 | + {pickMode: true, |
605 | + contentHubTransfer: transfer}) |
606 | } |
607 | } |
608 | } |
FAILED: Continuous integration, rev:234 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- ci/80/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/610 jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 559 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- utopic- amd64-ci/ 80 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- utopic- armhf-ci/ 80 jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- utopic- armhf-ci/ 80/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ phablet- team-address- book-app- staging- utopic- i386-ci/ 80 jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- runner- mako/1051 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/1176 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/1176/ artifact/ work/output/ *zip*/output. zip s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 7990 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-utopic/ 500 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/698 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/698/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/phablet- team-address- book-app- staging- ci/80/rebuild
http://