Merge lp:~renatofilho/indicator-transfer-buteo/initial-version into lp:indicator-transfer-buteo

Proposed by Renato Araujo Oliveira Filho
Status: Merged
Approved by: Charles Kerr
Approved revision: 22
Merged at revision: 3
Proposed branch: lp:~renatofilho/indicator-transfer-buteo/initial-version
Merge into: lp:indicator-transfer-buteo
Diff against target: 2036 lines (+1915/-4)
19 files modified
CMakeLists.txt (+58/-0)
COPYING (+674/-0)
cmake/Translations.cmake (+37/-0)
cmake/lcov.cmake (+72/-0)
cmake_uninstall.cmake.in (+21/-0)
config.h.in (+9/-0)
debian/changelog (+2/-1)
debian/control (+10/-3)
po/CMakeLists.txt (+3/-0)
po/indicator-transfer-buteo.pot (+22/-0)
src/CMakeLists.txt (+43/-0)
src/buteo-plugin.cpp (+42/-0)
src/buteo-source.cpp (+339/-0)
src/buteo-source.h (+84/-0)
src/buteo-transfer.cpp (+187/-0)
src/buteo-transfer.h (+53/-0)
tests/CMakeLists.txt (+34/-0)
tests/buteo-syncfw.py (+121/-0)
tests/tst-transfer-plugin.cpp (+104/-0)
To merge this branch: bzr merge lp:~renatofilho/indicator-transfer-buteo/initial-version
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
Ken VanDine packaging Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+266949@code.launchpad.net

Commit message

Implemented transfer indicator plugin for Buteo.

Description of the change

Are there any related MPs required for this MP to build/function as expected?
NO

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 CHANGED

If you changed UI labels, did you update the pot file?
NO LABEL CHANGED

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
yes

To post a comment you must log in.
4. By Renato Araujo Oliveira Filho

created idividual id for transfer.

5. By Renato Araujo Oliveira Filho

Updated unit test and created syncfw python service.

6. By Renato Araujo Oliveira Filho

Use online accounts api to retrieve application information related with the sync job.

7. By Renato Araujo Oliveira Filho

Use profileId as transfer.id;

8. By Renato Araujo Oliveira Filho

Fixed memory leak.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
9. By Renato Araujo Oliveira Filho

Moved transfe state/progress update code to transfer implementation.

10. By Renato Araujo Oliveira Filho

Used source.start instead call a dbus method to start a sync on unit test.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
11. By Renato Araujo Oliveira Filho

Fix can start function to not return true if sync finished.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
12. By Renato Araujo Oliveira Filho

Update API.

13. By Renato Araujo Oliveira Filho

Added missing build dep.

14. By Renato Araujo Oliveira Filho

Install plugin into the correct location.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
15. By Renato Araujo Oliveira Filho

Trunk merged.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
16. By Renato Araujo Oliveira Filho

Set custom state while syncing contacts.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
17. By Renato Araujo Oliveira Filho

Added missing po dir;

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
18. By Renato Araujo Oliveira Filho

Ignore 'internal error' 401.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
19. By Renato Araujo Oliveira Filho

Updated test to check for custom state strings.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
20. By Renato Araujo Oliveira Filho

Pot file.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
21. By Renato Araujo Oliveira Filho

Remove transfer status from indicator if profile get removed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Comments inline.

Most of these are minor/optional, there's one NF with a possible nullptr being passed to g_variant_unref().

review: Needs Fixing
22. By Renato Araujo Oliveira Filho

minor fixes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Packaging looks good

review: Approve (packaging)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
23. By Renato Araujo Oliveira Filho

Merged 'lp:~allanlesage/indicator-transfer-buteo/add-coverage-reporting'

24. By Renato Araujo Oliveira Filho

Revert cmake-extras usage.

25. By Renato Araujo Oliveira Filho

Added missing licence header.

26. By Renato Araujo Oliveira Filho

Fixed changelog syntax.

27. By Renato Araujo Oliveira Filho

Updated package description.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'CMakeLists.txt'
2--- CMakeLists.txt 1970-01-01 00:00:00 +0000
3+++ CMakeLists.txt 2015-10-02 14:23:10 +0000
4@@ -0,0 +1,58 @@
5+project(buteo-transfers-plugins)
6+cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
7+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
8+
9+# Find includes in corresponding build directories
10+set(CMAKE_INCLUDE_CURRENT_DIR ON)
11+
12+# Instruct CMake to run moc automatically when needed.
13+set(CMAKE_AUTOMOC ON)
14+
15+# Standard install paths
16+include(GNUInstallDirs)
17+
18+find_package(PkgConfig REQUIRED)
19+find_package(Qt5Core REQUIRED)
20+find_package(Qt5DBus REQUIRED)
21+find_package(Qt5Xml REQUIRED)
22+
23+pkg_check_modules(GMODULE REQUIRED gmodule-2.0>=2.36)
24+pkg_check_modules(TRANSFER_INDICATOR REQUIRED indicator-transfer)
25+pkg_check_modules(URL_DISPATCHER REQUIRED url-dispatcher-1)
26+pkg_check_modules(ACCOUNTS_QT5 REQUIRED accounts-qt5)
27+
28+#i18n
29+set(GETTEXT_PACKAGE "indicator-transfer-buteo")
30+add_definitions(-DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}"
31+ -DGNOMELOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}")
32+
33+# config file
34+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
35+ "${CMAKE_CURRENT_BINARY_DIR}/config.h"
36+ IMMEDIATE @ONLY)
37+
38+# Coverage tools
39+OPTION(ENABLE_COVERAGE "Build with coverage analysis support" OFF)
40+if(ENABLE_COVERAGE)
41+ message(STATUS "Using coverage flags")
42+ find_program(COVERAGE_COMMAND gcov)
43+ if(NOT COVERAGE_COMMAND)
44+ message(FATAL_ERROR "gcov command not found")
45+ endif()
46+ SET(CMAKE_C_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
47+ SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
48+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
49+ include(${CMAKE_SOURCE_DIR}/cmake/lcov.cmake)
50+endif()
51+
52+enable_testing()
53+add_subdirectory(src)
54+add_subdirectory(tests)
55+add_subdirectory(po)
56+
57+# uninstall target
58+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
59+ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
60+ IMMEDIATE @ONLY)
61+add_custom_target(uninstall "${CMAKE_COMMAND}"
62+ -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
63
64=== added file 'COPYING'
65--- COPYING 1970-01-01 00:00:00 +0000
66+++ COPYING 2015-10-02 14:23:10 +0000
67@@ -0,0 +1,674 @@
68+ GNU GENERAL PUBLIC LICENSE
69+ Version 3, 29 June 2007
70+
71+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
72+ Everyone is permitted to copy and distribute verbatim copies
73+ of this license document, but changing it is not allowed.
74+
75+ Preamble
76+
77+ The GNU General Public License is a free, copyleft license for
78+software and other kinds of works.
79+
80+ The licenses for most software and other practical works are designed
81+to take away your freedom to share and change the works. By contrast,
82+the GNU General Public License is intended to guarantee your freedom to
83+share and change all versions of a program--to make sure it remains free
84+software for all its users. We, the Free Software Foundation, use the
85+GNU General Public License for most of our software; it applies also to
86+any other work released this way by its authors. You can apply it to
87+your programs, too.
88+
89+ When we speak of free software, we are referring to freedom, not
90+price. Our General Public Licenses are designed to make sure that you
91+have the freedom to distribute copies of free software (and charge for
92+them if you wish), that you receive source code or can get it if you
93+want it, that you can change the software or use pieces of it in new
94+free programs, and that you know you can do these things.
95+
96+ To protect your rights, we need to prevent others from denying you
97+these rights or asking you to surrender the rights. Therefore, you have
98+certain responsibilities if you distribute copies of the software, or if
99+you modify it: responsibilities to respect the freedom of others.
100+
101+ For example, if you distribute copies of such a program, whether
102+gratis or for a fee, you must pass on to the recipients the same
103+freedoms that you received. You must make sure that they, too, receive
104+or can get the source code. And you must show them these terms so they
105+know their rights.
106+
107+ Developers that use the GNU GPL protect your rights with two steps:
108+(1) assert copyright on the software, and (2) offer you this License
109+giving you legal permission to copy, distribute and/or modify it.
110+
111+ For the developers' and authors' protection, the GPL clearly explains
112+that there is no warranty for this free software. For both users' and
113+authors' sake, the GPL requires that modified versions be marked as
114+changed, so that their problems will not be attributed erroneously to
115+authors of previous versions.
116+
117+ Some devices are designed to deny users access to install or run
118+modified versions of the software inside them, although the manufacturer
119+can do so. This is fundamentally incompatible with the aim of
120+protecting users' freedom to change the software. The systematic
121+pattern of such abuse occurs in the area of products for individuals to
122+use, which is precisely where it is most unacceptable. Therefore, we
123+have designed this version of the GPL to prohibit the practice for those
124+products. If such problems arise substantially in other domains, we
125+stand ready to extend this provision to those domains in future versions
126+of the GPL, as needed to protect the freedom of users.
127+
128+ Finally, every program is threatened constantly by software patents.
129+States should not allow patents to restrict development and use of
130+software on general-purpose computers, but in those that do, we wish to
131+avoid the special danger that patents applied to a free program could
132+make it effectively proprietary. To prevent this, the GPL assures that
133+patents cannot be used to render the program non-free.
134+
135+ The precise terms and conditions for copying, distribution and
136+modification follow.
137+
138+ TERMS AND CONDITIONS
139+
140+ 0. Definitions.
141+
142+ "This License" refers to version 3 of the GNU General Public License.
143+
144+ "Copyright" also means copyright-like laws that apply to other kinds of
145+works, such as semiconductor masks.
146+
147+ "The Program" refers to any copyrightable work licensed under this
148+License. Each licensee is addressed as "you". "Licensees" and
149+"recipients" may be individuals or organizations.
150+
151+ To "modify" a work means to copy from or adapt all or part of the work
152+in a fashion requiring copyright permission, other than the making of an
153+exact copy. The resulting work is called a "modified version" of the
154+earlier work or a work "based on" the earlier work.
155+
156+ A "covered work" means either the unmodified Program or a work based
157+on the Program.
158+
159+ To "propagate" a work means to do anything with it that, without
160+permission, would make you directly or secondarily liable for
161+infringement under applicable copyright law, except executing it on a
162+computer or modifying a private copy. Propagation includes copying,
163+distribution (with or without modification), making available to the
164+public, and in some countries other activities as well.
165+
166+ To "convey" a work means any kind of propagation that enables other
167+parties to make or receive copies. Mere interaction with a user through
168+a computer network, with no transfer of a copy, is not conveying.
169+
170+ An interactive user interface displays "Appropriate Legal Notices"
171+to the extent that it includes a convenient and prominently visible
172+feature that (1) displays an appropriate copyright notice, and (2)
173+tells the user that there is no warranty for the work (except to the
174+extent that warranties are provided), that licensees may convey the
175+work under this License, and how to view a copy of this License. If
176+the interface presents a list of user commands or options, such as a
177+menu, a prominent item in the list meets this criterion.
178+
179+ 1. Source Code.
180+
181+ The "source code" for a work means the preferred form of the work
182+for making modifications to it. "Object code" means any non-source
183+form of a work.
184+
185+ A "Standard Interface" means an interface that either is an official
186+standard defined by a recognized standards body, or, in the case of
187+interfaces specified for a particular programming language, one that
188+is widely used among developers working in that language.
189+
190+ The "System Libraries" of an executable work include anything, other
191+than the work as a whole, that (a) is included in the normal form of
192+packaging a Major Component, but which is not part of that Major
193+Component, and (b) serves only to enable use of the work with that
194+Major Component, or to implement a Standard Interface for which an
195+implementation is available to the public in source code form. A
196+"Major Component", in this context, means a major essential component
197+(kernel, window system, and so on) of the specific operating system
198+(if any) on which the executable work runs, or a compiler used to
199+produce the work, or an object code interpreter used to run it.
200+
201+ The "Corresponding Source" for a work in object code form means all
202+the source code needed to generate, install, and (for an executable
203+work) run the object code and to modify the work, including scripts to
204+control those activities. However, it does not include the work's
205+System Libraries, or general-purpose tools or generally available free
206+programs which are used unmodified in performing those activities but
207+which are not part of the work. For example, Corresponding Source
208+includes interface definition files associated with source files for
209+the work, and the source code for shared libraries and dynamically
210+linked subprograms that the work is specifically designed to require,
211+such as by intimate data communication or control flow between those
212+subprograms and other parts of the work.
213+
214+ The Corresponding Source need not include anything that users
215+can regenerate automatically from other parts of the Corresponding
216+Source.
217+
218+ The Corresponding Source for a work in source code form is that
219+same work.
220+
221+ 2. Basic Permissions.
222+
223+ All rights granted under this License are granted for the term of
224+copyright on the Program, and are irrevocable provided the stated
225+conditions are met. This License explicitly affirms your unlimited
226+permission to run the unmodified Program. The output from running a
227+covered work is covered by this License only if the output, given its
228+content, constitutes a covered work. This License acknowledges your
229+rights of fair use or other equivalent, as provided by copyright law.
230+
231+ You may make, run and propagate covered works that you do not
232+convey, without conditions so long as your license otherwise remains
233+in force. You may convey covered works to others for the sole purpose
234+of having them make modifications exclusively for you, or provide you
235+with facilities for running those works, provided that you comply with
236+the terms of this License in conveying all material for which you do
237+not control copyright. Those thus making or running the covered works
238+for you must do so exclusively on your behalf, under your direction
239+and control, on terms that prohibit them from making any copies of
240+your copyrighted material outside their relationship with you.
241+
242+ Conveying under any other circumstances is permitted solely under
243+the conditions stated below. Sublicensing is not allowed; section 10
244+makes it unnecessary.
245+
246+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
247+
248+ No covered work shall be deemed part of an effective technological
249+measure under any applicable law fulfilling obligations under article
250+11 of the WIPO copyright treaty adopted on 20 December 1996, or
251+similar laws prohibiting or restricting circumvention of such
252+measures.
253+
254+ When you convey a covered work, you waive any legal power to forbid
255+circumvention of technological measures to the extent such circumvention
256+is effected by exercising rights under this License with respect to
257+the covered work, and you disclaim any intention to limit operation or
258+modification of the work as a means of enforcing, against the work's
259+users, your or third parties' legal rights to forbid circumvention of
260+technological measures.
261+
262+ 4. Conveying Verbatim Copies.
263+
264+ You may convey verbatim copies of the Program's source code as you
265+receive it, in any medium, provided that you conspicuously and
266+appropriately publish on each copy an appropriate copyright notice;
267+keep intact all notices stating that this License and any
268+non-permissive terms added in accord with section 7 apply to the code;
269+keep intact all notices of the absence of any warranty; and give all
270+recipients a copy of this License along with the Program.
271+
272+ You may charge any price or no price for each copy that you convey,
273+and you may offer support or warranty protection for a fee.
274+
275+ 5. Conveying Modified Source Versions.
276+
277+ You may convey a work based on the Program, or the modifications to
278+produce it from the Program, in the form of source code under the
279+terms of section 4, provided that you also meet all of these conditions:
280+
281+ a) The work must carry prominent notices stating that you modified
282+ it, and giving a relevant date.
283+
284+ b) The work must carry prominent notices stating that it is
285+ released under this License and any conditions added under section
286+ 7. This requirement modifies the requirement in section 4 to
287+ "keep intact all notices".
288+
289+ c) You must license the entire work, as a whole, under this
290+ License to anyone who comes into possession of a copy. This
291+ License will therefore apply, along with any applicable section 7
292+ additional terms, to the whole of the work, and all its parts,
293+ regardless of how they are packaged. This License gives no
294+ permission to license the work in any other way, but it does not
295+ invalidate such permission if you have separately received it.
296+
297+ d) If the work has interactive user interfaces, each must display
298+ Appropriate Legal Notices; however, if the Program has interactive
299+ interfaces that do not display Appropriate Legal Notices, your
300+ work need not make them do so.
301+
302+ A compilation of a covered work with other separate and independent
303+works, which are not by their nature extensions of the covered work,
304+and which are not combined with it such as to form a larger program,
305+in or on a volume of a storage or distribution medium, is called an
306+"aggregate" if the compilation and its resulting copyright are not
307+used to limit the access or legal rights of the compilation's users
308+beyond what the individual works permit. Inclusion of a covered work
309+in an aggregate does not cause this License to apply to the other
310+parts of the aggregate.
311+
312+ 6. Conveying Non-Source Forms.
313+
314+ You may convey a covered work in object code form under the terms
315+of sections 4 and 5, provided that you also convey the
316+machine-readable Corresponding Source under the terms of this License,
317+in one of these ways:
318+
319+ a) Convey the object code in, or embodied in, a physical product
320+ (including a physical distribution medium), accompanied by the
321+ Corresponding Source fixed on a durable physical medium
322+ customarily used for software interchange.
323+
324+ b) Convey the object code in, or embodied in, a physical product
325+ (including a physical distribution medium), accompanied by a
326+ written offer, valid for at least three years and valid for as
327+ long as you offer spare parts or customer support for that product
328+ model, to give anyone who possesses the object code either (1) a
329+ copy of the Corresponding Source for all the software in the
330+ product that is covered by this License, on a durable physical
331+ medium customarily used for software interchange, for a price no
332+ more than your reasonable cost of physically performing this
333+ conveying of source, or (2) access to copy the
334+ Corresponding Source from a network server at no charge.
335+
336+ c) Convey individual copies of the object code with a copy of the
337+ written offer to provide the Corresponding Source. This
338+ alternative is allowed only occasionally and noncommercially, and
339+ only if you received the object code with such an offer, in accord
340+ with subsection 6b.
341+
342+ d) Convey the object code by offering access from a designated
343+ place (gratis or for a charge), and offer equivalent access to the
344+ Corresponding Source in the same way through the same place at no
345+ further charge. You need not require recipients to copy the
346+ Corresponding Source along with the object code. If the place to
347+ copy the object code is a network server, the Corresponding Source
348+ may be on a different server (operated by you or a third party)
349+ that supports equivalent copying facilities, provided you maintain
350+ clear directions next to the object code saying where to find the
351+ Corresponding Source. Regardless of what server hosts the
352+ Corresponding Source, you remain obligated to ensure that it is
353+ available for as long as needed to satisfy these requirements.
354+
355+ e) Convey the object code using peer-to-peer transmission, provided
356+ you inform other peers where the object code and Corresponding
357+ Source of the work are being offered to the general public at no
358+ charge under subsection 6d.
359+
360+ A separable portion of the object code, whose source code is excluded
361+from the Corresponding Source as a System Library, need not be
362+included in conveying the object code work.
363+
364+ A "User Product" is either (1) a "consumer product", which means any
365+tangible personal property which is normally used for personal, family,
366+or household purposes, or (2) anything designed or sold for incorporation
367+into a dwelling. In determining whether a product is a consumer product,
368+doubtful cases shall be resolved in favor of coverage. For a particular
369+product received by a particular user, "normally used" refers to a
370+typical or common use of that class of product, regardless of the status
371+of the particular user or of the way in which the particular user
372+actually uses, or expects or is expected to use, the product. A product
373+is a consumer product regardless of whether the product has substantial
374+commercial, industrial or non-consumer uses, unless such uses represent
375+the only significant mode of use of the product.
376+
377+ "Installation Information" for a User Product means any methods,
378+procedures, authorization keys, or other information required to install
379+and execute modified versions of a covered work in that User Product from
380+a modified version of its Corresponding Source. The information must
381+suffice to ensure that the continued functioning of the modified object
382+code is in no case prevented or interfered with solely because
383+modification has been made.
384+
385+ If you convey an object code work under this section in, or with, or
386+specifically for use in, a User Product, and the conveying occurs as
387+part of a transaction in which the right of possession and use of the
388+User Product is transferred to the recipient in perpetuity or for a
389+fixed term (regardless of how the transaction is characterized), the
390+Corresponding Source conveyed under this section must be accompanied
391+by the Installation Information. But this requirement does not apply
392+if neither you nor any third party retains the ability to install
393+modified object code on the User Product (for example, the work has
394+been installed in ROM).
395+
396+ The requirement to provide Installation Information does not include a
397+requirement to continue to provide support service, warranty, or updates
398+for a work that has been modified or installed by the recipient, or for
399+the User Product in which it has been modified or installed. Access to a
400+network may be denied when the modification itself materially and
401+adversely affects the operation of the network or violates the rules and
402+protocols for communication across the network.
403+
404+ Corresponding Source conveyed, and Installation Information provided,
405+in accord with this section must be in a format that is publicly
406+documented (and with an implementation available to the public in
407+source code form), and must require no special password or key for
408+unpacking, reading or copying.
409+
410+ 7. Additional Terms.
411+
412+ "Additional permissions" are terms that supplement the terms of this
413+License by making exceptions from one or more of its conditions.
414+Additional permissions that are applicable to the entire Program shall
415+be treated as though they were included in this License, to the extent
416+that they are valid under applicable law. If additional permissions
417+apply only to part of the Program, that part may be used separately
418+under those permissions, but the entire Program remains governed by
419+this License without regard to the additional permissions.
420+
421+ When you convey a copy of a covered work, you may at your option
422+remove any additional permissions from that copy, or from any part of
423+it. (Additional permissions may be written to require their own
424+removal in certain cases when you modify the work.) You may place
425+additional permissions on material, added by you to a covered work,
426+for which you have or can give appropriate copyright permission.
427+
428+ Notwithstanding any other provision of this License, for material you
429+add to a covered work, you may (if authorized by the copyright holders of
430+that material) supplement the terms of this License with terms:
431+
432+ a) Disclaiming warranty or limiting liability differently from the
433+ terms of sections 15 and 16 of this License; or
434+
435+ b) Requiring preservation of specified reasonable legal notices or
436+ author attributions in that material or in the Appropriate Legal
437+ Notices displayed by works containing it; or
438+
439+ c) Prohibiting misrepresentation of the origin of that material, or
440+ requiring that modified versions of such material be marked in
441+ reasonable ways as different from the original version; or
442+
443+ d) Limiting the use for publicity purposes of names of licensors or
444+ authors of the material; or
445+
446+ e) Declining to grant rights under trademark law for use of some
447+ trade names, trademarks, or service marks; or
448+
449+ f) Requiring indemnification of licensors and authors of that
450+ material by anyone who conveys the material (or modified versions of
451+ it) with contractual assumptions of liability to the recipient, for
452+ any liability that these contractual assumptions directly impose on
453+ those licensors and authors.
454+
455+ All other non-permissive additional terms are considered "further
456+restrictions" within the meaning of section 10. If the Program as you
457+received it, or any part of it, contains a notice stating that it is
458+governed by this License along with a term that is a further
459+restriction, you may remove that term. If a license document contains
460+a further restriction but permits relicensing or conveying under this
461+License, you may add to a covered work material governed by the terms
462+of that license document, provided that the further restriction does
463+not survive such relicensing or conveying.
464+
465+ If you add terms to a covered work in accord with this section, you
466+must place, in the relevant source files, a statement of the
467+additional terms that apply to those files, or a notice indicating
468+where to find the applicable terms.
469+
470+ Additional terms, permissive or non-permissive, may be stated in the
471+form of a separately written license, or stated as exceptions;
472+the above requirements apply either way.
473+
474+ 8. Termination.
475+
476+ You may not propagate or modify a covered work except as expressly
477+provided under this License. Any attempt otherwise to propagate or
478+modify it is void, and will automatically terminate your rights under
479+this License (including any patent licenses granted under the third
480+paragraph of section 11).
481+
482+ However, if you cease all violation of this License, then your
483+license from a particular copyright holder is reinstated (a)
484+provisionally, unless and until the copyright holder explicitly and
485+finally terminates your license, and (b) permanently, if the copyright
486+holder fails to notify you of the violation by some reasonable means
487+prior to 60 days after the cessation.
488+
489+ Moreover, your license from a particular copyright holder is
490+reinstated permanently if the copyright holder notifies you of the
491+violation by some reasonable means, this is the first time you have
492+received notice of violation of this License (for any work) from that
493+copyright holder, and you cure the violation prior to 30 days after
494+your receipt of the notice.
495+
496+ Termination of your rights under this section does not terminate the
497+licenses of parties who have received copies or rights from you under
498+this License. If your rights have been terminated and not permanently
499+reinstated, you do not qualify to receive new licenses for the same
500+material under section 10.
501+
502+ 9. Acceptance Not Required for Having Copies.
503+
504+ You are not required to accept this License in order to receive or
505+run a copy of the Program. Ancillary propagation of a covered work
506+occurring solely as a consequence of using peer-to-peer transmission
507+to receive a copy likewise does not require acceptance. However,
508+nothing other than this License grants you permission to propagate or
509+modify any covered work. These actions infringe copyright if you do
510+not accept this License. Therefore, by modifying or propagating a
511+covered work, you indicate your acceptance of this License to do so.
512+
513+ 10. Automatic Licensing of Downstream Recipients.
514+
515+ Each time you convey a covered work, the recipient automatically
516+receives a license from the original licensors, to run, modify and
517+propagate that work, subject to this License. You are not responsible
518+for enforcing compliance by third parties with this License.
519+
520+ An "entity transaction" is a transaction transferring control of an
521+organization, or substantially all assets of one, or subdividing an
522+organization, or merging organizations. If propagation of a covered
523+work results from an entity transaction, each party to that
524+transaction who receives a copy of the work also receives whatever
525+licenses to the work the party's predecessor in interest had or could
526+give under the previous paragraph, plus a right to possession of the
527+Corresponding Source of the work from the predecessor in interest, if
528+the predecessor has it or can get it with reasonable efforts.
529+
530+ You may not impose any further restrictions on the exercise of the
531+rights granted or affirmed under this License. For example, you may
532+not impose a license fee, royalty, or other charge for exercise of
533+rights granted under this License, and you may not initiate litigation
534+(including a cross-claim or counterclaim in a lawsuit) alleging that
535+any patent claim is infringed by making, using, selling, offering for
536+sale, or importing the Program or any portion of it.
537+
538+ 11. Patents.
539+
540+ A "contributor" is a copyright holder who authorizes use under this
541+License of the Program or a work on which the Program is based. The
542+work thus licensed is called the contributor's "contributor version".
543+
544+ A contributor's "essential patent claims" are all patent claims
545+owned or controlled by the contributor, whether already acquired or
546+hereafter acquired, that would be infringed by some manner, permitted
547+by this License, of making, using, or selling its contributor version,
548+but do not include claims that would be infringed only as a
549+consequence of further modification of the contributor version. For
550+purposes of this definition, "control" includes the right to grant
551+patent sublicenses in a manner consistent with the requirements of
552+this License.
553+
554+ Each contributor grants you a non-exclusive, worldwide, royalty-free
555+patent license under the contributor's essential patent claims, to
556+make, use, sell, offer for sale, import and otherwise run, modify and
557+propagate the contents of its contributor version.
558+
559+ In the following three paragraphs, a "patent license" is any express
560+agreement or commitment, however denominated, not to enforce a patent
561+(such as an express permission to practice a patent or covenant not to
562+sue for patent infringement). To "grant" such a patent license to a
563+party means to make such an agreement or commitment not to enforce a
564+patent against the party.
565+
566+ If you convey a covered work, knowingly relying on a patent license,
567+and the Corresponding Source of the work is not available for anyone
568+to copy, free of charge and under the terms of this License, through a
569+publicly available network server or other readily accessible means,
570+then you must either (1) cause the Corresponding Source to be so
571+available, or (2) arrange to deprive yourself of the benefit of the
572+patent license for this particular work, or (3) arrange, in a manner
573+consistent with the requirements of this License, to extend the patent
574+license to downstream recipients. "Knowingly relying" means you have
575+actual knowledge that, but for the patent license, your conveying the
576+covered work in a country, or your recipient's use of the covered work
577+in a country, would infringe one or more identifiable patents in that
578+country that you have reason to believe are valid.
579+
580+ If, pursuant to or in connection with a single transaction or
581+arrangement, you convey, or propagate by procuring conveyance of, a
582+covered work, and grant a patent license to some of the parties
583+receiving the covered work authorizing them to use, propagate, modify
584+or convey a specific copy of the covered work, then the patent license
585+you grant is automatically extended to all recipients of the covered
586+work and works based on it.
587+
588+ A patent license is "discriminatory" if it does not include within
589+the scope of its coverage, prohibits the exercise of, or is
590+conditioned on the non-exercise of one or more of the rights that are
591+specifically granted under this License. You may not convey a covered
592+work if you are a party to an arrangement with a third party that is
593+in the business of distributing software, under which you make payment
594+to the third party based on the extent of your activity of conveying
595+the work, and under which the third party grants, to any of the
596+parties who would receive the covered work from you, a discriminatory
597+patent license (a) in connection with copies of the covered work
598+conveyed by you (or copies made from those copies), or (b) primarily
599+for and in connection with specific products or compilations that
600+contain the covered work, unless you entered into that arrangement,
601+or that patent license was granted, prior to 28 March 2007.
602+
603+ Nothing in this License shall be construed as excluding or limiting
604+any implied license or other defenses to infringement that may
605+otherwise be available to you under applicable patent law.
606+
607+ 12. No Surrender of Others' Freedom.
608+
609+ If conditions are imposed on you (whether by court order, agreement or
610+otherwise) that contradict the conditions of this License, they do not
611+excuse you from the conditions of this License. If you cannot convey a
612+covered work so as to satisfy simultaneously your obligations under this
613+License and any other pertinent obligations, then as a consequence you may
614+not convey it at all. For example, if you agree to terms that obligate you
615+to collect a royalty for further conveying from those to whom you convey
616+the Program, the only way you could satisfy both those terms and this
617+License would be to refrain entirely from conveying the Program.
618+
619+ 13. Use with the GNU Affero General Public License.
620+
621+ Notwithstanding any other provision of this License, you have
622+permission to link or combine any covered work with a work licensed
623+under version 3 of the GNU Affero General Public License into a single
624+combined work, and to convey the resulting work. The terms of this
625+License will continue to apply to the part which is the covered work,
626+but the special requirements of the GNU Affero General Public License,
627+section 13, concerning interaction through a network will apply to the
628+combination as such.
629+
630+ 14. Revised Versions of this License.
631+
632+ The Free Software Foundation may publish revised and/or new versions of
633+the GNU General Public License from time to time. Such new versions will
634+be similar in spirit to the present version, but may differ in detail to
635+address new problems or concerns.
636+
637+ Each version is given a distinguishing version number. If the
638+Program specifies that a certain numbered version of the GNU General
639+Public License "or any later version" applies to it, you have the
640+option of following the terms and conditions either of that numbered
641+version or of any later version published by the Free Software
642+Foundation. If the Program does not specify a version number of the
643+GNU General Public License, you may choose any version ever published
644+by the Free Software Foundation.
645+
646+ If the Program specifies that a proxy can decide which future
647+versions of the GNU General Public License can be used, that proxy's
648+public statement of acceptance of a version permanently authorizes you
649+to choose that version for the Program.
650+
651+ Later license versions may give you additional or different
652+permissions. However, no additional obligations are imposed on any
653+author or copyright holder as a result of your choosing to follow a
654+later version.
655+
656+ 15. Disclaimer of Warranty.
657+
658+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
659+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
660+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
661+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
662+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
663+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
664+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
665+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
666+
667+ 16. Limitation of Liability.
668+
669+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
670+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
671+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
672+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
673+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
674+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
675+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
676+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
677+SUCH DAMAGES.
678+
679+ 17. Interpretation of Sections 15 and 16.
680+
681+ If the disclaimer of warranty and limitation of liability provided
682+above cannot be given local legal effect according to their terms,
683+reviewing courts shall apply local law that most closely approximates
684+an absolute waiver of all civil liability in connection with the
685+Program, unless a warranty or assumption of liability accompanies a
686+copy of the Program in return for a fee.
687+
688+ END OF TERMS AND CONDITIONS
689+
690+ How to Apply These Terms to Your New Programs
691+
692+ If you develop a new program, and you want it to be of the greatest
693+possible use to the public, the best way to achieve this is to make it
694+free software which everyone can redistribute and change under these terms.
695+
696+ To do so, attach the following notices to the program. It is safest
697+to attach them to the start of each source file to most effectively
698+state the exclusion of warranty; and each file should have at least
699+the "copyright" line and a pointer to where the full notice is found.
700+
701+ <one line to give the program's name and a brief idea of what it does.>
702+ Copyright (C) <year> <name of author>
703+
704+ This program is free software: you can redistribute it and/or modify
705+ it under the terms of the GNU General Public License as published by
706+ the Free Software Foundation, either version 3 of the License, or
707+ (at your option) any later version.
708+
709+ This program is distributed in the hope that it will be useful,
710+ but WITHOUT ANY WARRANTY; without even the implied warranty of
711+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
712+ GNU General Public License for more details.
713+
714+ You should have received a copy of the GNU General Public License
715+ along with this program. If not, see <http://www.gnu.org/licenses/>.
716+
717+Also add information on how to contact you by electronic and paper mail.
718+
719+ If the program does terminal interaction, make it output a short
720+notice like this when it starts in an interactive mode:
721+
722+ <program> Copyright (C) <year> <name of author>
723+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
724+ This is free software, and you are welcome to redistribute it
725+ under certain conditions; type `show c' for details.
726+
727+The hypothetical commands `show w' and `show c' should show the appropriate
728+parts of the General Public License. Of course, your program's commands
729+might be different; for a GUI interface, you would use an "about box".
730+
731+ You should also get your employer (if you work as a programmer) or school,
732+if any, to sign a "copyright disclaimer" for the program, if necessary.
733+For more information on this, and how to apply and follow the GNU GPL, see
734+<http://www.gnu.org/licenses/>.
735+
736+ The GNU General Public License does not permit incorporating your program
737+into proprietary programs. If your program is a subroutine library, you
738+may consider it more useful to permit linking proprietary applications with
739+the library. If this is what you want to do, use the GNU Lesser General
740+Public License instead of this License. But first, please read
741+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
742
743=== added directory 'cmake'
744=== added file 'cmake/Translations.cmake'
745--- cmake/Translations.cmake 1970-01-01 00:00:00 +0000
746+++ cmake/Translations.cmake 2015-10-02 14:23:10 +0000
747@@ -0,0 +1,37 @@
748+# Translations.cmake, CMake macros written for Marlin, feel free to re-use them
749+
750+macro(add_translations_directory NLS_PACKAGE)
751+ add_custom_target (i18n ALL)
752+ find_program (MSGFMT_EXECUTABLE msgfmt)
753+ file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po)
754+ foreach (PO_INPUT ${PO_FILES})
755+ get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE)
756+ set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo)
757+ add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT})
758+
759+ install (FILES ${MO_OUTPUT} DESTINATION
760+ ${CMAKE_INSTALL_LOCALEDIR}/${PO_INPUT_BASE}/LC_MESSAGES
761+ RENAME ${NLS_PACKAGE}.mo)
762+ endforeach (PO_INPUT ${PO_FILES})
763+endmacro(add_translations_directory)
764+
765+
766+macro(add_translations_catalog NLS_PACKAGE)
767+ add_custom_target (pot COMMENT “Building translation catalog.”)
768+ find_program (XGETTEXT_EXECUTABLE xgettext)
769+
770+ # init this list, which will hold all the sources across all dirs
771+ set(SOURCES "")
772+
773+ # add each directory's sources to the overall sources list
774+ foreach(FILES_INPUT ${ARGN})
775+ set (DIR ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT})
776+ file (GLOB_RECURSE DIR_SOURCES ${DIR}/*.c ${DIR}/*.cc ${DIR}/*.cpp ${DIR}/*.cxx ${DIR}/*.vala)
777+ set (SOURCES ${SOURCES} ${DIR_SOURCES})
778+ endforeach()
779+
780+ add_custom_command (TARGET pot COMMAND
781+ ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot
782+ ${SOURCES} --keyword="_" --keyword="N_" --from-code=UTF-8
783+ )
784+endmacro()
785
786=== added file 'cmake/lcov.cmake'
787--- cmake/lcov.cmake 1970-01-01 00:00:00 +0000
788+++ cmake/lcov.cmake 2015-10-02 14:23:10 +0000
789@@ -0,0 +1,72 @@
790+# - This module creates a new 'lcov' target which generates
791+# a coverage analysis html output.
792+# LCOV is a graphical front-end for GCC's coverage testing tool gcov. Please see
793+# http://ltp.sourceforge.net/coverage/lcov.php
794+#
795+# Usage: you must add an option to your CMakeLists.txt to build your application
796+# with coverage support. Then you need to include this file to the lcov target.
797+#
798+# Example:
799+# IF(BUILD_WITH_COVERAGE)
800+# SET(CMAKE_C_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
801+# SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -fprofile-arcs -ftest-coverage")
802+# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov")
803+# include(${CMAKE_SOURCE_DIR}/cmake/lcov.cmake)
804+# ENDIF(BUILD_WITH_COVERAGE)
805+#=============================================================================
806+# Copyright 2010 ascolab GmbH
807+#
808+# Distributed under the OSI-approved BSD License (the "License");
809+# see accompanying file Copyright.txt for details.
810+#
811+# This software is distributed WITHOUT ANY WARRANTY; without even the
812+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
813+# See the License for more information.
814+#=============================================================================
815+# (To distributed this file outside of CMake, substitute the full
816+# License text for the above reference.)
817+
818+set(REMOVE_PATTERN
819+ q*.h
820+ *.moc
821+ moc_*.cpp
822+ locale_facets.h
823+ new
824+ move.h
825+ qcontactmemorybackend.cpp
826+ limits
827+ /usr/include/c++/4.9/bits/*
828+ /usr/include/buteosyncfw5/*
829+ )
830+
831+## lcov target
832+ADD_CUSTOM_TARGET(lcov)
833+ADD_CUSTOM_COMMAND(TARGET lcov
834+ COMMAND mkdir -p coverage
835+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
836+ )
837+ADD_CUSTOM_COMMAND(TARGET lcov
838+ COMMAND lcov --directory . --zerocounters
839+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
840+ )
841+ADD_CUSTOM_COMMAND(TARGET lcov
842+ COMMAND make test
843+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
844+ )
845+ADD_CUSTOM_COMMAND(TARGET lcov
846+ COMMAND lcov --directory . --capture --output-file ./coverage/stap_all.info --no-checksum --compat-libtool
847+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
848+ )
849+ADD_CUSTOM_COMMAND(TARGET lcov
850+ COMMAND lcov --directory . -r ./coverage/stap_all.info ${REMOVE_PATTERN} --output-file ./coverage/stap.info
851+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
852+ )
853+ADD_CUSTOM_COMMAND(TARGET lcov
854+ COMMAND genhtml -o ./coverage --title "Code Coverage" --legend --show-details --demangle-cpp ./coverage/stap.info
855+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
856+ )
857+ADD_CUSTOM_COMMAND(TARGET lcov
858+ COMMAND echo "Open ${CMAKE_BINARY_DIR}/coverage/index.html to view the coverage analysis results."
859+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
860+ )
861+
862
863=== added file 'cmake_uninstall.cmake.in'
864--- cmake_uninstall.cmake.in 1970-01-01 00:00:00 +0000
865+++ cmake_uninstall.cmake.in 2015-10-02 14:23:10 +0000
866@@ -0,0 +1,21 @@
867+IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
868+ MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
869+ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
870+
871+FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
872+STRING(REGEX REPLACE "\n" ";" files "${files}")
873+FOREACH(file ${files})
874+ MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
875+ IF(EXISTS "$ENV{DESTDIR}${file}")
876+ EXEC_PROGRAM(
877+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
878+ OUTPUT_VARIABLE rm_out
879+ RETURN_VALUE rm_retval
880+ )
881+ IF(NOT "${rm_retval}" STREQUAL 0)
882+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
883+ ENDIF(NOT "${rm_retval}" STREQUAL 0)
884+ ELSE(EXISTS "$ENV{DESTDIR}${file}")
885+ MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
886+ ENDIF(EXISTS "$ENV{DESTDIR}${file}")
887+ENDFOREACH(file)
888
889=== added file 'config.h.in'
890--- config.h.in 1970-01-01 00:00:00 +0000
891+++ config.h.in 2015-10-02 14:23:10 +0000
892@@ -0,0 +1,9 @@
893+#ifndef __CONFIG_H__
894+#define __CONFIG_H__
895+
896+#include <QString>
897+
898+const QString GOOGLE_ETAG_DETAIL ("X-GOOGLE-ETAG");
899+const QString QCONTACTS_BACKEND_NAME ("galera");
900+
901+#endif
902
903=== modified file 'debian/changelog'
904--- debian/changelog 2015-08-04 15:15:16 +0000
905+++ debian/changelog 2015-10-02 14:23:10 +0000
906@@ -1,5 +1,6 @@
907 indicator-transfer-buteo (0.1-0ubuntu1) UNRELEASED; urgency=medium
908
909+ [ Renato Araujo Oliveira Filho ]
910 * Initial package
911
912- -- Renato Araujo Oliveira Filho <renato.filho@canonical.com> Thu, 4 Ago 2015 20:52:19 -0300
913+ -- Renato Araujo Oliveira Filho <renato.filho@canonical.com> Fri, 02 Oct 2015 11:05:45 -0300
914
915=== modified file 'debian/control'
916--- debian/control 2015-08-05 14:18:32 +0000
917+++ debian/control 2015-10-02 14:23:10 +0000
918@@ -3,10 +3,17 @@
919 Priority: optional
920 Maintainer: Renato Araujo Oliveira Filho <renato.filho@canonical.com>
921 Build-Depends: cmake,
922+ dbus-test-runner,
923 debhelper (>= 9),
924 libaccounts-qt5-dev,
925- libindicator-transfer-dev,
926+ libindicator-transfer-dev (>= 0.2),
927+ libglib2.0-dev,
928+ liburl-dispatcher1-dev,
929+ libproperties-cpp-dev,
930 pkg-config,
931+ python3,
932+ python3-dbus,
933+ python3-gi,
934 qt5-default,
935 qtbase5-dev,
936 Standards-Version: 3.9.5
937@@ -16,6 +23,6 @@
938 Architecture: any
939 Depends: ${misc:Depends},
940 ${shlibs:Depends},
941- indicator-transfer,
942+ indicator-transfer (>= 0.2),
943 Description: Transfer indicator Buteo plugin
944- Transfer indicator Buteo plugin
945+ Buteo plugin for the Transfer Indicator
946
947=== added directory 'po'
948=== added file 'po/CMakeLists.txt'
949--- po/CMakeLists.txt 1970-01-01 00:00:00 +0000
950+++ po/CMakeLists.txt 2015-10-02 14:23:10 +0000
951@@ -0,0 +1,3 @@
952+include(Translations)
953+add_translations_directory(${GETTEXT_PACKAGE})
954+add_translations_catalog(${GETTEXT_PACKAGE} ../src/)
955
956=== added file 'po/indicator-transfer-buteo.pot'
957--- po/indicator-transfer-buteo.pot 1970-01-01 00:00:00 +0000
958+++ po/indicator-transfer-buteo.pot 2015-10-02 14:23:10 +0000
959@@ -0,0 +1,22 @@
960+# SOME DESCRIPTIVE TITLE.
961+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
962+# This file is distributed under the same license as the PACKAGE package.
963+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
964+#
965+#, fuzzy
966+msgid ""
967+msgstr ""
968+"Project-Id-Version: PACKAGE VERSION\n"
969+"Report-Msgid-Bugs-To: \n"
970+"POT-Creation-Date: 2015-09-08 15:11-0300\n"
971+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
972+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
973+"Language-Team: LANGUAGE <LL@li.org>\n"
974+"Language: \n"
975+"MIME-Version: 1.0\n"
976+"Content-Type: text/plain; charset=CHARSET\n"
977+"Content-Transfer-Encoding: 8bit\n"
978+
979+#: /home/renato/projects/phablet/buteo/intdicator-transfer-buteo-plugin/po/../src//buteo-transfer.cpp:123
980+msgid "Syncing"
981+msgstr ""
982
983=== added directory 'src'
984=== added file 'src/CMakeLists.txt'
985--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
986+++ src/CMakeLists.txt 2015-10-02 14:23:10 +0000
987@@ -0,0 +1,43 @@
988+set(BUTEO_TRANSFERS_PLUGIN buteo-transfers)
989+set(BUTEO_TRANSFERS_SRCS
990+ buteo-plugin.cpp
991+ buteo-plugin.h
992+ buteo-source.cpp
993+ buteo-source.h
994+ buteo-transfer.cpp
995+ buteo-transfer.h
996+)
997+
998+add_library(${BUTEO_TRANSFERS_PLUGIN} MODULE
999+ ${BUTEO_TRANSFERS_SRCS}
1000+)
1001+
1002+include_directories(
1003+ ${CMAKE_BINARY_DIR}
1004+ ${GMODULE_INCLUDE_DIRS}
1005+ ${TRANSFER_INDICATOR_INCLUDE_DIRS}
1006+ ${URL_DISPATCHER_INCLUDE_DIRS}
1007+ ${ACCOUNTS_QT5_INCLUDE_DIRS}
1008+)
1009+
1010+target_link_libraries(${BUTEO_TRANSFERS_PLUGIN}
1011+ Qt5::Core
1012+ Qt5::DBus
1013+ Qt5::Xml
1014+ ${GMODULE_LIBRARIES}
1015+ ${TRANSFER_INDICATOR_LIBRARIES}
1016+ ${URL_DISPATCHER_LIBRARIES}
1017+ ${ACCOUNTS_QT5_LIBRARIES}
1018+)
1019+
1020+add_definitions(-std=c++11)
1021+
1022+execute_process(
1023+ COMMAND pkg-config --variable=plugindir indicator-transfer
1024+ OUTPUT_VARIABLE INTDICATOR_TRANSFER_PLUGINDIR
1025+ OUTPUT_STRIP_TRAILING_WHITESPACE
1026+)
1027+
1028+install(TARGETS ${BUTEO_TRANSFERS_PLUGIN}
1029+ DESTINATION ${INTDICATOR_TRANSFER_PLUGINDIR}/
1030+)
1031
1032=== added file 'src/buteo-plugin.cpp'
1033--- src/buteo-plugin.cpp 1970-01-01 00:00:00 +0000
1034+++ src/buteo-plugin.cpp 2015-10-02 14:23:10 +0000
1035@@ -0,0 +1,42 @@
1036+/*
1037+ * Copyright 2015 Canonical Ltd.
1038+ *
1039+ * This program is free software: you can redistribute it and/or modify it
1040+ * under the terms of the GNU General Public License version 3, as published
1041+ * by the Free Software Foundation.
1042+ *
1043+ * This program is distributed in the hope that it will be useful, but
1044+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1045+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1046+ * PURPOSE. See the GNU General Public License for more details.
1047+ *
1048+ * You should have received a copy of the GNU General Public License along
1049+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1050+ *
1051+ * Authors:
1052+ * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1053+ */
1054+
1055+#include "buteo-source.h"
1056+
1057+#include <gmodule.h>
1058+#include <glib/gi18n.h> // bindtextdomain()
1059+#include <locale.h>
1060+
1061+
1062+using namespace unity::indicator::transfer;
1063+
1064+extern "C"
1065+{
1066+
1067+G_MODULE_EXPORT Source* get_source()
1068+{
1069+ // boilerplate i18n
1070+ setlocale(LC_ALL, "");
1071+ bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
1072+ textdomain(GETTEXT_PACKAGE);
1073+
1074+ return new ButeoSource;
1075+}
1076+
1077+}
1078
1079=== added file 'src/buteo-plugin.h'
1080=== added file 'src/buteo-source.cpp'
1081--- src/buteo-source.cpp 1970-01-01 00:00:00 +0000
1082+++ src/buteo-source.cpp 2015-10-02 14:23:10 +0000
1083@@ -0,0 +1,339 @@
1084+/*
1085+ * Copyright 2015 Canonical Ltd.
1086+ *
1087+ * This program is free software: you can redistribute it and/or modify it
1088+ * under the terms of the GNU General Public License version 3, as published
1089+ * by the Free Software Foundation.
1090+ *
1091+ * This program is distributed in the hope that it will be useful, but
1092+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1093+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1094+ * PURPOSE. See the GNU General Public License for more details.
1095+ *
1096+ * You should have received a copy of the GNU General Public License along
1097+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1098+ *
1099+ * Authors:
1100+ * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1101+ */
1102+
1103+#include "buteo-source.h"
1104+#include "buteo-transfer.h"
1105+
1106+#include <QtCore/QDebug>
1107+#include <QtCore/QCoreApplication>
1108+#include <QtCore/QString>
1109+#include <QtDBus/QDBusReply>
1110+#include <QtXml/QDomDocument>
1111+
1112+#define BUTEO_SERVICE_NAME "com.meego.msyncd"
1113+#define BUTEO_OBJECT_PATH "/synchronizer"
1114+#define BUTEO_DBUS_INTEFACE "com.meego.msyncd"
1115+
1116+using namespace unity::indicator::transfer;
1117+
1118+ButeoSource::ButeoSource()
1119+ : m_cancellable(g_cancellable_new()),
1120+ m_model(std::make_shared<MutableModel>())
1121+{
1122+ g_bus_get(G_BUS_TYPE_SESSION, m_cancellable,
1123+ (GAsyncReadyCallback) onBusReady, this);
1124+}
1125+
1126+ButeoSource::~ButeoSource()
1127+{
1128+ g_cancellable_cancel(m_cancellable);
1129+ g_clear_object(&m_cancellable);
1130+ setBus(nullptr);
1131+}
1132+
1133+bool ButeoSource::connected() const
1134+{
1135+ return (m_bus != nullptr);
1136+}
1137+
1138+void ButeoSource::open(const Transfer::Id &id)
1139+{
1140+ qDebug() << "Buteo open" << QString::fromStdString(id);
1141+ open_app(id);
1142+}
1143+
1144+void ButeoSource::start(const Transfer::Id &id)
1145+{
1146+ qDebug() << "start" << QString::fromStdString(id);
1147+ GError *gError = nullptr;
1148+ GVariant *reply = g_dbus_connection_call_sync(m_bus,
1149+ BUTEO_SERVICE_NAME,
1150+ BUTEO_OBJECT_PATH,
1151+ BUTEO_DBUS_INTEFACE,
1152+ "startSync",
1153+ g_variant_new("(s)", id.c_str()),
1154+ G_VARIANT_TYPE("(b)"),
1155+ G_DBUS_CALL_FLAGS_NONE,
1156+ -1,
1157+ m_cancellable,
1158+ &gError);
1159+ gboolean result = FALSE;
1160+ if (gError) {
1161+ qWarning() << "Fail to start sync" << gError->message;
1162+ g_error_free(gError);
1163+ } else {
1164+ g_variant_get_child(reply, 0, "b", &result);
1165+ }
1166+ g_clear_pointer(&reply, g_variant_unref);
1167+
1168+ if (!result) {
1169+ qWarning() << "Fail to start sync for profile" << QString::fromStdString(id);
1170+ }
1171+}
1172+
1173+void ButeoSource::pause(const Transfer::Id &id)
1174+{
1175+ Q_UNUSED(id);
1176+ qWarning() << "Buteo plugin does not support pause";
1177+}
1178+
1179+void ButeoSource::resume(const Transfer::Id &id)
1180+{
1181+ Q_UNUSED(id);
1182+ qWarning() << "Buteo plugin does not support resume";
1183+}
1184+
1185+void ButeoSource::cancel(const Transfer::Id &id)
1186+{
1187+ GError *gError = nullptr;
1188+ GVariant *reply = g_dbus_connection_call_sync(m_bus,
1189+ BUTEO_SERVICE_NAME,
1190+ BUTEO_OBJECT_PATH,
1191+ BUTEO_DBUS_INTEFACE,
1192+ "abortSync",
1193+ g_variant_new("(s)", id.c_str()),
1194+ nullptr,
1195+ G_DBUS_CALL_FLAGS_NONE,
1196+ -1,
1197+ m_cancellable,
1198+ &gError);
1199+ if (gError) {
1200+ qWarning() << "Fail to about sync" << gError->message;
1201+ g_error_free(gError);
1202+ }
1203+ g_clear_pointer(&reply, g_variant_unref);
1204+}
1205+
1206+void ButeoSource::open_app(const Transfer::Id &id)
1207+{
1208+ std::shared_ptr<Transfer> transfer = m_model->get(id);
1209+ std::static_pointer_cast<ButeoTransfer>(transfer)->launchApp();
1210+}
1211+
1212+void ButeoSource::clear(const Transfer::Id &id)
1213+{
1214+ m_model->remove(id);
1215+}
1216+
1217+const std::shared_ptr<const MutableModel> ButeoSource::get_model()
1218+{
1219+ return m_model;
1220+}
1221+
1222+void ButeoSource::onSyncStatus(GDBusConnection* connection,
1223+ const gchar* senderName,
1224+ const gchar* objectPath,
1225+ const gchar* interfaceName,
1226+ const gchar* signalName,
1227+ GVariant* parameters,
1228+ ButeoSource* self)
1229+{
1230+ Q_UNUSED(connection);
1231+ Q_UNUSED(senderName);
1232+ Q_UNUSED(objectPath);
1233+ Q_UNUSED(interfaceName);
1234+ Q_UNUSED(signalName);
1235+
1236+ const gchar *profileId = nullptr;
1237+ g_variant_get_child(parameters, 0, "&s", &profileId);
1238+
1239+ gint status = -1;
1240+ g_variant_get_child(parameters, 1, "i", &status);
1241+
1242+ const gchar *message = nullptr;
1243+ g_variant_get_child(parameters, 2, "&s", &message);
1244+
1245+ gint moreDetails = -1;
1246+ g_variant_get_child(parameters, 3, "i", &moreDetails);
1247+
1248+ qDebug() << "Profile" << profileId << "\n"
1249+ << "\tStatus" << status << "\n"
1250+ << "\tMessage" << message << "\n"
1251+ << "\tDetails" << moreDetails;
1252+
1253+ // if errror is a internal error ignore it,
1254+ // this can be fired while creating the account with disabled service
1255+ if (moreDetails == 401) {
1256+ return;
1257+ }
1258+
1259+ std::shared_ptr<Transfer> transfer = self->m_model->get(profileId);
1260+ if (!transfer) {
1261+ QVariantMap fields = self->profileFields(profileId);
1262+ transfer = std::shared_ptr<Transfer>(new ButeoTransfer(profileId, fields));
1263+ self->m_model->add(transfer);
1264+ qDebug() << "Add new profile"
1265+ << QString::fromUtf8(profileId)
1266+ << QString::fromStdString(transfer->title);
1267+ }
1268+
1269+ std::static_pointer_cast<ButeoTransfer>(transfer)->updateStatus(status, message, moreDetails);
1270+ self->m_model->emit_changed(transfer->id);
1271+
1272+ if (transfer->state == Transfer::CANCELED) {
1273+ self->m_model->remove(transfer->id);
1274+ }
1275+}
1276+
1277+void ButeoSource::onProfileChanged(GDBusConnection* connection,
1278+ const gchar* senderName,
1279+ const gchar* objectPath,
1280+ const gchar* interfaceName,
1281+ const gchar* signalName,
1282+ GVariant* parameters,
1283+ ButeoSource* self)
1284+{
1285+ Q_UNUSED(connection);
1286+ Q_UNUSED(senderName);
1287+ Q_UNUSED(objectPath);
1288+ Q_UNUSED(interfaceName);
1289+ Q_UNUSED(signalName);
1290+
1291+ /*
1292+ <signal name=\"signalProfileChanged\">\n"
1293+ <arg direction=\"out\" type=\"s\" name=\"aProfileName\"/>\n"
1294+ <arg direction=\"out\" type=\"i\" name=\"aChangeType\"/>\n"
1295+ <arg direction=\"out\" type=\"s\" name=\"aProfileAsXml\"/>\n"
1296+ </signal>\n"
1297+ */
1298+
1299+ const gchar *profileId = nullptr;
1300+ g_variant_get_child(parameters, 0, "&s", &profileId);
1301+
1302+ gint changeType = -1;
1303+ g_variant_get_child(parameters, 1, "i", &changeType);
1304+
1305+ qDebug() << "Profile Changed" << profileId << "\n"
1306+ << "\tChange type" << changeType;
1307+
1308+ /*
1309+ * \param aChangeType
1310+ * 0 (ADDITION): Profile was added.
1311+ * 1 (MODIFICATION): Profile was modified.
1312+ * 2 (DELETION): Profile was deleted.
1313+ */
1314+
1315+ if (changeType == 2) {
1316+ std::shared_ptr<Transfer> transfer = self->m_model->get(profileId);
1317+ if (transfer) {
1318+ qDebug() << "Removing transfer:" << transfer->id.c_str();
1319+ self->clear(transfer->id);
1320+ }
1321+ }
1322+}
1323+
1324+void ButeoSource::setBus(GDBusConnection *bus)
1325+{
1326+ if (m_bus == bus) {
1327+ return;
1328+ }
1329+
1330+ if (m_bus) {
1331+ g_dbus_connection_signal_unsubscribe(m_bus, m_syncStatusId);
1332+ m_syncStatusId = 0;
1333+ g_dbus_connection_signal_unsubscribe(m_bus, m_profileChangedId);
1334+ m_profileChangedId = 0;
1335+ m_model.reset();
1336+ g_object_unref(m_bus);
1337+ m_bus = nullptr;
1338+ }
1339+
1340+ if (bus != nullptr) {
1341+ m_bus = G_DBUS_CONNECTION(g_object_ref(bus));;
1342+ m_syncStatusId = g_dbus_connection_signal_subscribe(m_bus,
1343+ BUTEO_SERVICE_NAME,
1344+ BUTEO_DBUS_INTEFACE,
1345+ "syncStatus",
1346+ BUTEO_OBJECT_PATH,
1347+ NULL,
1348+ G_DBUS_SIGNAL_FLAGS_NONE,
1349+ (GDBusSignalCallback) onSyncStatus,
1350+ this,
1351+ nullptr);
1352+
1353+ m_profileChangedId = g_dbus_connection_signal_subscribe(m_bus,
1354+ BUTEO_SERVICE_NAME,
1355+ BUTEO_DBUS_INTEFACE,
1356+ "signalProfileChanged",
1357+ BUTEO_OBJECT_PATH,
1358+ NULL,
1359+ G_DBUS_SIGNAL_FLAGS_NONE,
1360+ (GDBusSignalCallback) onProfileChanged,
1361+ this,
1362+ nullptr);
1363+ }
1364+}
1365+
1366+void ButeoSource::onBusReady(GObject *object, GAsyncResult *res, ButeoSource *self)
1367+{
1368+ Q_UNUSED(object);
1369+ GError* error = nullptr;
1370+ GDBusConnection *bus = g_bus_get_finish(res, &error);
1371+
1372+ if (bus) {
1373+ self->setBus(bus);
1374+ g_object_unref(bus);
1375+ } else {
1376+ if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
1377+ g_warning("Could not get session bus: %s", error->message);
1378+ }
1379+ g_error_free(error);
1380+ }
1381+}
1382+
1383+
1384+QVariantMap ButeoSource::profileFields(const QString &profileId) const
1385+{
1386+ QVariantMap result;
1387+
1388+ GError *gError = nullptr;
1389+ GVariant *reply = g_dbus_connection_call_sync(m_bus,
1390+ BUTEO_SERVICE_NAME,
1391+ BUTEO_OBJECT_PATH,
1392+ BUTEO_DBUS_INTEFACE,
1393+ "syncProfile",
1394+ g_variant_new("(s)", profileId.toUtf8().data()),
1395+ G_VARIANT_TYPE("(s)"),
1396+ G_DBUS_CALL_FLAGS_NONE,
1397+ -1,
1398+ m_cancellable,
1399+ &gError);
1400+
1401+ if (gError) {
1402+ qWarning() << "Failt to retrieve profile" << profileId << gError->message;
1403+ g_error_free(gError);
1404+ return result;
1405+ }
1406+
1407+ const gchar* profileXml = nullptr;
1408+ g_variant_get_child(reply, 0, "&s", &profileXml);
1409+
1410+ // parse Xml
1411+ QDomDocument doc;
1412+ if (doc.setContent(QString::fromUtf8(profileXml))) {
1413+ QDomNodeList keys = doc.elementsByTagName("key");
1414+ for (int i = 0; i < keys.size(); i++) {
1415+ QDomElement element = keys.item(i).toElement();
1416+ result.insert(element.attribute("name"), element.attribute("value"));
1417+ }
1418+ }
1419+
1420+ g_clear_pointer(&reply, g_variant_unref);
1421+ return result;
1422+}
1423
1424=== added file 'src/buteo-source.h'
1425--- src/buteo-source.h 1970-01-01 00:00:00 +0000
1426+++ src/buteo-source.h 2015-10-02 14:23:10 +0000
1427@@ -0,0 +1,84 @@
1428+/*
1429+ * Copyright 2015 Canonical Ltd.
1430+ *
1431+ * This program is free software: you can redistribute it and/or modify it
1432+ * under the terms of the GNU General Public License version 3, as published
1433+ * by the Free Software Foundation.
1434+ *
1435+ * This program is distributed in the hope that it will be useful, but
1436+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1437+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1438+ * PURPOSE. See the GNU General Public License for more details.
1439+ *
1440+ * You should have received a copy of the GNU General Public License along
1441+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1442+ *
1443+ * Authors:
1444+ * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1445+ */
1446+
1447+#include <memory>
1448+#include <indicator-transfer/transfer/source.h>
1449+
1450+#include <QtCore/QMap>
1451+#include <QtCore/QCoreApplication>
1452+#include <QtCore/QScopedPointer>
1453+#include <QtDBus/QDBusInterface>
1454+#include <QtDBus/QDBusServiceWatcher>
1455+
1456+namespace unity {
1457+namespace indicator {
1458+namespace transfer {
1459+
1460+class ButeoTransfer;
1461+
1462+class ButeoSource : public Source
1463+{
1464+public:
1465+ ButeoSource();
1466+ ~ButeoSource();
1467+
1468+ bool connected() const;
1469+ void open(const Transfer::Id& id) override;
1470+ void start(const Transfer::Id& id) override;
1471+ void pause(const Transfer::Id& id) override;
1472+ void resume(const Transfer::Id& id) override;
1473+ void cancel(const Transfer::Id& id) override;
1474+ void open_app(const Transfer::Id& id) override;
1475+ void clear(const Transfer::Id &id) override;
1476+
1477+ const std::shared_ptr<const MutableModel> get_model() override;
1478+
1479+private:
1480+ GCancellable *m_cancellable;
1481+ GDBusConnection *m_bus = nullptr;
1482+ guint m_syncStatusId = 0;
1483+ guint m_profileChangedId = 0;
1484+
1485+ std::shared_ptr<MutableModel> m_model;
1486+
1487+ void setBus(GDBusConnection *bus);
1488+
1489+ QVariantMap profileFields(const QString &profileId) const;
1490+
1491+ static void onBusReady(GObject *object, GAsyncResult *res, ButeoSource *self);
1492+ static void onSyncStatus(GDBusConnection* connection,
1493+ const gchar* senderName,
1494+ const gchar* objectPath,
1495+ const gchar* interfaceName,
1496+ const gchar* signalName,
1497+ GVariant* parameters,
1498+ ButeoSource* self);
1499+ static void onProfileChanged(GDBusConnection* connection,
1500+ const gchar* senderName,
1501+ const gchar* objectPath,
1502+ const gchar* interfaceName,
1503+ const gchar* signalName,
1504+ GVariant* parameters,
1505+ ButeoSource* self);
1506+};
1507+
1508+} // namespace transfer
1509+} // namespace indicator
1510+} // namespace unity
1511+
1512
1513=== added file 'src/buteo-transfer.cpp'
1514--- src/buteo-transfer.cpp 1970-01-01 00:00:00 +0000
1515+++ src/buteo-transfer.cpp 2015-10-02 14:23:10 +0000
1516@@ -0,0 +1,187 @@
1517+/*
1518+ * Copyright 2015 Canonical Ltd.
1519+ *
1520+ * This program is free software: you can redistribute it and/or modify it
1521+ * under the terms of the GNU General Public License version 3, as published
1522+ * by the Free Software Foundation.
1523+ *
1524+ * This program is distributed in the hope that it will be useful, but
1525+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1526+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1527+ * PURPOSE. See the GNU General Public License for more details.
1528+ *
1529+ * You should have received a copy of the GNU General Public License along
1530+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1531+ *
1532+ * Authors:
1533+ * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1534+ */
1535+
1536+#include "buteo-transfer.h"
1537+
1538+#include <QtCore/QFileInfo>
1539+#include <QtCore/QDebug>
1540+
1541+#include <Accounts/Manager>
1542+#include <Accounts/Account>
1543+#include <Accounts/Application>
1544+
1545+#include <url-dispatcher.h>
1546+#include <indicator-transfer/transfer/transfer.h>
1547+
1548+#include <glib/gi18n.h>
1549+
1550+using namespace unity::indicator::transfer;
1551+
1552+ButeoTransfer::ButeoTransfer(const QString &profileId,
1553+ const QVariantMap &fields)
1554+{
1555+ id = profileId.toStdString();
1556+ state = Transfer::QUEUED;
1557+ m_category = fields.value("category", "contacts").toString();
1558+
1559+ // retrieve account
1560+ int accountId = fields.value("accountid", 0).toInt();
1561+ QString serviceName = fields.value("remote_service_name", "").toString();
1562+ if (accountId > 0) {
1563+ Accounts::Manager manager;
1564+ Accounts::Account *account = manager.account(accountId);
1565+ if (account) {
1566+ title = account->displayName().toStdString();
1567+ delete account;
1568+ } else {
1569+ qWarning() << "Account not found" << accountId;
1570+ }
1571+
1572+ Accounts::Service service = manager.service(serviceName);
1573+ if (service.isValid()) {
1574+ Accounts::ApplicationList apps = manager.applicationList(service);
1575+ if (!apps.isEmpty()) {
1576+ // we only consider the first app for now
1577+ // TODO: check if we need care about a list of apps
1578+ Accounts::Application app = apps.first();
1579+ app_icon = app.iconName().toStdString();
1580+
1581+ if (app.desktopFilePath().isEmpty()) {
1582+ m_appUrl = QString("%1://").arg(app.name());
1583+ } else {
1584+ QFileInfo desktopIfon(app.desktopFilePath());
1585+ m_appUrl = QString("application:///%1").arg(desktopIfon.fileName());
1586+ }
1587+ } else {
1588+ qWarning() << "No application found for service" << serviceName;
1589+ }
1590+ } else {
1591+ qWarning() << "Service not found" << serviceName;
1592+ }
1593+ }
1594+}
1595+
1596+void ButeoTransfer::launchApp() const
1597+{
1598+ qDebug() << "application url" << m_appUrl;
1599+ url_dispatch_send(m_appUrl.toUtf8().data(), NULL, NULL);
1600+}
1601+
1602+void ButeoTransfer::updateStatus(int status, const QString &message, int moreDetails)
1603+{
1604+ /* status
1605+ 0 (QUEUED): Sync request has been queued or was already in the
1606+ queue when sync start was requested.
1607+ 1 (STARTED): Sync session has been started.
1608+ 2 (PROGRESS): Sync session is progressing.
1609+ 3 (ERROR): Sync session has encountered an error and has been stopped,
1610+ or the session could not be started at all.
1611+ 4 (DONE): Sync session was successfully completed.
1612+ 5 (ABORTED): Sync session was aborted.
1613+ */
1614+ switch(status) {
1615+ case 0:
1616+ state = Transfer::QUEUED;
1617+ // reset transfer in case it be an old transfer
1618+ reset();
1619+ break;
1620+ case 1:
1621+ case 2:
1622+ state = Transfer::RUNNING;
1623+ updateProgress(moreDetails);
1624+ break;
1625+ case 3:
1626+ state = Transfer::ERROR;
1627+ error_string = message.toStdString();
1628+ break;
1629+ case 4:
1630+ state = Transfer::FINISHED;
1631+ break;
1632+ case 5:
1633+ state = Transfer::CANCELED;
1634+ break;
1635+ }
1636+
1637+ if (state == Transfer::RUNNING) {
1638+ custom_state = _("Syncing");
1639+ } else {
1640+ custom_state = "";
1641+ }
1642+}
1643+
1644+void ButeoTransfer::reset()
1645+{
1646+ m_state = 0;
1647+ progress = 0.0;
1648+ error_string = "";
1649+}
1650+
1651+void ButeoTransfer::updateProgress(int progress)
1652+{
1653+ // sync moreDetails
1654+ //SYNC_PROGRESS_INITIALISING = 201,
1655+ //SYNC_PROGRESS_SENDING_ITEMS ,
1656+ //SYNC_PROGRESS_RECEIVING_ITEMS,
1657+ //SYNC_PROGRESS_FINALISING
1658+
1659+ qreal realProgress = progress;
1660+ // the state can be a sync state or a sync progress
1661+ // any value bigger than 200 is a sync state
1662+ if (progress >= 200) {
1663+ m_state = progress;
1664+ realProgress = 0;
1665+ }
1666+
1667+ // the progress is a combination of sync state and the progress
1668+ switch(m_state) {
1669+ case 201: //SYNC_PROGRESS_INITIALISING
1670+ realProgress = 1.0;
1671+ break;
1672+ case 203: //SYNC_PROGRESS_RECEIVING_ITEMS [0..100]
1673+ break;
1674+ case 202: //SYNC_PROGRESS_SENDING_ITEMS [100..200]
1675+ realProgress += 100.0;
1676+ break;
1677+ case 204: //SYNC_PROGRESS_FINALISING
1678+ realProgress = 200.0;
1679+ break;
1680+ }
1681+
1682+ if (realProgress > 0) {
1683+ this->progress = (realProgress / 200.0);
1684+ } else {
1685+ this->progress = 0.0;
1686+ }
1687+}
1688+
1689+bool ButeoTransfer::can_start() const
1690+{
1691+ switch(state) {
1692+ case Transfer::ERROR:
1693+ case Transfer::CANCELED:
1694+ return true;
1695+ default:
1696+ return false;
1697+ }
1698+}
1699+
1700+bool ButeoTransfer::can_pause() const
1701+{
1702+ return false;
1703+}
1704
1705=== added file 'src/buteo-transfer.h'
1706--- src/buteo-transfer.h 1970-01-01 00:00:00 +0000
1707+++ src/buteo-transfer.h 2015-10-02 14:23:10 +0000
1708@@ -0,0 +1,53 @@
1709+/*
1710+ * Copyright 2015 Canonical Ltd.
1711+ *
1712+ * This program is free software: you can redistribute it and/or modify it
1713+ * under the terms of the GNU General Public License version 3, as published
1714+ * by the Free Software Foundation.
1715+ *
1716+ * This program is distributed in the hope that it will be useful, but
1717+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1718+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1719+ * PURPOSE. See the GNU General Public License for more details.
1720+ *
1721+ * You should have received a copy of the GNU General Public License along
1722+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1723+ *
1724+ * Authors:
1725+ * Renato Araujo Oliveira Filho <renato.filho@canonical.com>
1726+ */
1727+
1728+#include <indicator-transfer/transfer/transfer.h>
1729+#include <memory>
1730+
1731+#include <QtCore/QString>
1732+#include <QtCore/QVariant>
1733+#include <QtCore/QMap>
1734+
1735+namespace unity {
1736+namespace indicator {
1737+namespace transfer {
1738+
1739+class ButeoTransfer : public Transfer
1740+{
1741+public:
1742+ ButeoTransfer(const QString &profileId,
1743+ const QVariantMap &fields);
1744+ void launchApp() const;
1745+ void updateStatus(int status, const QString &message, int moreDetails);
1746+ void reset();
1747+
1748+ bool can_pause() const override;
1749+ bool can_start() const override;
1750+
1751+private:
1752+ QString m_category;
1753+ QString m_appUrl;
1754+ int m_state = 0;
1755+
1756+ void updateProgress(int progress);
1757+};
1758+
1759+} // namespace transfer
1760+} // namespace indicator
1761+} // namespace unity
1762
1763=== added directory 'tests'
1764=== added file 'tests/CMakeLists.txt'
1765--- tests/CMakeLists.txt 1970-01-01 00:00:00 +0000
1766+++ tests/CMakeLists.txt 2015-10-02 14:23:10 +0000
1767@@ -0,0 +1,34 @@
1768+add_executable(tst-transfer-plugin
1769+ tst-transfer-plugin.cpp
1770+ ${CMAKE_SOURCE_DIR}/src/buteo-source.cpp
1771+ ${CMAKE_SOURCE_DIR}/src/buteo-transfer.cpp
1772+)
1773+
1774+target_link_libraries(tst-transfer-plugin
1775+ Qt5::Core
1776+ Qt5::DBus
1777+ Qt5::Xml
1778+ ${GMODULE_LIBRARIES}
1779+ ${TRANSFER_INDICATOR_LIBRARIES}
1780+ ${URL_DISPATCHER_LIBRARIES}
1781+ ${ACCOUNTS_QT5_LIBRARIES}
1782+)
1783+
1784+include_directories(
1785+ ${CMAKE_BINARY_DIR}
1786+ ${CMAKE_SOURCE_DIR}/src
1787+ ${TRANSFER_INDICATOR_INCLUDE_DIRS}
1788+ ${URL_DISPATCHER_INCLUDE_DIRS}
1789+ ${ACCOUNTS_QT5_INCLUDE_DIRS}
1790+)
1791+
1792+qt5_use_modules(tst-transfer-plugin Core Test)
1793+add_definitions(-std=c++11)
1794+
1795+find_program(DBUS_RUNNER_BIN dbus-test-runner)
1796+add_test(NAME tst-transfer-plugin
1797+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
1798+ COMMAND ${DBUS_RUNNER_BIN}
1799+ --task ${CMAKE_CURRENT_SOURCE_DIR}/buteo-syncfw.py -r -n buteo-syncfw
1800+ --task ${CMAKE_CURRENT_BINARY_DIR}/tst-transfer-plugin --wait-for=com.meego.msyncd -n tst-transfer-plugin
1801+)
1802
1803=== added file 'tests/buteo-syncfw.py'
1804--- tests/buteo-syncfw.py 1970-01-01 00:00:00 +0000
1805+++ tests/buteo-syncfw.py 2015-10-02 14:23:10 +0000
1806@@ -0,0 +1,121 @@
1807+#!/usr/bin/python3
1808+'''
1809+ Copyright 2015 Canonical Ltd.
1810+
1811+ This program is free software: you can redistribute it and/or modify it
1812+ under the terms of the GNU General Public License version 3, as published
1813+ by the Free Software Foundation.
1814+
1815+ This program is distributed in the hope that it will be useful, but
1816+ WITHOUT ANY WARRANTY; without even the implied warranties of
1817+ MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1818+ PURPOSE. See the GNU General Public License for more details.
1819+
1820+ You should have received a copy of the GNU General Public License along
1821+ with this program. If not, see <http://www.gnu.org/licenses/>.
1822+'''
1823+
1824+'''buteo syncfw mock template
1825+
1826+This creates the expected methods and properties of the main
1827+com.meego.msyncd object. You can specify D-BUS property values
1828+'''
1829+
1830+__author__ = 'Renato Araujo Oliveira Filho'
1831+__email__ = 'renatofilho@canonical.com'
1832+__copyright__ = '(c) 2015 Canonical Ltd.'
1833+__license__ = 'LGPL 3+'
1834+
1835+import dbus
1836+import dbus.service
1837+import dbus.mainloop.glib
1838+from gi.repository import GObject
1839+
1840+BUS_NAME = 'com.meego.msyncd'
1841+MAIN_OBJ = '/synchronizer'
1842+MAIN_IFACE = 'com.meego.msyncd'
1843+SYSTEM_BUS = False
1844+
1845+class ButeoSyncFw(dbus.service.Object):
1846+ PROFILES = [
1847+"""<?xml version=\"1.0\" encoding=\"UTF-8\"?>
1848+<profile type=\"sync\" name=\"test-profile\">
1849+ <key value=\"45\" name=\"accountid\"/>
1850+ <key value=\"contacts\" name=\"category\"/>
1851+ <key value=\"google-contacts-ubuntu@gmail.com\" name=\"displayname\"/>
1852+ <key value=\"true\" name=\"enabled\"/>
1853+ <key value=\"google-contacts\" name=\"remote_service_name\"/>
1854+ <key value=\"true\" name=\"hidden\"/>
1855+ <key value=\"30\" name=\"sync_since_days_past\"/>
1856+ <key value=\"true\" name=\"use_accounts\"/>
1857+ <profile type=\"client\" name=\"googlecontacts\">
1858+ <key value=\"two-way\" name=\"Sync Direction\"/>
1859+ </profile>
1860+ <schedule time=\"05:00:00\" days=\"4,5,2,3,1,6,7\" syncconfiguredtime=\"\" interval=\"0\" enabled=\"true\">
1861+ <rush end=\"\" externalsync=\"false\" days=\"\" interval=\"15\" begin=\"\" enabled=\"false\"/>
1862+ </schedule>
1863+</profile>
1864+"""]
1865+
1866+ def __init__(self, object_path):
1867+ dbus.service.Object.__init__(self, dbus.SessionBus(), object_path)
1868+ self._activeSync = []
1869+ self._profiles = ButeoSyncFw.PROFILES
1870+
1871+ @dbus.service.method(dbus_interface=MAIN_IFACE,
1872+ in_signature='s', out_signature='')
1873+ def abortSync(self, profileId):
1874+ self.syncStatus(profileId, 5, 'aborted by the user', 0)
1875+
1876+ @dbus.service.method(dbus_interface=MAIN_IFACE,
1877+ in_signature='s', out_signature='b')
1878+ def startSync(self, profileId):
1879+ GObject.timeout_add(200, self.notifySyncQueued, profileId)
1880+ GObject.timeout_add(400, self.notifySyncStarted, profileId)
1881+ GObject.timeout_add(600, self.notifySyncProgress, profileId)
1882+ GObject.timeout_add(800, self.notifySyncFinished, profileId)
1883+
1884+ @dbus.service.method(dbus_interface=MAIN_IFACE,
1885+ in_signature='', out_signature='as')
1886+ def runningSyncs(self):
1887+ return self._activeSync
1888+
1889+ @dbus.service.method(dbus_interface=MAIN_IFACE,
1890+ in_signature='', out_signature='s')
1891+ def syncProfile(self, profileId):
1892+ return self._profiles[0]
1893+
1894+ @dbus.service.signal(dbus_interface=MAIN_IFACE,
1895+ signature='sisi')
1896+ def syncStatus(self, profileId, status, message, statusDetails):
1897+ print("SyncStatus called", profileId, status, message, statusDetails)
1898+
1899+ def notifySyncQueued(self, profileId):
1900+ #QUEUED(0)
1901+ self.syncStatus(profileId, 0, "", 0)
1902+ return False
1903+
1904+ def notifySyncStarted(self, profileId):
1905+ #RUNNING(1)
1906+ self.syncStatus(profileId, 1, "", 10)
1907+ return False
1908+
1909+ def notifySyncProgress(self, profileId):
1910+ #PROGRESS(2)
1911+ self.syncStatus(profileId, 2, "", 20)
1912+ return False
1913+
1914+ def notifySyncFinished(self, profileId):
1915+ #DONE(4)
1916+ self.syncStatus(profileId, 4, "", 100)
1917+ return False
1918+
1919+
1920+if __name__ == '__main__':
1921+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
1922+
1923+ name = dbus.service.BusName(BUS_NAME)
1924+ mainloop = GObject.MainLoop()
1925+ buteo = ButeoSyncFw(MAIN_OBJ)
1926+ mainloop.run()
1927+
1928
1929=== added file 'tests/tst-transfer-plugin.cpp'
1930--- tests/tst-transfer-plugin.cpp 1970-01-01 00:00:00 +0000
1931+++ tests/tst-transfer-plugin.cpp 2015-10-02 14:23:10 +0000
1932@@ -0,0 +1,104 @@
1933+#include "buteo-source.h"
1934+#include "buteo-transfer.h"
1935+
1936+#include <QtCore/QObject>
1937+#include <QtCore/QQueue>
1938+#include <QtCore/QString>
1939+#include <QtCore/QDebug>
1940+#include <QtDBus/QDBusMessage>
1941+#include <QTest>
1942+
1943+#define BUTEO_SERVICE_NAME "com.meego.msyncd"
1944+#define BUTEO_OBJECT_PATH "/synchronizer"
1945+#define BUTEO_DBUS_INTEFACE "com.meego.msyncd"
1946+
1947+using namespace unity::indicator::transfer;
1948+
1949+class TstButeoTransferPlugin : public QObject
1950+{
1951+ Q_OBJECT
1952+private:
1953+ struct Event
1954+ {
1955+ typedef enum { ADDED, CHANGED, REMOVED } Type;
1956+ Type type;
1957+ QString profileId;
1958+ ButeoTransfer transfer;
1959+
1960+ Event(Type t, const QString &s, const ButeoTransfer &bt)
1961+ : type(t), profileId(s), transfer(bt)
1962+ {}
1963+
1964+ Event(const Event &other)
1965+ : type(other.type),
1966+ profileId(other.profileId),
1967+ transfer(other.transfer)
1968+ {}
1969+
1970+ bool operator==(const Event& that) const
1971+ {
1972+ return type==that.type && profileId==that.profileId;
1973+ }
1974+ };
1975+
1976+private Q_SLOTS:
1977+ void tst_singleSync()
1978+ {
1979+ QScopedPointer<ButeoSource> plugin(new ButeoSource);
1980+ QQueue<Event> events;
1981+
1982+ plugin->get_model()->added().connect([&events, &plugin](const Transfer::Id& id){
1983+ ButeoTransfer bt(*static_cast<ButeoTransfer*>(plugin->get_model()->get(id).get()));
1984+ events.append(Event(Event::ADDED,
1985+ QString::fromStdString(id),
1986+ bt));
1987+ });
1988+
1989+ plugin->get_model()->changed().connect([&events, &plugin](const Transfer::Id& id){
1990+ ButeoTransfer bt(*static_cast<ButeoTransfer*>(plugin->get_model()->get(id).get()));
1991+ events.append(Event(Event::CHANGED,
1992+ QString::fromStdString(id),
1993+ bt));
1994+ });
1995+
1996+ // start sync
1997+ QTRY_VERIFY(plugin->connected());
1998+ plugin->start(QString("profile-123").toStdString());
1999+ QTRY_COMPARE(events.size(), 5);
2000+
2001+ // start event
2002+ Event e = events.takeFirst();
2003+ QCOMPARE(e.type, Event::ADDED);
2004+ QCOMPARE(e.profileId, QStringLiteral("profile-123"));
2005+ QCOMPARE(QString::fromStdString(e.transfer.custom_state), QStringLiteral(""));
2006+
2007+ // changed(QUEUED)
2008+ e = events.takeFirst();
2009+ QCOMPARE(e.type, Event::CHANGED);
2010+ QCOMPARE(e.profileId, QStringLiteral("profile-123"));
2011+ QCOMPARE(QString::fromStdString(e.transfer.custom_state), QStringLiteral(""));
2012+
2013+ // changed(STARTED)
2014+ e = events.takeFirst();
2015+ QCOMPARE(e.type, Event::CHANGED);
2016+ QCOMPARE(e.profileId, QStringLiteral("profile-123"));
2017+ QCOMPARE(QString::fromStdString(e.transfer.custom_state), QStringLiteral("Syncing"));
2018+
2019+ // changed(RUNNING)
2020+ e = events.takeFirst();
2021+ QCOMPARE(e.type, Event::CHANGED);
2022+ QCOMPARE(e.profileId, QStringLiteral("profile-123"));
2023+ QCOMPARE(QString::fromStdString(e.transfer.custom_state), QStringLiteral("Syncing"));
2024+
2025+ // changed(FINISHED)
2026+ e = events.takeFirst();
2027+ QCOMPARE(e.type, Event::CHANGED);
2028+ QCOMPARE(e.profileId, QStringLiteral("profile-123"));
2029+ QCOMPARE(QString::fromStdString(e.transfer.custom_state), QStringLiteral(""));
2030+ }
2031+};
2032+
2033+QTEST_MAIN(TstButeoTransferPlugin)
2034+
2035+#include "tst-transfer-plugin.moc"
2036+

Subscribers

People subscribed via source and target branches