Merge lp:~mandel/ubuntu-download-manager/all-downloads-client into lp:ubuntu-download-manager

Proposed by Manuel de la Peña
Status: Superseded
Proposed branch: lp:~mandel/ubuntu-download-manager/all-downloads-client
Merge into: lp:ubuntu-download-manager
Prerequisite: lp:~mandel/ubuntu-download-manager/abstract-classes
Diff against target: 31405 lines (+14554/-9366)
323 files modified
CMakeLists.txt (+73/-0)
cmake/modules/EnableCoverageReport.cmake (+153/-0)
cmake/modules/FindGtest.cmake (+53/-0)
cmake/modules/FindLcov.cmake (+29/-0)
cmake/modules/Findgcovr.cmake (+31/-0)
cmake/modules/ParseArguments.cmake (+52/-0)
common-installs-config.pri (+0/-44)
common-pkgconfig.pri (+0/-10)
common-project-config.pri (+0/-56)
common-vars.pri (+0/-21)
common.pri (+0/-5)
coverage.pri (+0/-66)
debian/control (+89/-19)
debian/libubuntu-download-manager-client-dev.install (+1/-1)
debian/libubuntu-download-manager-common-dev.install (+1/-6)
debian/libubuntu-download-manager-priv0.install (+0/-1)
debian/libubuntu-upload-manager-common-dev.install (+5/-0)
debian/libubuntu-upload-manager-common0.install (+1/-0)
debian/libudm-common-dev.install (+7/-0)
debian/libudm-common0.install (+1/-0)
debian/libudm-priv0.install (+1/-0)
debian/qtdeclarative5-ubuntu-download-manager0.1.install (+2/-2)
debian/rules (+17/-1)
debian/ubuntu-download-manager.install (+1/-1)
debian/ubuntu-upload-manager.install (+4/-0)
docs/com.canonical.applications.download.xml (+4/-0)
docs/com.canonical.applications.upload.xml (+73/-0)
docs/com.canonical.applications.upload_manager.xml (+52/-0)
download-manager.pro (+0/-34)
src/CMakeLists.txt (+19/-0)
src/common/CMakeLists.txt (+18/-0)
src/common/priv/CMakeLists.txt (+87/-0)
src/common/priv/ubuntu/transfers/adaptor_factory.h (+41/-0)
src/common/priv/ubuntu/transfers/base_daemon.cpp (+193/-286)
src/common/priv/ubuntu/transfers/base_daemon.h (+42/-35)
src/common/priv/ubuntu/transfers/base_manager.cpp (+48/-0)
src/common/priv/ubuntu/transfers/base_manager.h (+60/-0)
src/common/priv/ubuntu/transfers/manager_factory.h (+46/-0)
src/common/priv/ubuntu/transfers/queue.cpp (+92/-87)
src/common/priv/ubuntu/transfers/queue.h (+15/-18)
src/common/priv/ubuntu/transfers/system/apn_proxy.cpp (+6/-6)
src/common/priv/ubuntu/transfers/system/apn_proxy.h (+3/-3)
src/common/priv/ubuntu/transfers/system/apn_request_factory.cpp (+2/-2)
src/common/priv/ubuntu/transfers/system/apn_request_factory.h (+2/-2)
src/common/priv/ubuntu/transfers/system/apparmor.cpp (+79/-74)
src/common/priv/ubuntu/transfers/system/apparmor.h (+21/-14)
src/common/priv/ubuntu/transfers/system/application.cpp (+2/-3)
src/common/priv/ubuntu/transfers/system/application.h (+2/-2)
src/common/priv/ubuntu/transfers/system/cryptographic_hash.cpp (+92/-0)
src/common/priv/ubuntu/transfers/system/cryptographic_hash.h (+71/-0)
src/common/priv/ubuntu/transfers/system/dbus_proxy.h (+2/-1)
src/common/priv/ubuntu/transfers/system/file_manager.cpp (+17/-2)
src/common/priv/ubuntu/transfers/system/file_manager.h (+13/-11)
src/common/priv/ubuntu/transfers/system/filename_mutex.cpp (+4/-4)
src/common/priv/ubuntu/transfers/system/filename_mutex.h (+2/-2)
src/common/priv/ubuntu/transfers/system/network_reply.cpp (+19/-11)
src/common/priv/ubuntu/transfers/system/network_reply.h (+3/-2)
src/common/priv/ubuntu/transfers/system/process.cpp (+18/-14)
src/common/priv/ubuntu/transfers/system/process.h (+2/-2)
src/common/priv/ubuntu/transfers/system/process_factory.cpp (+2/-2)
src/common/priv/ubuntu/transfers/system/process_factory.h (+2/-2)
src/common/priv/ubuntu/transfers/system/request_factory.cpp (+26/-11)
src/common/priv/ubuntu/transfers/system/request_factory.h (+5/-2)
src/common/priv/ubuntu/transfers/system/system_network_info.cpp (+70/-47)
src/common/priv/ubuntu/transfers/system/system_network_info.h (+2/-2)
src/common/priv/ubuntu/transfers/system/timer.cpp (+5/-3)
src/common/priv/ubuntu/transfers/system/timer.h (+2/-2)
src/common/priv/ubuntu/transfers/system/uuid_factory.cpp (+2/-2)
src/common/priv/ubuntu/transfers/system/uuid_factory.h (+2/-2)
src/common/priv/ubuntu/transfers/system/uuid_utils.cpp (+2/-2)
src/common/priv/ubuntu/transfers/system/uuid_utils.h (+2/-2)
src/common/priv/ubuntu/transfers/transfer.cpp (+181/-0)
src/common/priv/ubuntu/transfers/transfer.h (+110/-0)
src/common/priv/udm-priv-common.pro.THIS (+67/-0)
src/common/priv/udm-priv-common_global.h (+12/-0)
src/common/public/CMakeLists.txt (+62/-0)
src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp (+5/-2)
src/common/public/ubuntu/transfers/errors/auth_error_struct.h (+6/-4)
src/common/public/ubuntu/transfers/errors/http_error_struct.cpp (+6/-2)
src/common/public/ubuntu/transfers/errors/http_error_struct.h (+7/-5)
src/common/public/ubuntu/transfers/errors/network_error_struct.cpp (+6/-2)
src/common/public/ubuntu/transfers/errors/network_error_struct.h (+7/-4)
src/common/public/ubuntu/transfers/errors/process_error_struct.cpp (+5/-2)
src/common/public/ubuntu/transfers/errors/process_error_struct.h (+7/-4)
src/common/public/ubuntu/transfers/metadata.cpp (+1/-1)
src/common/public/ubuntu/transfers/metadata.h (+1/-1)
src/common/public/ubuntu/transfers/system/dbus_connection.cpp (+2/-2)
src/common/public/ubuntu/transfers/system/dbus_connection.h (+2/-2)
src/common/public/ubuntu/transfers/system/hash_algorithm.cpp (+2/-2)
src/common/public/ubuntu/transfers/system/hash_algorithm.h (+2/-2)
src/common/public/ubuntu/transfers/system/logger.cpp (+2/-12)
src/common/public/ubuntu/transfers/system/logger.h (+4/-4)
src/common/public/udm-common.pc.in (+12/-0)
src/common/public/udm-common_global.h (+12/-0)
src/downloads/CMakeLists.txt (+22/-0)
src/downloads/client/CMakeLists.txt (+68/-0)
src/downloads/client/ubuntu-download-manager-client.pc.in (+4/-5)
src/downloads/client/ubuntu-download-manager-client.pro.THIS (+3/-0)
src/downloads/client/ubuntu/download_manager/download.h (+10/-1)
src/downloads/client/ubuntu/download_manager/download_impl.cpp (+39/-26)
src/downloads/client/ubuntu/download_manager/download_impl.h (+6/-7)
src/downloads/client/ubuntu/download_manager/download_interface.h (+7/-0)
src/downloads/client/ubuntu/download_manager/download_pendingcall_watcher.cpp (+6/-4)
src/downloads/client/ubuntu/download_manager/download_pendingcall_watcher.h (+2/-2)
src/downloads/client/ubuntu/download_manager/downloads_list.h (+50/-0)
src/downloads/client/ubuntu/download_manager/downloads_list_impl.cpp (+64/-0)
src/downloads/client/ubuntu/download_manager/downloads_list_impl.h (+53/-0)
src/downloads/client/ubuntu/download_manager/error.cpp (+18/-14)
src/downloads/client/ubuntu/download_manager/error.h (+26/-18)
src/downloads/client/ubuntu/download_manager/group_download.h (+2/-2)
src/downloads/client/ubuntu/download_manager/manager.h (+77/-3)
src/downloads/client/ubuntu/download_manager/manager_impl.cpp (+54/-22)
src/downloads/client/ubuntu/download_manager/manager_impl.h (+13/-3)
src/downloads/client/ubuntu/download_manager/manager_interface.h (+2/-0)
src/downloads/client/ubuntu/download_manager/manager_pendingcall_watcher.cpp (+122/-28)
src/downloads/client/ubuntu/download_manager/manager_pendingcall_watcher.h (+60/-17)
src/downloads/common/CMakeLists.txt (+49/-0)
src/downloads/common/ubuntu-download-manager-common.pc.in (+3/-3)
src/downloads/common/ubuntu/download_manager/download_struct.h (+1/-1)
src/downloads/common/ubuntu/download_manager/group_download_struct.cpp (+1/-1)
src/downloads/common/ubuntu/download_manager/group_download_struct.h (+1/-1)
src/downloads/common/ubuntu/download_manager/metatypes.h (+5/-4)
src/downloads/common/ubuntu/download_manager/system/logger.cpp (+29/-0)
src/downloads/common/ubuntu/download_manager/system/logger.h (+38/-0)
src/downloads/daemon/CMakeLists.txt (+37/-0)
src/downloads/daemon/main.cpp (+2/-2)
src/downloads/priv/CMakeLists.txt (+78/-0)
src/downloads/priv/ubuntu/downloads/daemon.cpp (+62/-0)
src/downloads/priv/ubuntu/downloads/daemon.h (+57/-0)
src/downloads/priv/ubuntu/downloads/download.cpp (+3/-81)
src/downloads/priv/ubuntu/downloads/download.h (+18/-106)
src/downloads/priv/ubuntu/downloads/download_adaptor.cpp (+7/-1)
src/downloads/priv/ubuntu/downloads/download_adaptor.h (+4/-0)
src/downloads/priv/ubuntu/downloads/download_adaptor_factory.cpp (+43/-0)
src/downloads/priv/ubuntu/downloads/download_adaptor_factory.h (+47/-0)
src/downloads/priv/ubuntu/downloads/download_manager_factory.cpp (+46/-0)
src/downloads/priv/ubuntu/downloads/download_manager_factory.h (+54/-0)
src/downloads/priv/ubuntu/downloads/downloads_db.cpp (+13/-10)
src/downloads/priv/ubuntu/downloads/downloads_db.h (+2/-2)
src/downloads/priv/ubuntu/downloads/factory.cpp (+47/-67)
src/downloads/priv/ubuntu/downloads/factory.h (+7/-10)
src/downloads/priv/ubuntu/downloads/file_download.cpp (+122/-44)
src/downloads/priv/ubuntu/downloads/file_download.h (+22/-16)
src/downloads/priv/ubuntu/downloads/group_download.cpp (+51/-32)
src/downloads/priv/ubuntu/downloads/group_download.h (+9/-8)
src/downloads/priv/ubuntu/downloads/group_download_adaptor.cpp (+2/-2)
src/downloads/priv/ubuntu/downloads/manager.cpp (+77/-82)
src/downloads/priv/ubuntu/downloads/manager.h (+22/-22)
src/downloads/priv/ubuntu/downloads/mms_file_download.cpp (+1/-1)
src/downloads/priv/ubuntu/downloads/sm_file_download.h (+1/-1)
src/downloads/priv/ubuntu/downloads/state_machines/download_sm.cpp (+11/-7)
src/downloads/priv/ubuntu/downloads/state_machines/download_sm.h (+1/-1)
src/downloads/priv/ubuntu/downloads/state_machines/final_state.cpp (+1/-1)
src/downloads/qml/CMakeLists.txt (+40/-0)
src/downloads/qml/single_download.cpp (+41/-14)
src/downloads/qml/ubuntu_download_manager.cpp (+10/-6)
src/downloads/test-daemon/CMakeLists.txt (+51/-0)
src/downloads/test-daemon/main.cpp (+1/-1)
src/downloads/test-daemon/testing_daemon.cpp (+25/-13)
src/downloads/test-daemon/testing_daemon.h (+6/-7)
src/downloads/test-daemon/testing_file_download.cpp (+18/-18)
src/downloads/test-daemon/testing_file_download.h (+6/-6)
src/downloads/test-daemon/testing_manager.cpp (+25/-25)
src/downloads/test-daemon/testing_manager.h (+4/-3)
src/downloads/test-daemon/ubuntu-download-manager-test-daemon.pro.THIS (+15/-0)
src/uploads/CMakeLists.txt (+19/-0)
src/uploads/common/CMakeLists.txt (+45/-0)
src/uploads/common/ubuntu-upload-manager-common.pc.in (+12/-0)
src/uploads/common/ubuntu/upload_manager/common.h (+28/-0)
src/uploads/common/ubuntu/upload_manager/metatypes.h (+42/-0)
src/uploads/common/ubuntu/upload_manager/upload_struct.cpp (+113/-0)
src/uploads/common/ubuntu/upload_manager/upload_struct.h (+72/-0)
src/uploads/daemon/CMakeLists.txt (+37/-0)
src/uploads/daemon/com.canonical.applications.Uploader.conf (+18/-0)
src/uploads/daemon/com.canonical.applications.Uploader.service (+4/-0)
src/uploads/daemon/main.cpp (+33/-0)
src/uploads/daemon/ubuntu-upload-manager.pro (+49/-0)
src/uploads/daemon/ubuntu-upload-manager.service (+3/-0)
src/uploads/priv/CMakeLists.txt (+64/-0)
src/uploads/priv/ubuntu-upload-manager-priv.pro.THIS (+60/-0)
src/uploads/priv/ubuntu/uploads/daemon.cpp (+63/-0)
src/uploads/priv/ubuntu/uploads/daemon.h (+55/-0)
src/uploads/priv/ubuntu/uploads/factory.cpp (+122/-0)
src/uploads/priv/ubuntu/uploads/factory.h (+76/-0)
src/uploads/priv/ubuntu/uploads/file_upload.cpp (+322/-0)
src/uploads/priv/ubuntu/uploads/file_upload.h (+115/-0)
src/uploads/priv/ubuntu/uploads/manager.cpp (+231/-0)
src/uploads/priv/ubuntu/uploads/manager.h (+113/-0)
src/uploads/priv/ubuntu/uploads/mms_file_upload.cpp (+52/-0)
src/uploads/priv/ubuntu/uploads/mms_file_upload.h (+54/-0)
src/uploads/priv/ubuntu/uploads/upload_adaptor.cpp (+100/-0)
src/uploads/priv/ubuntu/uploads/upload_adaptor.h (+124/-0)
src/uploads/priv/ubuntu/uploads/upload_adaptor_factory.cpp (+44/-0)
src/uploads/priv/ubuntu/uploads/upload_adaptor_factory.h (+48/-0)
src/uploads/priv/ubuntu/uploads/upload_manager_adaptor.cpp (+109/-0)
src/uploads/priv/ubuntu/uploads/upload_manager_adaptor.h (+105/-0)
src/uploads/priv/ubuntu/uploads/upload_manager_factory.cpp (+46/-0)
src/uploads/priv/ubuntu/uploads/upload_manager_factory.h (+52/-0)
tests/CMakeLists.txt (+173/-0)
tests/apparmor.h (+23/-31)
tests/application.h (+49/-0)
tests/base_testcase.cpp (+1/-1)
tests/base_testcase.h (+37/-0)
tests/cryptographic_hash.h (+55/-0)
tests/daemon_testcase.cpp (+5/-11)
tests/daemon_testcase.h (+1/-3)
tests/database.h (+31/-0)
tests/dbus_connection.h (+54/-0)
tests/download.h (+33/-28)
tests/factory.h (+24/-48)
tests/file_manager.h (+43/-33)
tests/filename_mutex.h (+48/-0)
tests/group_download.h (+6/-23)
tests/local_tree_testcase.cpp (+1/-1)
tests/local_tree_testcase.h (+1/-1)
tests/manager.h (+34/-14)
tests/matchers.h (+128/-0)
tests/network_reply.h (+60/-0)
tests/process.h (+32/-50)
tests/process_factory.h (+21/-10)
tests/queue.h (+16/-20)
tests/request_factory.h (+28/-32)
tests/sm_file_download.h (+26/-58)
tests/system_network_info.h (+37/-38)
tests/test_apn_request_factory.cpp (+4/-6)
tests/test_apn_request_factory.h (+36/-5)
tests/test_base_download.cpp (+55/-41)
tests/test_base_download.h (+8/-6)
tests/test_cancel_download_transition.cpp (+18/-18)
tests/test_cancel_download_transition.h (+7/-8)
tests/test_client_download.cpp (+64/-10)
tests/test_client_download.h (+7/-3)
tests/test_client_manager.cpp (+209/-4)
tests/test_client_manager.h (+8/-3)
tests/test_daemon.cpp (+417/-199)
tests/test_daemon.h (+9/-11)
tests/test_download.cpp (+2708/-1540)
tests/test_download.h (+31/-28)
tests/test_download_factory.cpp (+154/-181)
tests/test_download_factory.h (+12/-18)
tests/test_download_manager.cpp (+250/-243)
tests/test_download_manager.h (+24/-24)
tests/test_download_manager_watch.cpp (+20/-17)
tests/test_download_manager_watch.h (+5/-9)
tests/test_download_watch.cpp (+8/-4)
tests/test_download_watch.h (+0/-3)
tests/test_downloads_db.cpp (+17/-16)
tests/test_downloads_db.h (+3/-7)
tests/test_file_download_sm.cpp (+177/-120)
tests/test_file_download_sm.h (+6/-8)
tests/test_filename_mutex.cpp (+4/-6)
tests/test_filename_mutex.h (+3/-5)
tests/test_final_state.cpp (+14/-7)
tests/test_final_state.h (+3/-7)
tests/test_group_download.cpp (+1176/-623)
tests/test_group_download.h (+19/-33)
tests/test_group_manager_watch.cpp (+10/-7)
tests/test_group_manager_watch.h (+1/-3)
tests/test_metadata.cpp (+4/-5)
tests/test_metadata.h (+4/-5)
tests/test_mms_download.cpp (+2/-0)
tests/test_mms_download.h (+6/-10)
tests/test_network_error_transition.cpp (+14/-15)
tests/test_network_error_transition.h (+7/-9)
tests/test_resume_download_transition.cpp (+18/-16)
tests/test_resume_download_transition.h (+7/-9)
tests/test_ssl_error_transition.cpp (+14/-12)
tests/test_ssl_error_transition.h (+7/-9)
tests/test_start_download_transition.cpp (+17/-16)
tests/test_start_download_transition.h (+7/-9)
tests/test_stop_request_transition.cpp (+17/-16)
tests/test_stop_request_transition.h (+7/-9)
tests/test_transfers_queue.cpp (+1003/-512)
tests/test_transfers_queue.h (+36/-32)
tests/testing_interface.cpp (+26/-0)
tests/testing_interface.h (+87/-0)
tests/timer.h (+49/-0)
tests/transfer.h (+78/-0)
tests/uuid_factory.h (+22/-13)
ubuntu-download-manager-client-tests/main.cpp (+0/-25)
ubuntu-download-manager-client-tests/ubuntu-download-manager-client-tests.pro (+0/-61)
ubuntu-download-manager-common-tests/main.cpp (+0/-25)
ubuntu-download-manager-common-tests/ubuntu-download-manager-common-tests.pro (+0/-36)
ubuntu-download-manager-common/ubuntu-download-manager-common.pro (+0/-51)
ubuntu-download-manager-plugin/UbuntuDownloadManager/UbuntuDownloadManager.pro (+0/-11)
ubuntu-download-manager-plugin/UbuntuDownloadManager/modules/UbuntuDownloadManager/UbuntuDownloadManager.pro (+0/-55)
ubuntu-download-manager-plugin/ubuntu-download-manager-plugin.pro (+0/-4)
ubuntu-download-manager-priv/ubuntu-download-manager-priv.pro (+0/-103)
ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib.pro (+0/-79)
ubuntu-download-manager-test-lib/ubuntu-download-manager-test-lib_global.h (+0/-12)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/fake.cpp (+0/-234)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/fake.h (+0/-145)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apn_request_factory.cpp (+0/-50)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apn_request_factory.h (+0/-43)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/apparmor.cpp (+0/-87)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.cpp (+0/-54)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/application.h (+0/-42)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.cpp (+0/-144)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/dbus_connection.h (+0/-80)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/download.cpp (+0/-158)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/factory.cpp (+0/-149)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/file_manager.cpp (+0/-80)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/filename_mutex.cpp (+0/-58)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/filename_mutex.h (+0/-43)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/group_download.cpp (+0/-81)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/manager.cpp (+0/-56)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.cpp (+0/-166)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/network_reply.h (+0/-79)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process.cpp (+0/-106)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/process_factory.cpp (+0/-45)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.cpp (+0/-78)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/qnetwork_reply.h (+0/-45)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/queue.cpp (+0/-60)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/request_factory.cpp (+0/-84)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/sm_file_download.cpp (+0/-210)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/system_network_info.cpp (+0/-80)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.cpp (+0/-75)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/timer.h (+0/-45)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/server/uuid_factory.cpp (+0/-39)
ubuntu-download-manager-test-lib/ubuntu/download_manager/tests/test_runner.h (+0/-87)
ubuntu-download-manager-tests/main.cpp (+0/-25)
ubuntu-download-manager-tests/ubuntu-download-manager-tests.pro (+0/-82)
ubuntu-download-manager/ubuntu-download-manager.pro (+0/-43)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/all-downloads-client
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
dobey (community) Needs Fixing
Alejandro J. Cura (community) Approve
Mike McCracken (community) Approve
Review via email: mp+207490@code.launchpad.net

This proposal has been superseded by a proposal from 2014-04-15.

Commit message

Provide the methods that allow to get all the downloads and all the downloads with a given metadata value.

Description of the change

Provide the methods that allow to get all the downloads and all the downloads with a given metadata value.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mike McCracken (mikemc) wrote :

looks good, tests pass. will start adding it to unity-scope-click and I'll file separate bugs if there are any problems.

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

puked a little bit in my mouth when I saw the size of this, but it looks good: +1

review: Approve
Revision history for this message
dobey (dobey) wrote :

Why are so many changes in this one branch? Particularly the huge change to cmake, addition of coverage reporting (the necessary cmake files of which have some small licensing issues), and several other small bug fixes? The branch is now beyond unreasonably huge, due to r242..246 which were all added after the branch had been approved. Not to mention the 19 other current MPs, some of which are also extremely large.

I find it very hard to believe that a branch of this size, with this many changes, is acceptable to land. Are those commits made *after* the approval really necessary to have here? If so, why?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
247. By Manuel de la Peña

Remove useless files.

248. By Manuel de la Peña

Merged set-download-dir into all-downloads-client.

249. By Manuel de la Peña

Merged set-download-dir into all-downloads-client.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
250. By Manuel de la Peña

Remove the .THIS file.

251. By Manuel de la Peña

Fix the system dbus activation file location.

252. By Manuel de la Peña

Update the name of the package to match the names of the .so

253. By Manuel de la Peña

Move the location of the pkconfig files.

254. By Manuel de la Peña

Add pkgconfig to the .pc paths.

255. By Manuel de la Peña

Do not configure in the wrong dir and jsut move to libexdir on install time.

256. By Manuel de la Peña

Fix broken install path.

Unmerged revisions

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 2014-04-11 16:06:36 +0000
4@@ -0,0 +1,73 @@
5+project(ubuntu-download-manager)
6+cmake_minimum_required(VERSION 2.8)
7+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
8+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -pthread")
9+
10+
11+# Standard install paths
12+include(GNUInstallDirs)
13+
14+include(EnableCoverageReport)
15+#####################################################################
16+# Enable code coverage calculation with gcov/gcovr/lcov
17+# Usage:
18+# * Switch build type to coverage (use ccmake or cmake-gui)
19+# * Invoke make, make test, make coverage
20+# * Find html report in subdir coveragereport
21+# * Find xml report feasible for jenkins in coverage.xml
22+#####################################################################
23+IF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
24+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
25+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
26+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -coverage" )
27+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -coverage" )
28+ ENABLE_COVERAGE_REPORT(TARGETS ${DIALER_APP})
29+ENDIF(CMAKE_BUILD_TYPE MATCHES [cC][oO][vV][eE][rR][aA][gG][eE])
30+
31+execute_process(
32+ COMMAND qmake -query QT_INSTALL_QML
33+ OUTPUT_VARIABLE QT_INSTALL_QML
34+ OUTPUT_STRIP_TRAILING_WHITESPACE
35+)
36+
37+set(UDM_VERSION_MAJOR 0)
38+set(UDM_VERSION_MINOR 3)
39+set(UDM_VERSION_PATCH 0)
40+
41+find_package(Gtest REQUIRED)
42+include_directories(${GMOCK_INCLUDE_DIR} ${GTEST_INCLUDE_DIR})
43+
44+# Instruct CMake to run moc automatically when needed.
45+set(CMAKE_AUTOMOC ON)
46+
47+find_package(Qt5Core REQUIRED)
48+find_package(Qt5DBus REQUIRED)
49+find_package(Qt5Network REQUIRED)
50+find_package(Qt5SystemInfo REQUIRED)
51+find_package(Qt5Sql REQUIRED)
52+find_package(Qt5Test REQUIRED)
53+
54+find_package(PkgConfig REQUIRED)
55+pkg_check_modules(DBUS REQUIRED dbus-1)
56+pkg_check_modules(GLOG REQUIRED libglog)
57+pkg_check_modules(NIH_DBUS REQUIRED libnih-dbus)
58+pkg_check_modules(GLOG REQUIRED libglog)
59+pkg_check_modules(GLOG libglog)
60+
61+enable_testing()
62+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -std=c++11 -Werror -O2 -Wall -W -D_REENTRANT -fPIC -pedantic -Wextra")
63+add_definitions("-DNDEBUG")
64+
65+if(NOT CMAKE_BUILD_TYPE)
66+ message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
67+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
68+endif()
69+
70+string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower)
71+
72+if(cmake_build_type_lower MATCHES relwithdebinfo) # workaround for http://pub lic.kitware.com/Bug/view.php?id=14696
73+ add_definitions(-DQT_NO_DEBUG)
74+endif()
75+
76+add_subdirectory(src)
77+add_subdirectory(tests)
78
79=== added directory 'cmake'
80=== added directory 'cmake/modules'
81=== added file 'cmake/modules/EnableCoverageReport.cmake'
82--- cmake/modules/EnableCoverageReport.cmake 1970-01-01 00:00:00 +0000
83+++ cmake/modules/EnableCoverageReport.cmake 2014-04-11 16:06:36 +0000
84@@ -0,0 +1,153 @@
85+# - Creates a special coverage build type and target on GCC.
86+#
87+# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
88+# for selected targets. Optional arguments to this function are used to filter
89+# unwanted results using globbing expressions. Moreover targets with tests for
90+# the source code can be specified to trigger regenerating the report if the
91+# test has changed
92+#
93+# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
94+#
95+# To generate a coverage report first build the project with
96+# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
97+#
98+# The coverage report is based on gcov. Depending on the availability of lcov
99+# a HTML report will be generated and/or an XML report of gcovr is found.
100+# The generated coverage target executes all found solutions. Special targets
101+# exist to create e.g. only the xml report: coverage-xml.
102+#
103+# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
104+#
105+# This program is free software; you can redistribute it
106+# and/or modify it under the terms of the GNU General
107+# Public License as published by the Free Software Foundation;
108+# either version 2, or (at your option)
109+# any later version.
110+#
111+# This program is distributed in the hope that it will be useful,
112+# but WITHOUT ANY WARRANTY; without even the implied warranty of
113+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+# GNU General Public License for more details.
115+#
116+
117+INCLUDE(ParseArguments)
118+
119+FIND_PACKAGE(Lcov)
120+FIND_PACKAGE(gcovr)
121+
122+FUNCTION(ENABLE_COVERAGE_REPORT)
123+
124+ # argument parsing
125+ PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
126+
127+ SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
128+ SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
129+ SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
130+ SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
131+ SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
132+
133+ # decide if there is any tool to create coverage data
134+ SET(TOOL_FOUND FALSE)
135+ IF(LCOV_FOUND OR GCOVR_FOUND)
136+ SET(TOOL_FOUND TRUE)
137+ ENDIF()
138+ IF(NOT TOOL_FOUND)
139+ MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
140+ ENDIF()
141+
142+ STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
143+ IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
144+
145+ MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
146+
147+ # create coverage build type
148+ SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
149+ SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
150+ SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
151+
152+ # instrument targets
153+ SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
154+ LINK_FLAGS --coverage)
155+
156+ # html report
157+ IF (LCOV_FOUND)
158+
159+ MESSAGE(STATUS "Enabling HTML coverage report")
160+
161+ # set up coverage target
162+
163+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
164+ COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
165+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
166+ COMMENT "Collecting coverage data"
167+ DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
168+ VERBATIM)
169+
170+ # filter unwanted stuff
171+ LIST(LENGTH ARG_FILTER FILTER_LENGTH)
172+ IF(${FILTER_LENGTH} GREATER 0)
173+ SET(FILTER COMMAND ${LCOV_EXECUTABLE})
174+ FOREACH(F ${ARG_FILTER})
175+ SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
176+ ENDFOREACH()
177+ SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
178+ ELSE()
179+ SET(FILTER "")
180+ ENDIF()
181+
182+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
183+ COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
184+ ${FILTER}
185+ DEPENDS ${COVERAGE_RAW_FILE}
186+ COMMENT "Filtering recorded coverage data for project-relevant entries"
187+ VERBATIM)
188+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
189+ COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
190+ COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
191+ DEPENDS ${COVERAGE_FILTERED_FILE}
192+ COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
193+ VERBATIM)
194+
195+ ADD_CUSTOM_TARGET(coverage-html
196+ DEPENDS ${COVERAGE_REPORT_DIR})
197+
198+ ENDIF()
199+
200+ # xml coverage report
201+ IF(GCOVR_FOUND)
202+
203+ MESSAGE(STATUS "Enabling XML coverage report")
204+
205+ # gcovr cannot write directly to a file so the execution needs to
206+ # be wrapped in a cmake file that generates the file output
207+ FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
208+ "SET(ENV{LANG} en)\n")
209+ FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
210+ "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
211+
212+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
213+ COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
214+ COMMENT "Generating coverage XML report"
215+ VERBATIM)
216+
217+ ADD_CUSTOM_TARGET(coverage-xml
218+ DEPENDS ${COVERAGE_XML_FILE})
219+
220+ ENDIF()
221+
222+ # provide a global coverage target executing both steps if available
223+ SET(GLOBAL_DEPENDS "")
224+ IF(LCOV_FOUND)
225+ LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
226+ ENDIF()
227+ IF(GCOVR_FOUND)
228+ LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
229+ ENDIF()
230+ IF(LCOV_FOUND OR GCOVR_FOUND)
231+ ADD_CUSTOM_TARGET(coverage
232+ DEPENDS ${GLOBAL_DEPENDS})
233+ ENDIF()
234+
235+ ENDIF()
236+
237+ENDFUNCTION()
238
239=== added file 'cmake/modules/FindGtest.cmake'
240--- cmake/modules/FindGtest.cmake 1970-01-01 00:00:00 +0000
241+++ cmake/modules/FindGtest.cmake 2014-04-11 16:06:36 +0000
242@@ -0,0 +1,53 @@
243+include(ExternalProject)
244+include(FindPackageHandleStandardArgs)
245+
246+#gtest
247+set(GTEST_INSTALL_DIR /usr/src/gmock/gtest/include)
248+find_path(GTEST_INCLUDE_DIR gtest/gtest.h
249+ HINTS ${GTEST_INSTALL_DIR})
250+
251+#gmock
252+find_path(GMOCK_INSTALL_DIR gmock/CMakeLists.txt
253+ HINTS /usr/src)
254+if(${GMOCK_INSTALL_DIR} STREQUAL "GMOCK_INSTALL_DIR-NOTFOUND")
255+ message(FATAL_ERROR "google-mock package not found")
256+endif()
257+
258+set(GMOCK_INSTALL_DIR ${GMOCK_INSTALL_DIR}/gmock)
259+find_path(GMOCK_INCLUDE_DIR gmock/gmock.h)
260+
261+set(GMOCK_PREFIX gmock)
262+set(GMOCK_BINARY_DIR ${CMAKE_BINARY_DIR}/${GMOCK_PREFIX}/libs)
263+set(GTEST_BINARY_DIR ${GMOCK_BINARY_DIR}/gtest)
264+
265+set(GTEST_CMAKE_ARGS "")
266+if (${MIR_IS_CROSS_COMPILING})
267+ set(GTEST_CMAKE_ARGS
268+ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_MODULE_PATH}/LinuxCrossCompile.cmake)
269+endif()
270+
271+ExternalProject_Add(
272+ GMock
273+ #where to build in source tree
274+ PREFIX ${GMOCK_PREFIX}
275+ #where the source is external to the project
276+ SOURCE_DIR ${GMOCK_INSTALL_DIR}
277+ #forward the compilers to the subproject so cross-arch builds work
278+ CMAKE_ARGS ${GTEST_CMAKE_ARGS}
279+ BINARY_DIR ${GMOCK_BINARY_DIR}
280+
281+ #we don't need to install, so skip
282+ INSTALL_COMMAND ""
283+)
284+
285+set(GMOCK_LIBRARY ${GMOCK_BINARY_DIR}/libgmock.a)
286+set(GMOCK_MAIN_LIBRARY ${GMOCK_BINARY_DIR}/libgmock_main.a)
287+set(GMOCK_BOTH_LIBRARIES ${GMOCK_LIBRARY} ${GMOCK_MAIN_LIBRARY})
288+set(GTEST_LIBRARY ${GTEST_BINARY_DIR}/libgtest.a)
289+set(GTEST_MAIN_LIBRARY ${GTEST_BINARY_DIR}/libgtest_main.a)
290+set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
291+set(GTEST_ALL_LIBRARIES ${GTEST_BOTH_LIBRARIES} ${GMOCK_BOTH_LIBRARIES})
292+
293+find_package_handle_standard_args(GTest DEFAULT_MSG
294+ GMOCK_INCLUDE_DIR
295+ GTEST_INCLUDE_DIR)
296
297=== added file 'cmake/modules/FindLcov.cmake'
298--- cmake/modules/FindLcov.cmake 1970-01-01 00:00:00 +0000
299+++ cmake/modules/FindLcov.cmake 2014-04-11 16:06:36 +0000
300@@ -0,0 +1,29 @@
301+# - Find lcov
302+# Will define:
303+#
304+# LCOV_EXECUTABLE - the lcov binary
305+# GENHTML_EXECUTABLE - the genhtml executable
306+#
307+# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
308+#
309+# This program is free software; you can redistribute it
310+# and/or modify it under the terms of the GNU General
311+# Public License as published by the Free Software Foundation;
312+# either version 2, or (at your option)
313+# any later version.
314+#
315+# This program is distributed in the hope that it will be useful,
316+# but WITHOUT ANY WARRANTY; without even the implied warranty of
317+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
318+# GNU General Public License for more details.
319+#
320+
321+INCLUDE(FindPackageHandleStandardArgs)
322+
323+FIND_PROGRAM(LCOV_EXECUTABLE lcov)
324+FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
325+
326+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
327+
328+# only visible in advanced view
329+MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
330
331=== added file 'cmake/modules/Findgcovr.cmake'
332--- cmake/modules/Findgcovr.cmake 1970-01-01 00:00:00 +0000
333+++ cmake/modules/Findgcovr.cmake 2014-04-11 16:06:36 +0000
334@@ -0,0 +1,31 @@
335+# - Find gcovr scrip
336+# Will define:
337+#
338+# GCOVR_EXECUTABLE - the gcovr script
339+#
340+# Uses:
341+#
342+# GCOVR_ROOT - root to search for the script
343+#
344+# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
345+#
346+# This program is free software; you can redistribute it
347+# and/or modify it under the terms of the GNU General
348+# Public License as published by the Free Software Foundation;
349+# either version 2, or (at your option)
350+# any later version.
351+#
352+# This program is distributed in the hope that it will be useful,
353+# but WITHOUT ANY WARRANTY; without even the implied warranty of
354+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
355+# GNU General Public License for more details.
356+#
357+
358+INCLUDE(FindPackageHandleStandardArgs)
359+
360+FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
361+
362+FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
363+
364+# only visible in advanced view
365+MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
366
367=== added file 'cmake/modules/ParseArguments.cmake'
368--- cmake/modules/ParseArguments.cmake 1970-01-01 00:00:00 +0000
369+++ cmake/modules/ParseArguments.cmake 2014-04-11 16:06:36 +0000
370@@ -0,0 +1,52 @@
371+# Parse arguments passed to a function into several lists separated by
372+# upper-case identifiers and options that do not have an associated list e.g.:
373+#
374+# SET(arguments
375+# hello OPTION3 world
376+# LIST3 foo bar
377+# OPTION2
378+# LIST1 fuz baz
379+# )
380+# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
381+#
382+# results in 7 distinct variables:
383+# * ARG_DEFAULT_ARGS: hello;world
384+# * ARG_LIST1: fuz;baz
385+# * ARG_LIST2:
386+# * ARG_LIST3: foo;bar
387+# * ARG_OPTION1: FALSE
388+# * ARG_OPTION2: TRUE
389+# * ARG_OPTION3: TRUE
390+#
391+# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
392+
393+MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
394+ SET(DEFAULT_ARGS)
395+ FOREACH(arg_name ${arg_names})
396+ SET(${prefix}_${arg_name})
397+ ENDFOREACH(arg_name)
398+ FOREACH(option ${option_names})
399+ SET(${prefix}_${option} FALSE)
400+ ENDFOREACH(option)
401+
402+ SET(current_arg_name DEFAULT_ARGS)
403+ SET(current_arg_list)
404+ FOREACH(arg ${ARGN})
405+ SET(larg_names ${arg_names})
406+ LIST(FIND larg_names "${arg}" is_arg_name)
407+ IF (is_arg_name GREATER -1)
408+ SET(${prefix}_${current_arg_name} ${current_arg_list})
409+ SET(current_arg_name ${arg})
410+ SET(current_arg_list)
411+ ELSE (is_arg_name GREATER -1)
412+ SET(loption_names ${option_names})
413+ LIST(FIND loption_names "${arg}" is_option)
414+ IF (is_option GREATER -1)
415+ SET(${prefix}_${arg} TRUE)
416+ ELSE (is_option GREATER -1)
417+ SET(current_arg_list ${current_arg_list} ${arg})
418+ ENDIF (is_option GREATER -1)
419+ ENDIF (is_arg_name GREATER -1)
420+ ENDFOREACH(arg)
421+ SET(${prefix}_${current_arg_name} ${current_arg_list})
422+ENDMACRO(PARSE_ARGUMENTS)
423
424=== removed file 'common-installs-config.pri'
425--- common-installs-config.pri 2013-12-03 11:06:36 +0000
426+++ common-installs-config.pri 1970-01-01 00:00:00 +0000
427@@ -1,44 +0,0 @@
428-#-----------------------------------------------------------------------------
429-# Common installation configuration for all projects.
430-#-----------------------------------------------------------------------------
431-
432-#-----------------------------------------------------------------------------
433-# default installation target for applications
434-#-----------------------------------------------------------------------------
435-contains( TEMPLATE, app ) {
436- target.path = $${INSTALL_PREFIX}/bin
437- INSTALLS += target
438- message("====")
439- message("==== INSTALLS += target")
440-}
441-
442-#-----------------------------------------------------------------------------
443-# default installation target for libraries
444-#-----------------------------------------------------------------------------
445-contains( TEMPLATE, lib ) {
446-
447- target.path = $${INSTALL_LIBDIR}
448- INSTALLS += target
449- message("====")
450- message("==== INSTALLS += target")
451-
452- # reset the .pc file's `prefix' variable
453- #include( tools/fix-pc-prefix.pri )
454-
455-}
456-
457-#-----------------------------------------------------------------------------
458-# target for header files
459-#-----------------------------------------------------------------------------
460-!isEmpty( headers.files ) {
461- headers.path = $${INSTALL_PREFIX}/include/ubuntu/download_manager
462- INSTALLS += headers
463- message("====")
464- message("==== INSTALLS += headers")
465-} else {
466- message("====")
467- message("==== NOTE: Remember to add your API headers into `headers.files' for installation!")
468-}
469-
470-
471-# End of File
472
473=== removed file 'common-pkgconfig.pri'
474--- common-pkgconfig.pri 2013-12-03 11:06:36 +0000
475+++ common-pkgconfig.pri 1970-01-01 00:00:00 +0000
476@@ -1,10 +0,0 @@
477-# Include this file after defining the pkgconfig.files variable
478-
479-!isEmpty(pkgconfig.files) {
480- QMAKE_SUBSTITUTES += $${pkgconfig.files}.in
481- pkgconfig.CONFIG = no_check_exist
482- pkgconfig.path = $${INSTALL_LIBDIR}/pkgconfig
483- QMAKE_EXTRA_TARGETS += pkgconfig
484-
485- QMAKE_CLEAN += $${pkgconfig.files}
486-}
487
488=== removed file 'common-project-config.pri'
489--- common-project-config.pri 2014-01-22 15:16:14 +0000
490+++ common-project-config.pri 1970-01-01 00:00:00 +0000
491@@ -1,56 +0,0 @@
492-#-----------------------------------------------------------------------------
493-# Common configuration for all projects.
494-#-----------------------------------------------------------------------------
495-
496-QT -= gui
497-CONFIG += link_pkgconfig
498-
499-TOP_SRC_DIR = $$PWD
500-TOP_BUILD_DIR = $${TOP_SRC_DIR}/$${BUILD_DIR}
501-QMAKE_LIBDIR += $${TOP_BUILD_DIR}
502-INCLUDEPATH += $${TOP_SRC_DIR}
503-QMAKE_CXXFLAGS += -std=c++11 -Werror
504-
505-#-----------------------------------------------------------------------------
506-# setup the installation prefix
507-#-----------------------------------------------------------------------------
508-INSTALL_PREFIX = /usr # default installation prefix
509-
510-# default prefix can be overriden by defining PREFIX when running qmake
511-isEmpty( PREFIX ) {
512- message("====")
513- message("==== NOTE: To override the installation path run: `qmake PREFIX=/custom/path'")
514- message("==== (current installation path is `$${INSTALL_PREFIX}')")
515-} else {
516- INSTALL_PREFIX = $${PREFIX}
517- message("====")
518- message("==== install prefix set to `$${INSTALL_PREFIX}'")
519-}
520-
521-ARCH = $$system(uname -m)
522-contains( ARCH, x86_64 ) {
523- INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/x86_64-linux-gnu
524-} else {
525- contains( ARCH, i686) {
526- INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/i386-linux-gnu
527- } else {
528- INSTALL_LIBDIR = $${INSTALL_PREFIX}/lib/arm-linux-gnueabihf
529- }
530-}
531-
532-# default library directory can be overriden by defining LIBDIR when
533-# running qmake
534-isEmpty( LIBDIR ) {
535- message("====")
536- message("==== NOTE: To override the library installation path run: `qmake LIBDIR=/custom/path'")
537- message("==== (current installation path is `$${INSTALL_LIBDIR}')")
538-} else {
539- INSTALL_LIBDIR = $${LIBDIR}
540- message("====")
541- message("==== library install path set to `$${INSTALL_LIBDIR}'")
542-}
543-
544-include( coverage.pri )
545-
546-# End of File
547-
548
549=== removed file 'common-vars.pri'
550--- common-vars.pri 2013-12-03 11:06:36 +0000
551+++ common-vars.pri 1970-01-01 00:00:00 +0000
552@@ -1,21 +0,0 @@
553-#-----------------------------------------------------------------------------
554-# Common variables for all projects.
555-#-----------------------------------------------------------------------------
556-DEFINES += BUILDING_UBUNTU_DOWNLOAD_MANAGER
557-
558-
559-#-----------------------------------------------------------------------------
560-# Project name (used e.g. in include file and doc install path).
561-#-----------------------------------------------------------------------------
562-PROJECT_NAME = ubuntu-download-manager
563-
564-
565-#-----------------------------------------------------------------------------
566-# Project version
567-#-----------------------------------------------------------------------------
568-PROJECT_VERSION = 0.3
569-
570-#-----------------------------------------------------------------------------
571-# Library version
572-#-----------------------------------------------------------------------------
573-VERSION = 0.3
574
575=== removed file 'common.pri'
576--- common.pri 2013-07-03 11:02:59 +0000
577+++ common.pri 1970-01-01 00:00:00 +0000
578@@ -1,5 +0,0 @@
579-contains(QT_VERSION, ^4.*) {
580- error("Use at least Qt 5.x");
581-}
582-
583-include( coverage.pri )
584
585=== removed file 'coverage.pri'
586--- coverage.pri 2013-07-03 11:02:59 +0000
587+++ coverage.pri 1970-01-01 00:00:00 +0000
588@@ -1,66 +0,0 @@
589-# Coverage Support
590-# --------------------------------
591-# In order to generate coverage report you will have to:
592-# 0) Install following packages: gcovr lcov
593-# 1) Configure project with coverage enabled
594-# 1.1) qmake CONFIG+=coverage
595-# 2) Compile project with coverage target
596-# 2.1) xml report
597-# 2.1.1) make coverage-xml
598-# 2.2) html report
599-# 2.2.1) make coverage-html
600-#
601-# In order to regenerate the report you might need to do following steps:
602-# 1) make distclean
603-# 2) qmake -r CONFIG+=coverage
604-# 3) make coverage-html or make coverage-xml
605-# --------------------------------
606-
607-CONFIG(coverage) {
608- OBJECTS_DIR =
609- MOC_DIR =
610- TOP_SRC_DIR = $$PWD
611-
612- LIBS += -lgcov
613- QMAKE_CXXFLAGS += --coverage
614- QMAKE_LDFLAGS += --coverage
615-
616- QMAKE_EXTRA_TARGETS += coverage cov
617- QMAKE_EXTRA_TARGETS += clean-gcno clean-gcda coverage-html \
618- generate-coverage-html clean-coverage-html coverage-xml \
619- generate-xml generate-coverage-xml clean-coverage-xml
620-
621- clean-gcno.commands = \
622- "@echo Removing old coverage instrumentation"; \
623- "find -name '*.gcno' -print | xargs -r rm"
624-
625- clean-gcda.commands = \
626- "@echo Removing old coverage results"; \
627- "find -name '*.gcda' -print | xargs -r rm"
628-
629- coverage-html.depends = clean-gcda check generate-coverage-html
630-
631- generate-coverage-html.commands = \
632- "@echo Collecting coverage data"; \
633- "lcov --directory $${TOP_SRC_DIR} --capture --output-file coverage.info --no-checksum --compat-libtool"; \
634- "lcov --extract coverage.info \"*/modules/*.cpp\" -o coverage.info"; \
635- "lcov --remove coverage.info \"moc_*.cpp\" -o coverage.info"; \
636- "LANG=C genhtml --prefix $${TOP_SRC_DIR} --output-directory coverage-html --title \"Code Coverage\" --legend --show-details coverage.info"
637-
638- clean-coverage-html.depends = clean-gcda
639- clean-coverage-html.commands = \
640- "lcov --directory $${TOP_SRC_DIR} -z"; \
641- "rm -rf coverage.info coverage-html"
642-
643- coverage-xml.depends = clean-gcda check generate-coverage-xml
644-
645- generate-coverage-xml.commands = \
646- "@echo Generating coverage GCOVR XML report"; \
647- "gcovr -x -r $${TOP_SRC_DIR} -o $${TOP_SRC_DIR}/coverage.xml -e \".*/moc_.*\" -e \"unit/.*\" -e \".*\\.h\""
648-
649- clean-coverage-xml.depends = clean-gcda
650- clean-coverage-xml.commands = \
651- "rm -rf $${TOP_SRC_DIR}/coverage.xml"
652-
653- QMAKE_CLEAN += *.gcda *.gcno coverage.info coverage.xml
654-}
655
656=== modified file 'debian/control'
657--- debian/control 2014-03-20 16:23:00 +0000
658+++ debian/control 2014-04-11 16:06:36 +0000
659@@ -1,7 +1,10 @@
660 Source: ubuntu-download-manager
661 Section: net
662 Priority: optional
663-Build-Depends: debhelper (>= 9),
664+Build-Depends: cmake,
665+ debhelper (>= 9),
666+ dbus-test-runner,
667+ google-mock,
668 qt5-qmake,
669 qt5-default,
670 qtbase5-dev,
671@@ -10,7 +13,6 @@
672 libqt5sql5-sqlite,
673 libnih-dbus-dev,
674 libgoogle-glog-dev,
675- dbus-test-runner,
676 qtdeclarative5-dev,
677 qtdeclarative5-dev-tools,
678 qtdeclarative5-test-plugin
679@@ -22,10 +24,47 @@
680 # upstream branch
681 Vcs-Bzr: lp:ubuntu-download-manager
682
683+Package: libudm-common0
684+Section: libs
685+Architecture: any
686+Depends: ${misc:Depends},
687+ ${shlibs:Depends},
688+Description: Upload Download Manager - shared common library
689+ Upload Download Manager performs uploads and downloads from a centralized
690+ location.
691+ .
692+ This package includes the common shared library between the client lib and the
693+ service lib.
694+
695+Package: libudm-common-dev
696+Section: libdevel
697+Architecture: any
698+Depends: libudm-common0 (= ${binary:Version}),
699+ qtbase5-dev,
700+ ${shlibs:Depends},
701+ ${misc:Depends}
702+Description: QT library for Ubuntu Download Manager - development files
703+ This package contains the common headers shared between the client library and
704+ the daemon library.
705+
706+Package: libudm-priv0
707+Section: libs
708+Architecture: any
709+Depends: ${misc:Depends},
710+ ${shlibs:Depends},
711+ libudm-common0 (= ${binary:Version}),
712+Breaks: libubuntu-download-manager-priv1
713+Replaces: libubuntu-download-manager-priv1
714+Description: Upload Download Manager - shared private library
715+ Upload Download Manager performs downloads from a centralized location.
716+ .
717+ This package includes the private shared library.
718+
719 Package: libubuntu-download-manager-common0
720 Section: libs
721 Architecture: any
722-Depends: ${misc:Depends},
723+Depends: libudm-common0 (= ${binary:Version}),
724+ ${misc:Depends},
725 ${shlibs:Depends},
726 Breaks: ubuntu-download-manager-common1
727 Replaces: ubuntu-download-manager-common1
728@@ -38,7 +77,8 @@
729 Package: libubuntu-download-manager-common-dev
730 Section: libdevel
731 Architecture: any
732-Depends: libubuntu-download-manager-common0 (= ${binary:Version}),
733+Depends: libudm-common-dev (= ${binary:Version}),
734+ libubuntu-download-manager-common0 (= ${binary:Version}),
735 qtbase5-dev,
736 ${shlibs:Depends},
737 ${misc:Depends}
738@@ -48,24 +88,12 @@
739 This package contains the common headers shared between the client library and
740 the daemon library.
741
742-Package: libubuntu-download-manager-priv0
743-Section: libs
744-Architecture: any
745-Depends: ${misc:Depends},
746- ${shlibs:Depends},
747- libubuntu-download-manager-common0 (= ${binary:Version}),
748-Breaks: ubuntu-download-manager-priv1
749-Replaces: ubuntu-download-manager-priv1
750-Description: Ubuntu Download Manager - shared private library
751- Ubuntu Download Manager performs downloads from a centralized location.
752- .
753- This package includes the private shared library.
754-
755 Package: libubuntu-download-manager-client0
756 Section: libs
757 Architecture: any
758 Depends: ${misc:Depends},
759 ${shlibs:Depends},
760+ libudm-common0 (= ${binary:Version}),
761 libubuntu-download-manager-common0 (= ${binary:Version}),
762 Breaks: ubuntu-download-manager-client1
763 Replaces: ubuntu-download-manager-client1
764@@ -77,7 +105,8 @@
765 Package: libubuntu-download-manager-client-dev
766 Section: libdevel
767 Architecture: any
768-Depends: libubuntu-download-manager-common-dev (= ${binary:Version}),
769+Depends: libudm-common-dev (= ${binary:Version}),
770+ libubuntu-download-manager-common-dev (= ${binary:Version}),
771 libubuntu-download-manager-client0 (= ${binary:Version}),
772 qtbase5-dev,
773 ${shlibs:Depends},
774@@ -88,22 +117,63 @@
775 This package contains the header that can be used to allow an application use
776 the Ubuntu Download Manager client library.
777
778+Package: libubuntu-upload-manager-common0
779+Section: libs
780+Architecture: any
781+Depends: libudm-common0 (= ${binary:Version}),
782+ ${misc:Depends},
783+ ${shlibs:Depends},
784+Description: Ubuntu Upload Manager - shared common library
785+ Ubuntu Upload Manager performs uploads from a centralized location.
786+ .
787+ This package includes the common shared library between the client lib and the
788+ service lib.
789+
790+Package: libubuntu-upload-manager-common-dev
791+Section: libdevel
792+Architecture: any
793+Depends: libudm-common-dev (= ${binary:Version}),
794+ libubuntu-download-manager-common0 (= ${binary:Version}),
795+ qtbase5-dev,
796+ ${shlibs:Depends},
797+ ${misc:Depends}
798+Description: QT library for Ubuntu Upload Manager - development files
799+ This package contains the common headers shared between the client library and
800+ the daemon library.
801+
802 Package: ubuntu-download-manager
803 Section: net
804 Architecture: any
805 Depends: ${misc:Depends},
806 ${shlibs:Depends},
807- libubuntu-download-manager-priv0 (= ${binary:Version}),
808+ libudm-common0 (= ${binary:Version}),
809+ libudm-priv0 (= ${binary:Version}),
810+ libubuntu-download-manager-common0 (= ${binary:Version}),
811 Description: Ubuntu Download Manager - daemon
812 Ubuntu Download Manager performs downloads from a centralized location.
813 .
814 This package includes the daemon.
815
816+Package: ubuntu-upload-manager
817+Section: net
818+Architecture: any
819+Depends: ${misc:Depends},
820+ ${shlibs:Depends},
821+ libudm-common0 (= ${binary:Version}),
822+ libudm-priv0 (= ${binary:Version}),
823+ libubuntu-upload-manager-common0 (= ${binary:Version}),
824+Description: Ubuntu Upload Manager - daemon
825+ Ubuntu Upload Manager performs uploads from a centralized location.
826+ .
827+ This package includes the daemon.
828+
829 Package: qtdeclarative5-ubuntu-download-manager0.1
830 Section: net
831 Architecture: any
832 Depends: ${misc:Depends},
833 ${shlibs:Depends},
834+ libudm-common0 (= ${binary:Version}),
835+ libubuntu-download-manager-common0 (= ${binary:Version}),
836 libubuntu-download-manager-client0 (= ${binary:Version})
837 Description: Ubuntu Download Manager Plugin
838 This package contains a QML Plugin to handle downloads from a pure QML
839
840=== modified file 'debian/libubuntu-download-manager-client-dev.install'
841--- debian/libubuntu-download-manager-client-dev.install 2014-02-10 18:04:03 +0000
842+++ debian/libubuntu-download-manager-client-dev.install 2014-04-11 16:06:36 +0000
843@@ -2,5 +2,5 @@
844 usr/include/ubuntu/download_manager/manager.h
845 usr/include/ubuntu/download_manager/download.h
846 usr/include/ubuntu/download_manager/group_download.h
847-usr/lib/*/pkgconfig/ubuntu-download-manager-client.pc
848+usr/share/pkgconfig/ubuntu-download-manager-client.pc
849 usr/lib/*/libubuntu-download-manager-client.so
850
851=== modified file 'debian/libubuntu-download-manager-common-dev.install'
852--- debian/libubuntu-download-manager-common-dev.install 2014-02-19 19:01:37 +0000
853+++ debian/libubuntu-download-manager-common-dev.install 2014-04-11 16:06:36 +0000
854@@ -2,10 +2,5 @@
855 usr/include/ubuntu/download_manager/metatypes.h
856 usr/include/ubuntu/download_manager/download_struct.h
857 usr/include/ubuntu/download_manager/group_download_struct.h
858-usr/include/ubuntu/download_manager/auth_error_struct.h
859-usr/include/ubuntu/download_manager/http_error_struct.h
860-usr/include/ubuntu/download_manager/network_error_struct.h
861-usr/include/ubuntu/download_manager/process_error_struct.h
862-usr/include/ubuntu/download_manager/metadata.h
863-usr/lib/*/pkgconfig/ubuntu-download-manager-common.pc
864+usr/share/pkgconfig/ubuntu-download-manager-common.pc
865 usr/lib/*/libubuntu-download-manager-common.so
866
867=== removed file 'debian/libubuntu-download-manager-priv0.install'
868--- debian/libubuntu-download-manager-priv0.install 2014-02-10 18:04:03 +0000
869+++ debian/libubuntu-download-manager-priv0.install 1970-01-01 00:00:00 +0000
870@@ -1,1 +0,0 @@
871-usr/lib/*/libubuntu-download-manager-priv.so.0*
872
873=== added file 'debian/libubuntu-upload-manager-common-dev.install'
874--- debian/libubuntu-upload-manager-common-dev.install 1970-01-01 00:00:00 +0000
875+++ debian/libubuntu-upload-manager-common-dev.install 2014-04-11 16:06:36 +0000
876@@ -0,0 +1,5 @@
877+usr/include/ubuntu/upload_manager/common.h
878+usr/include/ubuntu/upload_manager/metatypes.h
879+usr/include/ubuntu/upload_manager/upload_struct.h
880+usr/share/pkgconfig/ubuntu-upload-manager-common.pc
881+usr/lib/*/libubuntu-upload-manager-common.so
882
883=== added file 'debian/libubuntu-upload-manager-common0.install'
884--- debian/libubuntu-upload-manager-common0.install 1970-01-01 00:00:00 +0000
885+++ debian/libubuntu-upload-manager-common0.install 2014-04-11 16:06:36 +0000
886@@ -0,0 +1,1 @@
887+usr/lib/*/libubuntu-upload-manager-common.so.0*
888
889=== added file 'debian/libudm-common-dev.install'
890--- debian/libudm-common-dev.install 1970-01-01 00:00:00 +0000
891+++ debian/libudm-common-dev.install 2014-04-11 16:06:36 +0000
892@@ -0,0 +1,7 @@
893+usr/include/ubuntu/transfers/metadata.h
894+usr/include/ubuntu/transfers/errors/auth_error_struct.h
895+usr/include/ubuntu/transfers/errors/http_error_struct.h
896+usr/include/ubuntu/transfers/errors/network_error_struct.h
897+usr/include/ubuntu/transfers/errors/process_error_struct.h
898+usr/share/pkgconfig/udm-common.pc
899+usr/lib/*/libudm-common.so
900
901=== added file 'debian/libudm-common0.install'
902--- debian/libudm-common0.install 1970-01-01 00:00:00 +0000
903+++ debian/libudm-common0.install 2014-04-11 16:06:36 +0000
904@@ -0,0 +1,1 @@
905+usr/lib/*/libudm-common.so.0*
906
907=== added file 'debian/libudm-priv0.install'
908--- debian/libudm-priv0.install 1970-01-01 00:00:00 +0000
909+++ debian/libudm-priv0.install 2014-04-11 16:06:36 +0000
910@@ -0,0 +1,1 @@
911+usr/lib/*/libudm-priv-common.so.0*
912
913=== modified file 'debian/qtdeclarative5-ubuntu-download-manager0.1.install'
914--- debian/qtdeclarative5-ubuntu-download-manager0.1.install 2014-03-20 11:41:09 +0000
915+++ debian/qtdeclarative5-ubuntu-download-manager0.1.install 2014-04-11 16:06:36 +0000
916@@ -1,2 +1,2 @@
917-usr/lib/*/qt5/qml/UbuntuDownloadManager.0.1/libUbuntuDownloadManager.so
918-usr/lib/*/qt5/qml/UbuntuDownloadManager.0.1/qmldir
919+usr/lib/*/qt5/qml/UbuntuDownloadManager/libUbuntuDownloadManager.so
920+usr/lib/*/qt5/qml/UbuntuDownloadManager/qmldir
921
922=== modified file 'debian/rules'
923--- debian/rules 2014-03-19 10:42:33 +0000
924+++ debian/rules 2014-04-11 16:06:36 +0000
925@@ -7,8 +7,24 @@
926
927 export DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
928
929+DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
930+# Work around pointer equality problem with -Bsymbolic-functions:
931+# http://lists.linaro.org/pipermail/linaro-toolchain/2014-January/003944.html
932+ifneq (,$(findstring powerpc,$(DEB_HOST_GNU_TYPE)))
933+export DEB_BUILD_MAINT_OPTIONS := hardening=+pie
934+endif
935+
936+ifneq (,$(findstring arm,$(DEB_HOST_GNU_TYPE)))
937+export DEB_BUILD_MAINT_OPTIONS := hardening=+pie
938+endif
939+
940+
941+ifneq (,$(findstring aarch64,$(DEB_HOST_GNU_TYPE)))
942+export DEB_BUILD_MAINT_OPTIONS := hardening=+pie
943+endif
944+
945 override_dh_auto_configure:
946- dh_auto_configure -- LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)
947+ dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)
948
949 dh_auto_install:
950 rm -f debian/tmp/usr/lib/*.so
951
952=== modified file 'debian/ubuntu-download-manager.install'
953--- debian/ubuntu-download-manager.install 2013-09-20 12:52:33 +0000
954+++ debian/ubuntu-download-manager.install 2014-04-11 16:06:36 +0000
955@@ -1,4 +1,4 @@
956 usr/bin/ubuntu-download-manager
957 usr/share/dbus-1/services/ubuntu-download-manager.service
958-usr/share/dbus-1/system-services/com.canonical.applications.Downloader.service
959+etc/dbus-1/system-services/com.canonical.applications.Downloader.service
960 etc/dbus-1/system.d/com.canonical.applications.Downloader.conf
961
962=== added file 'debian/ubuntu-upload-manager.install'
963--- debian/ubuntu-upload-manager.install 1970-01-01 00:00:00 +0000
964+++ debian/ubuntu-upload-manager.install 2014-04-11 16:06:36 +0000
965@@ -0,0 +1,4 @@
966+usr/bin/ubuntu-upload-manager
967+usr/share/dbus-1/services/ubuntu-upload-manager.service
968+etc/dbus-1/system-services/com.canonical.applications.Uploader.service
969+etc/dbus-1/system.d/com.canonical.applications.Uploader.conf
970
971=== modified file 'docs/com.canonical.applications.download.xml'
972--- docs/com.canonical.applications.download.xml 2014-02-11 15:35:52 +0000
973+++ docs/com.canonical.applications.download.xml 2014-04-11 16:06:36 +0000
974@@ -22,6 +22,10 @@
975 <arg name="speed" type="t" direction="out"/>
976 </method>
977
978+ <method name="setDestinationDir">
979+ <arg name="path" type="s" direction="in"/>
980+ </method>
981+
982 <method name="allowGSMDownload">
983 <arg name="allowed" type="b" direction="in"/>
984 </method>
985
986=== added file 'docs/com.canonical.applications.upload.xml'
987--- docs/com.canonical.applications.upload.xml 1970-01-01 00:00:00 +0000
988+++ docs/com.canonical.applications.upload.xml 2014-04-11 16:06:36 +0000
989@@ -0,0 +1,73 @@
990+<node>
991+ <interface name="com.canonical.applications.Upload">
992+
993+ <method name="progress">
994+ <arg name="uploaded" type="t" direction="out"/>
995+ </method>
996+
997+ <method name="metadata">
998+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
999+ <arg name="data" type="a{sv}" direction="out" />
1000+ </method>
1001+
1002+ <method name="setThrottle">
1003+ <arg name="speed" type="t" direction="in"/>
1004+ </method>
1005+
1006+ <method name="throttle">
1007+ <arg name="speed" type="t" direction="out"/>
1008+ </method>
1009+
1010+ <method name="allowMobileUpload">
1011+ <arg name="allowed" type="b" direction="in"/>
1012+ </method>
1013+
1014+ <method name="isMobileUploadAllowed">
1015+ <arg name="allowed" type="b" direction="out"/>
1016+ </method>
1017+
1018+ <method name="start" />
1019+ <method name="cancel" />
1020+
1021+ <signal name="started">
1022+ <arg name="success" type="b" direction="out"/>
1023+ </signal>
1024+
1025+ <signal name="canceled">
1026+ <arg name="success" type="b" direction="out"/>
1027+ </signal>
1028+
1029+ <signal name="finished">
1030+ </signal>
1031+
1032+ <signal name="error">
1033+ <arg name="error" type="s" direction="out"/>
1034+ </signal>
1035+
1036+ <signal name="authError">
1037+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="AuthErrorStruct"/>
1038+ <arg name="error" type="(is)" direction="out"/>
1039+ </signal>
1040+
1041+ <signal name="httpError">
1042+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="HttpErrorStruct"/>
1043+ <arg name="error" type="(is)" direction="out"/>
1044+ </signal>
1045+
1046+ <signal name="networkError">
1047+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="NetworkErrorStruct"/>
1048+ <arg name="error" type="(is)" direction="out"/>
1049+ </signal>
1050+
1051+ <signal name="processError">
1052+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ProcessErrorStruct"/>
1053+ <arg name="error" type="(isiss)" direction="out"/>
1054+ </signal>
1055+
1056+ <signal name="progress">
1057+ <arg name="uploded" type="t" direction="out"/>
1058+ <arg name="total" type="t" direction="out"/>
1059+ </signal>
1060+
1061+ </interface>
1062+</node>
1063
1064=== added file 'docs/com.canonical.applications.upload_manager.xml'
1065--- docs/com.canonical.applications.upload_manager.xml 1970-01-01 00:00:00 +0000
1066+++ docs/com.canonical.applications.upload_manager.xml 2014-04-11 16:06:36 +0000
1067@@ -0,0 +1,52 @@
1068+<node>
1069+ <interface name="com.canonical.applications.UploadManager">
1070+ <method name="createUpload">
1071+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="UploadStruct"/>
1072+ <arg name="upload" type="(ssa{sv}a{ss})" direction="in" />
1073+ <arg name="uploadPath" type="o" direction="out" />
1074+ </method>
1075+
1076+ <method name="createMmsUpload">
1077+ <arg name="url" type="s" direction="in" />
1078+ <arg name="file" type="s" direction="in" />
1079+ <arg name="hostname" type="s" direction="in" />
1080+ <arg name="port" type="i" direction="in" />
1081+ <arg name="username" type="s" direction="in" />
1082+ <arg name="password" type="s" direction="in" />
1083+ <arg name="uploadPath" type="o" direction="out" />
1084+ </method>
1085+
1086+ <method name="getAllUploads">
1087+ <arg name="uploads" type="ao" direction="out" />
1088+ </method>
1089+
1090+ <method name="getAllUploadsWithMetadata">
1091+ <arg name="name" type="s" direction="in"/>
1092+ <arg name="value" type="s" direction="in"/>
1093+ <arg name="uploads" type="ao" direction="out" />
1094+ </method>
1095+
1096+ <method name="setDefaultThrottle">
1097+ <arg name="speed" type="t" direction="in"/>
1098+ </method>
1099+
1100+ <method name="defaultThrottle">
1101+ <arg name="speed" type="t" direction="out"/>
1102+ </method>
1103+
1104+ <method name="allowMobileUpload">
1105+ <arg name="allowed" type="b" direction="in"/>
1106+ </method>
1107+
1108+ <method name="isMobileUploadAllowed">
1109+ <arg name="allowed" type="b" direction="out"/>
1110+ </method>
1111+
1112+ <method name="exit" />
1113+
1114+ <signal name="uploadCreated">
1115+ <arg name="path" type="o" direction="out"/>
1116+ </signal>
1117+
1118+ </interface>
1119+</node>
1120
1121=== removed file 'download-manager.pro'
1122--- download-manager.pro 2014-03-06 12:18:32 +0000
1123+++ download-manager.pro 1970-01-01 00:00:00 +0000
1124@@ -1,34 +0,0 @@
1125-include(common.pri)
1126-
1127-TEMPLATE = subdirs
1128-CONFIG += ordered
1129-
1130-SUBDIRS += \
1131- ubuntu-download-manager-common \
1132- ubuntu-download-manager-priv \
1133- ubuntu-download-manager \
1134- ubuntu-download-manager-client \
1135- ubuntu-download-manager-test-lib \
1136- ubuntu-download-manager-tests \
1137- ubuntu-download-manager-common-tests \
1138- ubuntu-download-manager-test-daemon \
1139- ubuntu-download-manager-client-tests \
1140- ubuntu-download-manager-client-tests \
1141- ubuntu-download-manager-plugin
1142-
1143-ubuntu-download-manager-priv.depends = ubuntu-download-manager-common
1144-
1145-ubuntu-download-manager.depends = ubuntu-download-manager-priv
1146-
1147-ubuntu-download-manager-client.depends = ubuntu-download-manager-common
1148-
1149-ubuntu-download-manager-common-tests.depends += ubuntu-download-manager-test-daemon
1150-ubuntu-download-manager-common-tests.depends += ubuntu-download-manager-common
1151-ubuntu-download-manager-common-tests.depends += ubuntu-download-manager-test-lib
1152-
1153-ubuntu-download-manager-tests.depends += ubuntu-download-manager-test-lib
1154-ubuntu-download-manager-tests.depends += ubuntu-download-manager-priv
1155-
1156-ubuntu-download-manager-client-tests.depends += ubuntu-download-manager-test-daemon
1157-ubuntu-download-manager-client-tests.depends += ubuntu-download-manager-test-lib
1158-ubuntu-download-manager-client-tests.depends += ubuntu-download-manager-client
1159
1160=== added directory 'src'
1161=== added file 'src/CMakeLists.txt'
1162--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
1163+++ src/CMakeLists.txt 2014-04-11 16:06:36 +0000
1164@@ -0,0 +1,19 @@
1165+# Copyright © 2013 Canonical Ltd.
1166+#
1167+# This program is free software: you can redistribute it and/or modify
1168+# it under the terms of the GNU General Public License version 3 as
1169+# published by the Free Software Foundation.
1170+#
1171+# This program is distributed in the hope that it will be useful,
1172+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1173+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1174+# GNU General Public License for more details.
1175+#
1176+# You should have received a copy of the GNU General Public License
1177+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1178+#
1179+# Authored by: Manuel de la Peña <manuel.delapena@canonical.com>
1180+
1181+add_subdirectory(common)
1182+add_subdirectory(downloads)
1183+add_subdirectory(uploads)
1184
1185=== added directory 'src/common'
1186=== added file 'src/common/CMakeLists.txt'
1187--- src/common/CMakeLists.txt 1970-01-01 00:00:00 +0000
1188+++ src/common/CMakeLists.txt 2014-04-11 16:06:36 +0000
1189@@ -0,0 +1,18 @@
1190+# Copyright © 2013 Canonical Ltd.
1191+#
1192+# This program is free software: you can redistribute it and/or modify
1193+# it under the terms of the GNU General Public License version 3 as
1194+# published by the Free Software Foundation.
1195+#
1196+# This program is distributed in the hope that it will be useful,
1197+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1198+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1199+# GNU General Public License for more details.
1200+#
1201+# You should have received a copy of the GNU General Public License
1202+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1203+#
1204+# Authored by: Manuel de la Peña <manuel.delapena@canonical.com>
1205+
1206+add_subdirectory(priv)
1207+add_subdirectory(public)
1208
1209=== added directory 'src/common/priv'
1210=== added file 'src/common/priv/CMakeLists.txt'
1211--- src/common/priv/CMakeLists.txt 1970-01-01 00:00:00 +0000
1212+++ src/common/priv/CMakeLists.txt 2014-04-11 16:06:36 +0000
1213@@ -0,0 +1,87 @@
1214+set(TARGET udm-priv-common)
1215+
1216+set(SOURCES
1217+ ubuntu/transfers/base_daemon.cpp
1218+ ubuntu/transfers/base_manager.cpp
1219+ ubuntu/transfers/queue.cpp
1220+ ubuntu/transfers/transfer.cpp
1221+ ubuntu/transfers/system/apn_proxy.cpp
1222+ ubuntu/transfers/system/apn_request_factory.cpp
1223+ ubuntu/transfers/system/apparmor.cpp
1224+ ubuntu/transfers/system/application.cpp
1225+ ubuntu/transfers/system/cryptographic_hash.cpp
1226+ ubuntu/transfers/system/dbus_proxy.cpp
1227+ ubuntu/transfers/system/file_manager.cpp
1228+ ubuntu/transfers/system/filename_mutex.cpp
1229+ ubuntu/transfers/system/network_reply.cpp
1230+ ubuntu/transfers/system/process.cpp
1231+ ubuntu/transfers/system/process_factory.cpp
1232+ ubuntu/transfers/system/request_factory.cpp
1233+ ubuntu/transfers/system/system_network_info.cpp
1234+ ubuntu/transfers/system/timer.cpp
1235+ ubuntu/transfers/system/uuid_factory.cpp
1236+ ubuntu/transfers/system/uuid_utils.cpp
1237+)
1238+
1239+set(HEADERS
1240+ ubuntu/transfers/adaptor_factory.h
1241+ ubuntu/transfers/base_daemon.h
1242+ ubuntu/transfers/base_manager.h
1243+ ubuntu/transfers/manager_factory.h
1244+ ubuntu/transfers/queue.h
1245+ ubuntu/transfers/transfer.h
1246+ ubuntu/transfers/system/apn_proxy.h
1247+ ubuntu/transfers/system/apn_request_factory.h
1248+ ubuntu/transfers/system/apparmor.h
1249+ ubuntu/transfers/system/application.h
1250+ ubuntu/transfers/system/cryptographic_hash.h
1251+ ubuntu/transfers/system/dbus_proxy.h
1252+ ubuntu/transfers/system/file_manager.h
1253+ ubuntu/transfers/system/filename_mutex.h
1254+ ubuntu/transfers/system/network_reply.h
1255+ ubuntu/transfers/system/process.h
1256+ ubuntu/transfers/system/process_factory.h
1257+ ubuntu/transfers/system/request_factory.h
1258+ ubuntu/transfers/system/system_network_info.h
1259+ ubuntu/transfers/system/timer.h
1260+ ubuntu/transfers/system/uuid_factory.h
1261+ ubuntu/transfers/system/uuid_utils.h
1262+)
1263+
1264+include_directories(${Qt5SystemInfo_INCLUDE_DIRS})
1265+include_directories(${Qt5DBus_INCLUDE_DIRS})
1266+include_directories(${Qt5Network_INCLUDE_DIRS})
1267+include_directories(${Qt5Sql_INCLUDE_DIRS})
1268+include_directories(${DBUS_INCLUDE_DIRS})
1269+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
1270+include_directories(${CMAKE_CURRENT_BINARY_DIR})
1271+include_directories(${CMAKE_SOURCE_DIR}/src/common/public)
1272+
1273+add_library(${TARGET} SHARED
1274+ ${HEADERS}
1275+ ${SOURCES}
1276+)
1277+
1278+set_target_properties(
1279+ ${TARGET}
1280+
1281+ PROPERTIES
1282+ VERSION ${UDM_VERSION_MAJOR}.${UDM_VERSION_MINOR}.${UDM_VERSION_PATCH}
1283+ SOVERSION ${UDM_VERSION_MAJOR}
1284+)
1285+
1286+link_directories(${NIH_DBUS_LIBDIR})
1287+link_directories(${GLOG_DBUS_LIBDIR})
1288+
1289+target_link_libraries(${TARGET}
1290+ ${NIH_DBUS_LIBRARIES}
1291+ ${GLOG_LIBRARIES}
1292+ ${Qt5Network_LIBRARIES}
1293+ ${Qt5Sql_LIBRARIES}
1294+ ${Qt5SystemInfo_LIBRARIES}
1295+ ${Qt5Core_LIBRARIES}
1296+ ${Qt5DBus_LIBRARIES}
1297+ udm-common
1298+)
1299+
1300+install(TARGETS ${TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR})
1301
1302=== added directory 'src/common/priv/ubuntu'
1303=== added directory 'src/common/priv/ubuntu/transfers'
1304=== added file 'src/common/priv/ubuntu/transfers/adaptor_factory.h'
1305--- src/common/priv/ubuntu/transfers/adaptor_factory.h 1970-01-01 00:00:00 +0000
1306+++ src/common/priv/ubuntu/transfers/adaptor_factory.h 2014-04-11 16:06:36 +0000
1307@@ -0,0 +1,41 @@
1308+/*
1309+ * Copyright 2014 Canonical Ltd.
1310+ *
1311+ * This library is free software; you can redistribute it and/or
1312+ * modify it under the terms of version 3 of the GNU Lesser General Public
1313+ * License as published by the Free Software Foundation.
1314+ *
1315+ * This program is distributed in the hope that it will be useful,
1316+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1317+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1318+ * General Public License for more details.
1319+ *
1320+ * You should have received a copy of the GNU Lesser General Public
1321+ * License along with this library; if not, write to the
1322+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
1323+ * Boston, MA 02110-1301, USA.
1324+ */
1325+
1326+#ifndef UBUNTU_GENERAL_ADAPTOR_FACTORY_H
1327+#define UBUNTU_GENERAL_ADAPTOR_FACTORY_H
1328+
1329+#include <QObject>
1330+#include "base_manager.h"
1331+
1332+namespace Ubuntu {
1333+
1334+namespace Transfers {
1335+
1336+class AdaptorFactory : public QObject {
1337+ public:
1338+ explicit AdaptorFactory(QObject *parent = 0)
1339+ : QObject(parent) {}
1340+
1341+ virtual QObject* createAdaptor(BaseManager* man) = 0;
1342+};
1343+
1344+} // General
1345+
1346+} // Ubuntu
1347+
1348+#endif // UBUNTU_GENERAL_ADAPTOR_FACTORY_H
1349
1350=== renamed file 'ubuntu-download-manager-priv/downloads/daemon.cpp' => 'src/common/priv/ubuntu/transfers/base_daemon.cpp'
1351--- ubuntu-download-manager-priv/downloads/daemon.cpp 2014-02-21 11:52:42 +0000
1352+++ src/common/priv/ubuntu/transfers/base_daemon.cpp 2014-04-11 16:06:36 +0000
1353@@ -16,15 +16,17 @@
1354 * Boston, MA 02110-1301, USA.
1355 */
1356
1357+#include <QDebug>
1358 #include <QtDBus/QDBusConnection>
1359 #include <QSharedPointer>
1360 #include <QSslCertificate>
1361-#include "downloads/daemon.h"
1362-#include "downloads/manager.h"
1363-#include "downloads/download_manager_adaptor.h"
1364-#include "system/application.h"
1365-#include "system/logger.h"
1366-#include "system/timer.h"
1367+#include <glog/logging.h>
1368+#include "ubuntu/transfers/system/application.h"
1369+#include "ubuntu/transfers/system/logger.h"
1370+#include "ubuntu/transfers/system/timer.h"
1371+#include "adaptor_factory.h"
1372+#include "manager_factory.h"
1373+#include "base_daemon.h"
1374
1375
1376 namespace {
1377@@ -32,298 +34,203 @@
1378 const QString SELFSIGNED_CERT = "-self-signed-certs";
1379 const QString STOPPABLE = "-stoppable";
1380 const QString LOG_DIR= "-log-dir";
1381+ const int DEFAULT_TIMEOUT = 30000;
1382 }
1383
1384 namespace Ubuntu {
1385
1386-namespace DownloadManager {
1387-
1388-namespace Daemon {
1389-
1390-/**
1391- * PRIVATE IMPLEMENATION
1392- */
1393-
1394-class DaemonPrivate {
1395- Q_DECLARE_PUBLIC(Daemon)
1396-
1397- public:
1398- explicit DaemonPrivate(Daemon* parent)
1399- : q_ptr(parent) {
1400- _app = new Application();
1401- _conn = new DBusConnection();
1402- _shutDownTimer = new Timer();
1403- init();
1404- }
1405-
1406- DaemonPrivate(Application* app,
1407- DBusConnection* conn,
1408- Timer* timer,
1409- Manager* man,
1410- Daemon* parent)
1411- : _app(app),
1412- _shutDownTimer(timer),
1413- _conn(conn),
1414- _downInterface(man),
1415- q_ptr(parent) {
1416- init();
1417- }
1418-
1419- ~DaemonPrivate() {
1420- // no need to delete the adaptor because the interface is its parent
1421- delete _app;
1422- delete _conn;
1423- delete _downInterface;
1424- delete _shutDownTimer;
1425- }
1426-
1427- bool isTimeoutEnabled() {
1428- return _isTimeoutEnabled;
1429- }
1430-
1431- void enableTimeout(bool enabled) {
1432- _isTimeoutEnabled = enabled;
1433- if (!_isTimeoutEnabled) {
1434- _shutDownTimer->stop();
1435- }
1436- }
1437-
1438- bool isStoppable() {
1439- return _stoppable;
1440- }
1441-
1442- void setStoppable(bool stoppable) {
1443- _stoppable = stoppable;
1444- }
1445-
1446- QList<QSslCertificate> selfSignedCerts() {
1447- return _certs;
1448- }
1449-
1450- void setSelfSignedCerts(QList<QSslCertificate> certs) {
1451- _certs = certs;
1452- }
1453-
1454- void start(QString path) {
1455- TRACE;
1456- _path = path;
1457- _downAdaptor = new DownloadManagerAdaptor(_downInterface);
1458- bool ret = _conn->registerService(_path);
1459- if (ret) {
1460- LOG(INFO) << "Service registered to"
1461- << _path;
1462- ret = _conn->registerObject("/", _downInterface);
1463- if (!ret) {
1464- LOG(ERROR) << "Could not register interface. DBus Error =>"
1465- << _conn->connection().lastError();
1466- _app->exit(-1);
1467- }
1468- return;
1469- }
1470- LOG(ERROR) << "Could not register service. DBus Error =>"
1471- << _conn->connection().lastError();
1472- _app->exit(-1);
1473- }
1474-
1475- void stop() {
1476- // stop listening in the service
1477- bool ret = _conn->unregisterService(_path);
1478- if (!ret) {
1479- qCritical() << "Could not unregister service at" << _path;
1480- }
1481- }
1482-
1483- Manager* manager() {
1484- return _downInterface;
1485- }
1486-
1487- void onTimeout() {
1488- LOG(INFO) << "Timeout reached, shutdown service.";
1489- _app->exit(0);
1490- }
1491-
1492- void onDownloadManagerSizeChanged(int size) {
1493- TRACE << size;
1494- bool isActive = _shutDownTimer->isActive();
1495-
1496- if (isActive && size > 0) {
1497- LOG(INFO) << "Timer must be stopped because we have " << size
1498- << "downloads.";
1499- _shutDownTimer->stop();
1500- }
1501- if (!isActive && size == 0) {
1502- LOG(INFO) << "Timer must be started because we have 0 downloads.";
1503- _shutDownTimer->start(timeout);
1504- }
1505- }
1506-
1507- static const int timeout = 30000;
1508-
1509- private:
1510- void parseCommandLine() {
1511- QStringList args = _app->arguments();
1512- int index;
1513-
1514- // set logging
1515- if (args.contains(LOG_DIR)) {
1516- index = args.indexOf(LOG_DIR);
1517- if (args.count() > index + 1) {
1518- auto logPath = args[index + 1];
1519- Logger::setupLogging(logPath);
1520- LOG(INFO) << "Log path is" << logPath;
1521- } else {
1522- Logger::setupLogging();
1523- LOG(ERROR) << "Missing log dir path.";
1524- }
1525- } else {
1526- Logger::setupLogging();
1527- LOG(INFO) << "Using default log path.";
1528- }
1529-
1530- if (args.contains(SELFSIGNED_CERT)) {
1531- index = args.indexOf(SELFSIGNED_CERT);
1532- if (args.count() > index + 1) {
1533- QString certsRegex = args[index + 1];
1534- _certs = QSslCertificate::fromPath(certsRegex);
1535- LOG(INFO) << "Accepting self signed certs at path"
1536- << certsRegex;
1537- } else {
1538- LOG(ERROR) << "Missing certs path.";
1539- }
1540- } // certs
1541- _isTimeoutEnabled = !args.contains(DISABLE_TIMEOUT);
1542- LOG(INFO) << "Timeout is enabled: " << _isTimeoutEnabled;
1543- _stoppable = args.contains(STOPPABLE);
1544- LOG(INFO) << "Daemon is stoppable: " << _stoppable;
1545- }
1546-
1547- void init() {
1548- Q_Q(Daemon);
1549-
1550- // parse command line to decide if the timer is enabled and if
1551- // we accept self signed certs
1552- parseCommandLine();
1553- if (_isTimeoutEnabled) {
1554- q->connect(_shutDownTimer, SIGNAL(timeout()),
1555- q, SLOT(onTimeout()));
1556- _shutDownTimer->start(timeout);
1557- }
1558-
1559- if (_downInterface == nullptr) {
1560- _downInterface = new Manager(_app, _conn, _stoppable,
1561- q_ptr);
1562- }
1563-
1564- _downInterface->setAcceptedCertificates(_certs);
1565- // connect to the download manager changes
1566- q->connect(_downInterface,
1567- SIGNAL(sizeChanged(int)), // NOLINT (readability/function)
1568- q, SLOT(onDownloadManagerSizeChanged(int))); // NOLINT (readability/function)
1569- }
1570-
1571- private:
1572- QString _path = "";
1573- bool _isTimeoutEnabled = true;
1574- bool _stoppable = false;
1575- QList<QSslCertificate> _certs;
1576- Application* _app = nullptr;
1577- Timer* _shutDownTimer = nullptr;
1578- DBusConnection* _conn = nullptr;
1579- Manager* _downInterface = nullptr;
1580- DownloadManagerAdaptor* _downAdaptor = nullptr;
1581- Daemon* q_ptr;
1582-};
1583-
1584-/**
1585- * PUBLIC IMPLEMENTATION
1586- */
1587-
1588-Daemon::Daemon(QObject *parent)
1589+namespace Transfers {
1590+
1591+using namespace System;
1592+
1593+BaseDaemon::BaseDaemon(ManagerFactory* managerFactory,
1594+ AdaptorFactory* adaptorFactory,
1595+ QObject *parent)
1596 : QObject(parent),
1597- d_ptr(new DaemonPrivate(this)) {
1598+ _managerFactory(managerFactory),
1599+ _adaptorFactory(adaptorFactory) {
1600+
1601+ _app = new Application();
1602+ _conn = new DBusConnection();
1603+ _shutDownTimer = new Timer();
1604+ init();
1605 }
1606
1607-Daemon::Daemon(Application* app,
1608+BaseDaemon::BaseDaemon(ManagerFactory* managerFactory,
1609+ AdaptorFactory* adaptorFactory,
1610+ Application* app,
1611 DBusConnection* conn,
1612 Timer* timer,
1613- Manager* man,
1614- QObject *parent)
1615+ QObject* parent)
1616 : QObject(parent),
1617- d_ptr(new DaemonPrivate(app, conn, timer, man, this)) {
1618-}
1619-
1620-Daemon::Daemon(ManagerConstructor manConstructor, QObject *parent)
1621- : QObject(parent) {
1622- auto app = new Application();
1623- auto conn = new DBusConnection();
1624- auto timer = new Timer();
1625- auto man = manConstructor(app, conn);
1626- qDebug() << man;
1627- d_ptr = new DaemonPrivate(app, conn, timer, man, this);
1628-}
1629-
1630-Daemon::~Daemon() {
1631- delete d_ptr;
1632-}
1633-
1634-bool
1635-Daemon::isTimeoutEnabled() {
1636- Q_D(Daemon);
1637- return d->isTimeoutEnabled();
1638-}
1639-
1640-void
1641-Daemon::enableTimeout(bool enabled) {
1642- Q_D(Daemon);
1643- d->enableTimeout(enabled);
1644-}
1645-
1646-bool
1647-Daemon::isStoppable() {
1648- Q_D(Daemon);
1649- return d->isStoppable();
1650-}
1651-
1652-void
1653-Daemon::setStoppable(bool stoppable) {
1654- Q_D(Daemon);
1655- d->setStoppable(stoppable);
1656+ _app(app),
1657+ _shutDownTimer(timer),
1658+ _conn(conn),
1659+ _managerFactory(managerFactory),
1660+ _adaptorFactory(adaptorFactory) {
1661+ init();
1662+}
1663+
1664+BaseDaemon::~BaseDaemon() {
1665+ // no need to delete the adaptor because the interface is its parent
1666+ delete _app;
1667+ delete _conn;
1668+ delete _manager;
1669+ delete _shutDownTimer;
1670+ delete _managerFactory;
1671+ delete _adaptorFactory;
1672+}
1673+
1674+bool
1675+BaseDaemon::isTimeoutEnabled() {
1676+ return _isTimeoutEnabled;
1677+}
1678+
1679+void
1680+BaseDaemon::enableTimeout(bool enabled) {
1681+ _isTimeoutEnabled = enabled;
1682+ if (!_isTimeoutEnabled) {
1683+ _shutDownTimer->stop();
1684+ }
1685+}
1686+
1687+bool
1688+BaseDaemon::isStoppable() {
1689+ return _stoppable;
1690+}
1691+
1692+void
1693+BaseDaemon::setStoppable(bool stoppable) {
1694+ _stoppable = stoppable;
1695 }
1696
1697 QList<QSslCertificate>
1698-Daemon::selfSignedCerts() {
1699- Q_D(Daemon);
1700- return d->selfSignedCerts();
1701-}
1702-
1703-void
1704-Daemon::setSelfSignedCerts(QList<QSslCertificate> certs) {
1705- Q_D(Daemon);
1706- d->setSelfSignedCerts(certs);
1707-}
1708-
1709-void
1710-Daemon::start(QString path) {
1711- Q_D(Daemon);
1712- d->start(path);
1713-}
1714-
1715-void
1716-Daemon::stop() {
1717- Q_D(Daemon);
1718- d->stop();
1719-}
1720-
1721-Manager*
1722-Daemon::manager() {
1723- Q_D(Daemon);
1724- return d->manager();
1725-}
1726-
1727-} // Daemon
1728-
1729-} // DownloadManager
1730+BaseDaemon::selfSignedCerts() {
1731+ return _certs;
1732+}
1733+
1734+void
1735+BaseDaemon::setSelfSignedCerts(QList<QSslCertificate> certs) {
1736+ _certs = certs;
1737+}
1738+
1739+void
1740+BaseDaemon::start(const QString& path) {
1741+ TRACE;
1742+ _path = path;
1743+ _managerAdaptor = _adaptorFactory->createAdaptor(_manager);
1744+ bool ret = _conn->registerService(_path);
1745+ if (ret) {
1746+ LOG(INFO) << "Service registered to" << _path;
1747+ ret = _conn->registerObject("/", _manager);
1748+ if (!ret) {
1749+ LOG(ERROR) << "Could not register interface. DBus Error =>"
1750+ << _conn->connection().lastError();
1751+ _app->exit(-1);
1752+ }
1753+ return;
1754+ }
1755+ LOG(ERROR) << "Could not register service. DBus Error =>"
1756+ << _conn->connection().lastError();
1757+ _app->exit(-1);
1758+}
1759+
1760+void
1761+BaseDaemon::stop() {
1762+ // stop listening in the service
1763+ bool ret = _conn->unregisterService(_path);
1764+ if (!ret) {
1765+ qCritical() << "Could not unregister service at" << _path;
1766+ }
1767+}
1768+
1769+BaseManager*
1770+BaseDaemon::manager() {
1771+ return _manager;
1772+}
1773+
1774+void
1775+BaseDaemon::onTimeout() {
1776+ LOG(INFO) << "Timeout reached, shutdown service.";
1777+ _app->exit(0);
1778+}
1779+
1780+void
1781+BaseDaemon::onDownloadManagerSizeChanged(int size) {
1782+ TRACE << size;
1783+ bool isActive = _shutDownTimer->isActive();
1784+
1785+ if (isActive && size > 0) {
1786+ LOG(INFO) << "Timer must be stopped because we have " << size
1787+ << "downloads.";
1788+ _shutDownTimer->stop();
1789+ }
1790+ if (!isActive && size == 0) {
1791+ LOG(INFO) << "Timer must be started because we have 0 downloads.";
1792+ _shutDownTimer->start(DEFAULT_TIMEOUT);
1793+ }
1794+}
1795+
1796+void
1797+BaseDaemon::parseCommandLine() {
1798+ QStringList args = _app->arguments();
1799+ int index;
1800+
1801+ // set logging
1802+ if (args.contains(LOG_DIR)) {
1803+ index = args.indexOf(LOG_DIR);
1804+ if (args.count() > index + 1) {
1805+ auto logPath = args[index + 1];
1806+ Logger::setupLogging(logPath);
1807+ LOG(INFO) << "Log path is" << logPath;
1808+ } else {
1809+ LOG(ERROR) << "Missing log dir path.";
1810+ Logger::setupLogging();
1811+ }
1812+ } else {
1813+ Logger::setupLogging();
1814+ }
1815+
1816+ if (args.contains(SELFSIGNED_CERT)) {
1817+ index = args.indexOf(SELFSIGNED_CERT);
1818+ if (args.count() > index + 1) {
1819+ QString certsRegex = args[index + 1];
1820+ _certs = QSslCertificate::fromPath(certsRegex);
1821+ LOG(INFO) << "Accepting self signed certs at path"
1822+ << certsRegex;
1823+ } else {
1824+ LOG(ERROR) << "Missing certs path.";
1825+ }
1826+ } // certs
1827+ _isTimeoutEnabled = !args.contains(DISABLE_TIMEOUT);
1828+ LOG(INFO) << "Timeout is enabled: " << _isTimeoutEnabled;
1829+ _stoppable = args.contains(STOPPABLE);
1830+ LOG(INFO) << "Daemon is stoppable: " << _stoppable;
1831+}
1832+
1833+void
1834+BaseDaemon::init() {
1835+ // parse command line to decide if the timer is enabled and if
1836+ // we accept self signed certs
1837+ parseCommandLine();
1838+ if (_isTimeoutEnabled) {
1839+ CHECK(connect(_shutDownTimer, &Timer::timeout,
1840+ this, &BaseDaemon::onTimeout))
1841+ << "Could not connect to signal";
1842+ _shutDownTimer->start(DEFAULT_TIMEOUT);
1843+ }
1844+
1845+ _manager = _managerFactory->createManager(
1846+ _app, _conn, _stoppable, this);
1847+
1848+ _manager->setAcceptedCertificates(_certs);
1849+ // connect to the download manager changes
1850+ CHECK(connect(_manager,
1851+ &BaseManager::sizeChanged,
1852+ this, &BaseDaemon::onDownloadManagerSizeChanged))
1853+ << "Could not connect to signal";
1854+}
1855+
1856+} // General
1857
1858 } // Ubuntu
1859-
1860-#include "moc_daemon.cpp"
1861
1862=== renamed file 'ubuntu-download-manager-priv/downloads/daemon.h' => 'src/common/priv/ubuntu/transfers/base_daemon.h'
1863--- ubuntu-download-manager-priv/downloads/daemon.h 2014-02-07 10:06:24 +0000
1864+++ src/common/priv/ubuntu/transfers/base_daemon.h 2014-04-11 16:06:36 +0000
1865@@ -16,19 +16,19 @@
1866 * Boston, MA 02110-1301, USA.
1867 */
1868
1869-#ifndef DOWNLOADER_LIB_DOWNLOAD_DAEMON_H
1870-#define DOWNLOADER_LIB_DOWNLOAD_DAEMON_H
1871+#ifndef UBUNTU_GENERAL_LIB_DAEMON_H
1872+#define UBUNTU_GENERAL_LIB_DAEMON_H
1873
1874 #include <functional>
1875 #include <QObject>
1876-#include <QSslCertificate>
1877 #include <QSharedPointer>
1878-#include <ubuntu/download_manager/common.h>
1879-#include <ubuntu/download_manager/system/dbus_connection.h>
1880+#include <ubuntu/transfers/system/dbus_connection.h>
1881+
1882+class QSslCertificate;
1883
1884 namespace Ubuntu {
1885
1886-namespace DownloadManager {
1887+namespace Transfers {
1888
1889 namespace System {
1890
1891@@ -38,26 +38,27 @@
1892
1893 }
1894
1895-namespace Daemon {
1896-
1897-class Manager;
1898-class DaemonPrivate;
1899-
1900-typedef std::function<Manager*(System::Application*, System::DBusConnection*)>
1901+class BaseManager;
1902+class ManagerFactory;
1903+class AdaptorFactory;
1904+
1905+typedef std::function<BaseManager*(System::Application*, System::DBusConnection*)>
1906 ManagerConstructor;
1907
1908-class DOWNLOAD_MANAGER_EXPORT Daemon : public QObject {
1909- Q_DECLARE_PRIVATE(Daemon)
1910+class BaseDaemon : public QObject {
1911 Q_OBJECT
1912
1913 public:
1914- explicit Daemon(QObject *parent = 0);
1915- Daemon(System::Application* app,
1916+ BaseDaemon(ManagerFactory* managerFactory,
1917+ AdaptorFactory* adaptorFactory,
1918+ QObject *parent = 0);
1919+ BaseDaemon(ManagerFactory* managerFactory,
1920+ AdaptorFactory* adaptorFactory,
1921+ System::Application* app,
1922 System::DBusConnection* conn,
1923 System::Timer* timer,
1924- Manager* man,
1925 QObject *parent = 0);
1926- virtual ~Daemon();
1927+ virtual ~BaseDaemon();
1928
1929 bool isTimeoutEnabled();
1930 void enableTimeout(bool enabled);
1931@@ -69,28 +70,34 @@
1932 void setSelfSignedCerts(QList<QSslCertificate> cert);
1933
1934 public slots: // NOLINT (whitespace/indent)
1935- virtual void start(QString path="com.canonical.applications.Downloader");
1936+ virtual void start(const QString& path);
1937 void stop();
1938
1939 protected:
1940- // constructor that can be used to pass a special case of manager
1941- // this is useful when a subclass was to speciallize the manager
1942- Daemon(ManagerConstructor manConstructor, QObject* parent = 0);
1943-
1944- Manager* manager();
1945-
1946- private:
1947- Q_PRIVATE_SLOT(d_func(), void onTimeout())
1948- Q_PRIVATE_SLOT(d_func(), void onDownloadManagerSizeChanged(int)) // NOLINT (readability/function)
1949-
1950- private:
1951- // use pimpl so that we can mantains ABI compatibility
1952- DaemonPrivate* d_ptr;
1953+ BaseManager* manager();
1954+
1955+ private:
1956+ void init();
1957+ void parseCommandLine();
1958+ void onTimeout();
1959+ void onDownloadManagerSizeChanged(int);
1960+
1961+ private:
1962+ QString _path = "";
1963+ bool _isTimeoutEnabled = true;
1964+ bool _stoppable = false;
1965+ QList<QSslCertificate> _certs;
1966+ System::Application* _app = nullptr;
1967+ System::Timer* _shutDownTimer = nullptr;
1968+ System::DBusConnection* _conn = nullptr;
1969+ ManagerFactory* _managerFactory = nullptr;
1970+ AdaptorFactory* _adaptorFactory = nullptr;
1971+ BaseManager* _manager = nullptr;
1972+ QObject* _managerAdaptor = nullptr;
1973 };
1974
1975-} // Daemon
1976-
1977-} // DownloadManager
1978+} // General
1979
1980 } // Ubuntu
1981+
1982 #endif // DOWNLOADER_LIB_DOWNLOAD_DAEMON_H
1983
1984=== added file 'src/common/priv/ubuntu/transfers/base_manager.cpp'
1985--- src/common/priv/ubuntu/transfers/base_manager.cpp 1970-01-01 00:00:00 +0000
1986+++ src/common/priv/ubuntu/transfers/base_manager.cpp 2014-04-11 16:06:36 +0000
1987@@ -0,0 +1,48 @@
1988+/*
1989+ * Copyright 2014 Canonical Ltd.
1990+ *
1991+ * This library is free software; you can redistribute it and/or
1992+ * modify it under the terms of version 3 of the GNU Lesser General Public
1993+ * License as published by the Free Software Foundation.
1994+ *
1995+ * This program is distributed in the hope that it will be useful,
1996+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1997+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1998+ * General Public License for more details.
1999+ *
2000+ * You should have received a copy of the GNU Lesser General Public
2001+ * License along with this library; if not, write to the
2002+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2003+ * Boston, MA 02110-1301, USA.
2004+ */
2005+
2006+#include "base_manager.h"
2007+
2008+namespace Ubuntu {
2009+
2010+namespace Transfers {
2011+
2012+BaseManager::BaseManager(System::Application* app,
2013+ bool stoppable,
2014+ QObject *parent)
2015+ : QObject(parent),
2016+ QDBusContext(),
2017+ _app(app),
2018+ _stoppable(stoppable) {
2019+}
2020+
2021+void
2022+BaseManager::exit() {
2023+ if (_stoppable) {
2024+ _app->exit(0);
2025+ } else {
2026+ if (calledFromDBus()) {
2027+ sendErrorReply(QDBusError::NotSupported,
2028+ "Daemon should have been started with -stoppable");
2029+ } // dbus call
2030+ }
2031+}
2032+
2033+} // General
2034+
2035+} // Ubuntu
2036
2037=== added file 'src/common/priv/ubuntu/transfers/base_manager.h'
2038--- src/common/priv/ubuntu/transfers/base_manager.h 1970-01-01 00:00:00 +0000
2039+++ src/common/priv/ubuntu/transfers/base_manager.h 2014-04-11 16:06:36 +0000
2040@@ -0,0 +1,60 @@
2041+/*
2042+ * Copyright 2014 Canonical Ltd.
2043+ *
2044+ * This library is free software; you can redistribute it and/or
2045+ * modify it under the terms of version 3 of the GNU Lesser General Public
2046+ * License as published by the Free Software Foundation.
2047+ *
2048+ * This program is distributed in the hope that it will be useful,
2049+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2050+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2051+ * General Public License for more details.
2052+ *
2053+ * You should have received a copy of the GNU Lesser General Public
2054+ * License along with this library; if not, write to the
2055+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2056+ * Boston, MA 02110-1301, USA.
2057+ */
2058+
2059+#ifndef UBUNTU_GENERAL_MANAGER_H
2060+#define UBUNTU_GENERAL_MANAGER_H
2061+
2062+#include <QDBusContext>
2063+#include <QList>
2064+#include <QObject>
2065+#include <QSslCertificate>
2066+#include "ubuntu/transfers/system/application.h"
2067+
2068+namespace Ubuntu {
2069+
2070+namespace Transfers {
2071+
2072+using namespace System;
2073+
2074+class BaseManager : public QObject, public QDBusContext {
2075+ Q_OBJECT
2076+
2077+ public:
2078+ BaseManager(Application* app,
2079+ bool stopabble=false,
2080+ QObject *parent = 0);
2081+
2082+ virtual QList<QSslCertificate> acceptedCertificates() = 0;
2083+ virtual void setAcceptedCertificates(
2084+ const QList<QSslCertificate>& certs) = 0;
2085+
2086+ virtual void exit();
2087+
2088+ signals:
2089+ void sizeChanged(int count);
2090+
2091+ protected:
2092+ Application* _app = nullptr;
2093+ bool _stoppable = false;
2094+};
2095+
2096+} // General
2097+
2098+} // Ubuntu
2099+
2100+#endif // UBUNTU_GENERAL_MANAGER_H
2101
2102=== added file 'src/common/priv/ubuntu/transfers/manager_factory.h'
2103--- src/common/priv/ubuntu/transfers/manager_factory.h 1970-01-01 00:00:00 +0000
2104+++ src/common/priv/ubuntu/transfers/manager_factory.h 2014-04-11 16:06:36 +0000
2105@@ -0,0 +1,46 @@
2106+/*
2107+ * Copyright 2014 Canonical Ltd.
2108+ *
2109+ * This library is free software; you can redistribute it and/or
2110+ * modify it under the terms of version 3 of the GNU Lesser General Public
2111+ * License as published by the Free Software Foundation.
2112+ *
2113+ * This program is distributed in the hope that it will be useful,
2114+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2115+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2116+ * General Public License for more details.
2117+ *
2118+ * You should have received a copy of the GNU Lesser General Public
2119+ * License along with this library; if not, write to the
2120+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2121+ * Boston, MA 02110-1301, USA.
2122+ */
2123+
2124+#ifndef UBUNTU_GENERAL_MANAGER_FACTORY_H
2125+#define UBUNTU_GENERAL_MANAGER_FACTORY_H
2126+
2127+#include <ubuntu/transfers/system/dbus_connection.h>
2128+#include "ubuntu/transfers/system/application.h"
2129+#include "base_manager.h"
2130+
2131+namespace Ubuntu {
2132+
2133+namespace Transfers {
2134+
2135+class ManagerFactory : public QObject {
2136+ public:
2137+ explicit ManagerFactory(QObject *parent = 0)
2138+ : QObject(parent) {}
2139+
2140+ virtual BaseManager* createManager(Application* app,
2141+ DBusConnection* connection,
2142+ bool stoppable = false,
2143+ QObject *parent = 0) = 0;
2144+};
2145+
2146+} // General
2147+
2148+} // Ubuntu
2149+
2150+#endif // UBUNTU_GENERAL_MANAGER_FACTORY_H
2151+
2152
2153=== renamed file 'ubuntu-download-manager-priv/downloads/queue.cpp' => 'src/common/priv/ubuntu/transfers/queue.cpp'
2154--- ubuntu-download-manager-priv/downloads/queue.cpp 2014-02-03 17:52:16 +0000
2155+++ src/common/priv/ubuntu/transfers/queue.cpp 2014-04-11 16:06:36 +0000
2156@@ -17,58 +17,60 @@
2157 */
2158
2159 #include <QSignalMapper>
2160-#include "downloads/queue.h"
2161-#include "system/logger.h"
2162-#include "system/system_network_info.h"
2163+#include <glog/logging.h>
2164+#include "ubuntu/transfers/system/logger.h"
2165+#include "ubuntu/transfers/system/system_network_info.h"
2166+#include "queue.h"
2167
2168 namespace Ubuntu {
2169
2170-namespace DownloadManager {
2171-
2172-namespace Daemon {
2173+namespace Transfers {
2174
2175 Queue::Queue(QObject* parent)
2176 : QObject(parent),
2177 _current("") {
2178- connect(SystemNetworkInfo::instance(),
2179+ CHECK(connect(SystemNetworkInfo::instance(),
2180 &SystemNetworkInfo::currentNetworkModeChanged,
2181- this, &Queue::onCurrentNetworkModeChanged);
2182+ this, &Queue::onCurrentNetworkModeChanged))
2183+ << "Could not connect to signal";
2184 }
2185
2186 void
2187-Queue::add(Download* download) {
2188+Queue::add(Transfer* transfer) {
2189 // connect to the signals and append to the list
2190- QString path = download->path();
2191+ auto path = transfer->path();
2192 TRACE << path;
2193
2194 _sortedPaths.append(path);
2195- _downloads[path] = download;
2196+ _transfers[path] = transfer;
2197
2198- if (download->addToQueue()) {
2199- connect(download, &Download::stateChanged,
2200- this, &Queue::onManagedDownloadStateChanged);
2201+ if (transfer->addToQueue()) {
2202+ CHECK(connect(transfer, &Transfer::stateChanged,
2203+ this, &Queue::onManagedTransferStateChanged))
2204+ << "Could not connect to signal";
2205 } else {
2206- connect(download, &Download::stateChanged,
2207- this, &Queue::onUnmanagedDownloadStateChanged);
2208+ CHECK(connect(transfer, &Transfer::stateChanged,
2209+ this, &Queue::onUnmanagedTransferStateChanged))
2210+ << "Could not connect to signal";
2211 }
2212
2213- emit downloadAdded(path);
2214+ emit transferAdded(path);
2215 }
2216
2217 void
2218 Queue::remove(const QString& path) {
2219 TRACE << path;
2220
2221- Download* down = _downloads[path];
2222+ auto transfer = _transfers[path];
2223 _sortedPaths.removeOne(path);
2224- _downloads.remove(path);
2225+ _transfers.remove(path);
2226
2227- down->deleteLater();
2228- emit downloadRemoved(path);
2229+ transfer->deleteLater();
2230+ emit transferRemoved(path);
2231 }
2232
2233 QString
2234-Queue::currentDownload() {
2235+Queue::currentTransfer() {
2236 return _current;
2237 }
2238
2239@@ -77,56 +79,60 @@
2240 return _sortedPaths;
2241 }
2242
2243-QHash<QString, Download*>
2244-Queue::downloads() {
2245- QHash<QString, Download*> downloads;
2246+QHash<QString, Transfer*>
2247+Queue::transfers() {
2248+ QHash<QString, Transfer*> transfers;
2249 foreach(const QString& path, _sortedPaths) {
2250- downloads[path] = _downloads[path];
2251+ transfers[path] = _transfers[path];
2252 }
2253- return downloads;
2254+ return transfers;
2255 }
2256
2257 int
2258 Queue::size() {
2259- return _downloads.size();
2260+ return _transfers.size();
2261 }
2262
2263 void
2264-Queue::onManagedDownloadStateChanged() {
2265+Queue::onManagedTransferStateChanged() {
2266 TRACE;
2267 // get the appdownload that emited the signal and
2268 // decide what to do with it
2269- Download* down = qobject_cast<Download*>(sender());
2270- switch (down->state()) {
2271- case Download::START:
2272- // only start the download in the update method
2273- if (_current.isEmpty())
2274- updateCurrentDownload();
2275- break;
2276- case Download::PAUSE:
2277- down->pauseDownload();
2278- if (!_current.isEmpty() && _current == down->path())
2279- updateCurrentDownload();
2280- break;
2281- case Download::RESUME:
2282- // only resume the download in the update method
2283- if (_current.isEmpty())
2284- updateCurrentDownload();
2285- break;
2286- case Download::CANCEL:
2287- // cancel and remove the download
2288- down->cancelDownload();
2289- if (!_current.isEmpty() && _current == down->path())
2290- updateCurrentDownload();
2291+ auto transfer = qobject_cast<Transfer*>(sender());
2292+ qDebug() << "State changed" << transfer;
2293+ switch (transfer->state()) {
2294+ case Transfer::START:
2295+ // only start the transfer in the update method
2296+ if (_current.isEmpty())
2297+ updateCurrentTransfer();
2298+ break;
2299+ case Transfer::PAUSE:
2300+ transfer->pauseTransfer();
2301+ if (!_current.isEmpty() && _current == transfer->path())
2302+ updateCurrentTransfer();
2303+ break;
2304+ case Transfer::RESUME:
2305+ // only resume the transfer in the update method
2306+ qDebug() << "State changed to resume.";
2307+ if (_current.isEmpty()) {
2308+ qDebug() << "There is no current download present.";
2309+ updateCurrentTransfer();
2310+ }
2311+ break;
2312+ case Transfer::CANCEL:
2313+ // cancel and remove the transfer
2314+ transfer->cancelTransfer();
2315+ if (!_current.isEmpty() && _current == transfer->path())
2316+ updateCurrentTransfer();
2317 else
2318- remove(down->path());
2319+ remove(transfer->path());
2320 break;
2321- case Download::ERROR:
2322- case Download::FINISH:
2323- // remove the registered object in dbus, remove the download
2324+ case Transfer::ERROR:
2325+ case Transfer::FINISH:
2326+ // remove the registered object in dbus, remove the transfer
2327 // and the adapter from the list
2328- if (!_current.isEmpty() && _current == down->path())
2329- updateCurrentDownload();
2330+ if (!_current.isEmpty() && _current == transfer->path())
2331+ updateCurrentTransfer();
2332 break;
2333 default:
2334 // do nothing
2335@@ -135,17 +141,17 @@
2336 }
2337
2338 void
2339-Queue::onUnmanagedDownloadStateChanged() {
2340+Queue::onUnmanagedTransferStateChanged() {
2341 TRACE;
2342- // grab the download and clean it when needed
2343- Download* down = qobject_cast<Download*>(sender());
2344- switch (down->state()) {
2345- case Download::CANCEL:
2346- case Download::ERROR:
2347- case Download::FINISH:
2348- // remove the registered object in dbus, remove the download
2349+ // grab the transfer and clean it when needed
2350+ auto transfer = qobject_cast<Transfer*>(sender());
2351+ switch (transfer->state()) {
2352+ case Transfer::CANCEL:
2353+ case Transfer::ERROR:
2354+ case Transfer::FINISH:
2355+ // remove the registered object in dbus, remove the transfer
2356 // and the adapter from the list
2357- remove(down->path());
2358+ remove(transfer->path());
2359 break;
2360 default:
2361 // do nothing
2362@@ -157,44 +163,45 @@
2363 Queue::onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode) {
2364 TRACE << mode;
2365 if (mode != QNetworkInfo::UnknownMode) {
2366- updateCurrentDownload();
2367+ updateCurrentTransfer();
2368 }
2369 }
2370
2371 void
2372-Queue::updateCurrentDownload() {
2373+Queue::updateCurrentTransfer() {
2374 TRACE;
2375 if (!_current.isEmpty()) {
2376 // check if it was canceled/finished
2377- Download* currentDownload = _downloads[_current];
2378- Download::State state = currentDownload->state();
2379- if (state == Download::CANCEL || state == Download::FINISH
2380- || state == Download::ERROR) {
2381+ auto currentTransfer = _transfers[_current];
2382+ auto state = currentTransfer->state();
2383+ if (state == Transfer::CANCEL || state == Transfer::FINISH
2384+ || state == Transfer::ERROR) {
2385 LOG(INFO) << "State is CANCEL || FINISH || ERROR";
2386 remove(_current);
2387 _current = "";
2388- } else if (!currentDownload->canDownload()
2389- || state == Download::PAUSE) {
2390- LOG(INFO) << "States is Cannot Download || PAUSE";
2391+ } else if (!currentTransfer->canTransfer()
2392+ || state == Transfer::PAUSE) {
2393+ LOG(INFO) << "States is Cannot Transfer || PAUSE";
2394 _current = "";
2395 } else {
2396 return;
2397 }
2398 }
2399
2400- // loop via the downloads and choose the first that is
2401+ // loop via the transfers and choose the first that is
2402 // started or resumed
2403 foreach(const QString& path, _sortedPaths) {
2404- Download* down = _downloads[path];
2405- Download::State state = down->state();
2406- if (down->canDownload()
2407- && (state == Download::START
2408- || state == Download::RESUME)) {
2409+ auto transfer = _transfers[path];
2410+ auto state = transfer->state();
2411+ if (transfer->canTransfer()
2412+ && (state == Transfer::START
2413+ || state == Transfer::RESUME)) {
2414 _current = path;
2415- if (state == Download::START)
2416- down->startDownload();
2417+ qDebug() << _current;
2418+ if (state == Transfer::START)
2419+ transfer->startTransfer();
2420 else
2421- down->resumeDownload();
2422+ transfer->resumeTransfer();
2423 break;
2424 }
2425 }
2426@@ -202,8 +209,6 @@
2427 emit currentChanged(_current);
2428 }
2429
2430-} // Daemon
2431-
2432-} // DownloadManager
2433+} // Transfers
2434
2435 } // Ubuntu
2436
2437=== renamed file 'ubuntu-download-manager-priv/downloads/queue.h' => 'src/common/priv/ubuntu/transfers/queue.h'
2438--- ubuntu-download-manager-priv/downloads/queue.h 2014-01-29 10:47:13 +0000
2439+++ src/common/priv/ubuntu/transfers/queue.h 2014-04-11 16:06:36 +0000
2440@@ -19,56 +19,53 @@
2441 #ifndef DOWNLOADER_LIB_DOWNLOAD_QUEUE_H
2442 #define DOWNLOADER_LIB_DOWNLOAD_QUEUE_H
2443
2444+#include <QString>
2445+#include <QStringList>
2446 #include <QList>
2447 #include <QPair>
2448 #include <QSharedPointer>
2449-#include "downloads/download.h"
2450-#include "downloads/download_adaptor.h"
2451+#include "transfer.h"
2452
2453 namespace Ubuntu {
2454
2455-namespace DownloadManager {
2456+namespace Transfers {
2457
2458 using namespace System;
2459
2460-namespace Daemon {
2461-
2462 class Queue : public QObject {
2463 Q_OBJECT
2464
2465 public:
2466 explicit Queue(QObject* parent = 0);
2467
2468- virtual void add(Download* download);
2469+ virtual void add(Transfer* transfer);
2470
2471 // accessors for useful info
2472- QString currentDownload();
2473- QStringList paths();
2474- QHash<QString, Download*> downloads();
2475+ virtual QString currentTransfer();
2476+ virtual QStringList paths();
2477+ virtual QHash<QString, Transfer*> transfers();
2478 virtual int size();
2479
2480 signals:
2481 // signals raised when things happens within the q
2482 void currentChanged(QString path);
2483- void downloadAdded(QString path);
2484- void downloadRemoved(QString path);
2485+ void transferAdded(QString path);
2486+ void transferRemoved(QString path);
2487
2488 private:
2489- void onManagedDownloadStateChanged();
2490- void onUnmanagedDownloadStateChanged();
2491+ void onManagedTransferStateChanged();
2492+ void onUnmanagedTransferStateChanged();
2493 void onCurrentNetworkModeChanged(QNetworkInfo::NetworkMode mode);
2494 void remove(const QString& path);
2495- void updateCurrentDownload();
2496+ void updateCurrentTransfer();
2497
2498 private:
2499 QString _current;
2500- QHash<QString, Download*> _downloads; // quick for access
2501+ QHash<QString, Transfer*> _transfers; // quick for access
2502 QStringList _sortedPaths; // keep the order
2503 };
2504
2505-} // Daemon
2506-
2507-} // DownloadManager
2508+} // Transfers
2509
2510 } // Ubuntu
2511
2512
2513=== renamed directory 'ubuntu-download-manager-priv/system' => 'src/common/priv/ubuntu/transfers/system'
2514=== modified file 'src/common/priv/ubuntu/transfers/system/apn_proxy.cpp'
2515--- ubuntu-download-manager-priv/system/apn_proxy.cpp 2014-01-28 18:51:12 +0000
2516+++ src/common/priv/ubuntu/transfers/system/apn_proxy.cpp 2014-04-11 16:06:36 +0000
2517@@ -20,7 +20,7 @@
2518
2519 namespace Ubuntu {
2520
2521-namespace DownloadManager {
2522+namespace Transfers {
2523
2524 namespace System {
2525
2526@@ -34,8 +34,8 @@
2527 return proxy;
2528 }
2529
2530-}
2531-
2532-}
2533-
2534-}
2535+} // System
2536+
2537+} // Transfers
2538+
2539+} // Ubuntu
2540
2541=== modified file 'src/common/priv/ubuntu/transfers/system/apn_proxy.h'
2542--- ubuntu-download-manager-priv/system/apn_proxy.h 2014-01-28 18:51:12 +0000
2543+++ src/common/priv/ubuntu/transfers/system/apn_proxy.h 2014-04-11 16:06:36 +0000
2544@@ -24,7 +24,7 @@
2545
2546 namespace Ubuntu {
2547
2548-namespace DownloadManager {
2549+namespace Transfers {
2550
2551 namespace System {
2552
2553@@ -38,9 +38,9 @@
2554
2555 };
2556
2557-} // System
2558+} // System
2559
2560-} // DownloadManager
2561+} // Transfers
2562
2563 } // Ubuntu
2564 #endif // APN_PROXY_H
2565
2566=== modified file 'src/common/priv/ubuntu/transfers/system/apn_request_factory.cpp'
2567--- ubuntu-download-manager-priv/system/apn_request_factory.cpp 2014-01-29 12:11:35 +0000
2568+++ src/common/priv/ubuntu/transfers/system/apn_request_factory.cpp 2014-04-11 16:06:36 +0000
2569@@ -21,7 +21,7 @@
2570
2571 namespace Ubuntu {
2572
2573-namespace DownloadManager {
2574+namespace Transfers {
2575
2576 namespace System {
2577
2578@@ -34,6 +34,6 @@
2579
2580 } // System
2581
2582-} // DownloadManager
2583+} // Transfers
2584
2585 } // Ubuntu
2586
2587=== modified file 'src/common/priv/ubuntu/transfers/system/apn_request_factory.h'
2588--- ubuntu-download-manager-priv/system/apn_request_factory.h 2014-01-29 12:11:35 +0000
2589+++ src/common/priv/ubuntu/transfers/system/apn_request_factory.h 2014-04-11 16:06:36 +0000
2590@@ -25,7 +25,7 @@
2591
2592 namespace Ubuntu {
2593
2594-namespace DownloadManager {
2595+namespace Transfers {
2596
2597 namespace System {
2598
2599@@ -40,7 +40,7 @@
2600
2601 } // System
2602
2603-} // DownloadManager
2604+} // Transfers
2605
2606 } // Ubuntu
2607
2608
2609=== modified file 'src/common/priv/ubuntu/transfers/system/apparmor.cpp'
2610--- ubuntu-download-manager-priv/system/apparmor.cpp 2014-02-01 09:01:47 +0000
2611+++ src/common/priv/ubuntu/transfers/system/apparmor.cpp 2014-04-11 16:06:36 +0000
2612@@ -25,13 +25,13 @@
2613 #include <QDir>
2614 #include <QRegExp>
2615 #include <QStandardPaths>
2616+#include <ubuntu/transfers/system/logger.h>
2617 #include "uuid_utils.h"
2618-#include "logger.h"
2619 #include "apparmor.h"
2620
2621 namespace Ubuntu {
2622
2623-namespace DownloadManager {
2624+namespace Transfers {
2625
2626 namespace System {
2627
2628@@ -57,67 +57,30 @@
2629 delete _uuidFactory;
2630 }
2631
2632-void
2633-AppArmor::getDBusPath(QString& id, QString& dbusPath) {
2634- QUuid uuid = _uuidFactory->createUuid();
2635- id = UuidUtils::getDBusString(uuid);
2636- dbusPath = UuidUtils::getDBusString(uuid);
2637-}
2638-
2639-QString
2640-AppArmor::getSecurePath(const QString& connName,
2641- QString& dbusPath,
2642- QString& localPath,
2643- bool& isConfined) {
2644- QString id = UuidUtils::getDBusString(_uuidFactory->createUuid());
2645- getSecurePath(connName, id, dbusPath, localPath, isConfined);
2646- return id;
2647-}
2648-
2649-QString
2650-AppArmor::getLocalPath(const QString& appId) {
2651- // if the service is running as root we will always return /tmp
2652- // as the local path root
2653- if (getuid() == 0){
2654- LOG(INFO) << "Running as system bus using /tmp for downloads";
2655- return QStandardPaths::writableLocation(
2656- QStandardPaths::TempLocation);
2657- } else {
2658- QString dataPath = QStandardPaths::writableLocation(
2659- QStandardPaths::DataLocation);
2660- QStringList pathComponents;
2661- pathComponents << dataPath;
2662-
2663- if (!appId.isEmpty()) {
2664- QStringList appIdInfo = appId.split("_");
2665- if (appIdInfo.count() > 0)
2666- pathComponents << appIdInfo[0];
2667- }
2668-
2669- pathComponents << "Downloads";
2670-
2671- QString path = pathComponents.join(QDir::separator());
2672-
2673- bool wasCreated = QDir().mkpath(path);
2674- if (!wasCreated) {
2675- LOG(ERROR) << "Could not create the data path"
2676- << path;
2677- }
2678- LOG(INFO) << "Local path is" << path;
2679- return path;
2680- } // not root
2681-}
2682-
2683-void
2684-AppArmor::getSecurePath(const QString& connName,
2685- const QString& id,
2686- QString& dbusPath,
2687- QString& localPath,
2688- bool& isConfined) {
2689+SecurityDetails*
2690+AppArmor::getSecurityDetails(const QString& connName) {
2691+ auto id = UuidUtils::getDBusString(_uuidFactory->createUuid());
2692+ auto details = new SecurityDetails(id);
2693+ getSecurityDetails(connName, details);
2694+ return details;
2695+}
2696+
2697+SecurityDetails*
2698+AppArmor::getSecurityDetails(const QString& connName,
2699+ const QString& id) {
2700+
2701+ auto details = new SecurityDetails(id);
2702+ getSecurityDetails(connName, details);
2703+ return details;
2704+}
2705+
2706+void
2707+AppArmor::getSecurityDetails(const QString& connName,
2708+ SecurityDetails* details) {
2709 if (connName.isEmpty()) {
2710- dbusPath = QString(BASE_ACCOUNT_URL) + "/" + id;
2711- localPath = getLocalPath("");
2712- isConfined = false;
2713+ details->dbusPath = QString(BASE_ACCOUNT_URL) + "/" + details->id;
2714+ details->localPath = getLocalPath("");
2715+ details->isConfined = false;
2716 return;
2717 }
2718
2719@@ -127,9 +90,9 @@
2720 reply.waitForFinished();
2721 if (reply.isError()) {
2722 LOG(ERROR) << reply.error();
2723- dbusPath = QString(BASE_ACCOUNT_URL) + "/" + id;
2724- localPath = getLocalPath("");
2725- isConfined = false;
2726+ details->dbusPath = QString(BASE_ACCOUNT_URL) + "/" + details->id;
2727+ details->localPath = getLocalPath("");
2728+ details->isConfined = false;
2729 return;
2730 } else {
2731 // use the returned value
2732@@ -137,12 +100,12 @@
2733
2734 if (appId.isEmpty() || appId == UNCONFINED_ID) {
2735 LOG(INFO) << "UNCONFINED APP";
2736- dbusPath = QString(BASE_ACCOUNT_URL) + "/" + id;
2737- localPath = getLocalPath("");
2738- isConfined = false;
2739+ details->dbusPath = QString(BASE_ACCOUNT_URL) + "/" + details->id;
2740+ details->localPath = getLocalPath("");
2741+ details->isConfined = false;
2742 return;
2743 } else {
2744- isConfined = true;
2745+ details->isConfined = true;
2746 QByteArray appIdBa = appId.toUtf8();
2747
2748 char * appIdPath;
2749@@ -152,8 +115,8 @@
2750 if (appIdPath == nullptr) {
2751 LOG(ERROR) << "Unable to allocate memory for "
2752 << "nih_dbus_path()";
2753- dbusPath = QString(BASE_ACCOUNT_URL) + "/" + id;
2754- localPath = getLocalPath(appId);
2755+ details->dbusPath = QString(BASE_ACCOUNT_URL) + "/" + details->id;
2756+ details->localPath = getLocalPath(appId);
2757 return;
2758 }
2759 QString path = QString(appIdPath);
2760@@ -161,15 +124,57 @@
2761
2762 // free nih data
2763 nih_free(appIdPath);
2764- dbusPath = path + "/" + id;
2765- localPath = getLocalPath(appId);
2766+ details->dbusPath = path + "/" + details->id;
2767+ details->localPath = getLocalPath(appId);
2768 return;
2769 } // not empty appid string
2770 } // no dbus error
2771 }
2772
2773+QPair<QString, QString>
2774+AppArmor::getDBusPath() {
2775+ QUuid uuid = _uuidFactory->createUuid();
2776+ QString id = UuidUtils::getDBusString(uuid);
2777+ QString dbusPath = UuidUtils::getDBusString(uuid);
2778+ return QPair<QString, QString>(id, dbusPath);
2779+}
2780+
2781+QString
2782+AppArmor::getLocalPath(const QString& appId) {
2783+ // if the service is running as root we will always return /tmp
2784+ // as the local path root
2785+ if (getuid() == 0){
2786+ LOG(INFO) << "Running as system bus using /tmp for downloads";
2787+ return QStandardPaths::writableLocation(
2788+ QStandardPaths::TempLocation);
2789+ } else {
2790+ QString dataPath = QStandardPaths::writableLocation(
2791+ QStandardPaths::DataLocation);
2792+ QStringList pathComponents;
2793+ pathComponents << dataPath;
2794+
2795+ if (!appId.isEmpty()) {
2796+ QStringList appIdInfo = appId.split("_");
2797+ if (appIdInfo.count() > 0)
2798+ pathComponents << appIdInfo[0];
2799+ }
2800+
2801+ pathComponents << "Downloads";
2802+
2803+ QString path = pathComponents.join(QDir::separator());
2804+
2805+ bool wasCreated = QDir().mkpath(path);
2806+ if (!wasCreated) {
2807+ LOG(ERROR) << "Could not create the data path"
2808+ << path;
2809+ }
2810+ LOG(INFO) << "Local path is" << path;
2811+ return path;
2812+ } // not root
2813+}
2814+
2815 } // System
2816
2817-} // DownloadManager
2818+} // Transfers
2819
2820 } // Ubuntu
2821
2822=== modified file 'src/common/priv/ubuntu/transfers/system/apparmor.h'
2823--- ubuntu-download-manager-priv/system/apparmor.h 2014-01-10 16:38:56 +0000
2824+++ src/common/priv/ubuntu/transfers/system/apparmor.h 2014-04-11 16:06:36 +0000
2825@@ -23,17 +23,27 @@
2826 #include <QPair>
2827 #include <QString>
2828 #include <QSharedPointer>
2829-#include <ubuntu/download_manager/system/dbus_connection.h>
2830+#include <ubuntu/transfers/system/dbus_connection.h>
2831 #include "dbus_proxy.h"
2832 #include "uuid_factory.h"
2833
2834
2835 namespace Ubuntu {
2836
2837-namespace DownloadManager {
2838+namespace Transfers {
2839
2840 namespace System {
2841
2842+struct SecurityDetails {
2843+ public:
2844+ SecurityDetails() = default;
2845+ SecurityDetails(const QString& requiredId) { id = requiredId; }
2846+ QString id;
2847+ QString dbusPath;
2848+ QString localPath;
2849+ bool isConfined = false;
2850+};
2851+
2852 class AppArmor : public QObject {
2853 Q_OBJECT
2854
2855@@ -42,18 +52,15 @@
2856 AppArmor(QSharedPointer<DBusConnection> connection, QObject *parent = 0);
2857 ~AppArmor();
2858
2859- virtual void getDBusPath(QString& id, QString& dbusPath);
2860-
2861- virtual QString getSecurePath(const QString& connName,
2862- QString& dbusPath,
2863- QString& localPath,
2864- bool& isConfined);
2865- virtual void getSecurePath(const QString& connName,
2866- const QString& id,
2867- QString& dbusPath,
2868- QString& localPath,
2869- bool& isConfined);
2870+ virtual QPair<QString, QString> getDBusPath();
2871+
2872+ virtual SecurityDetails* getSecurityDetails(const QString& connName);
2873+ virtual SecurityDetails* getSecurityDetails(const QString& connName,
2874+ const QString& id);
2875+
2876 private:
2877+ void getSecurityDetails(const QString& connName,
2878+ SecurityDetails* details);
2879 QString getLocalPath(const QString& appId);
2880
2881 private:
2882@@ -66,7 +73,7 @@
2883
2884 } // System
2885
2886-} // DownloadManager
2887+} // Transfers
2888
2889 } // Ubuntu
2890
2891
2892=== modified file 'src/common/priv/ubuntu/transfers/system/application.cpp'
2893--- ubuntu-download-manager-priv/system/application.cpp 2014-01-20 16:54:58 +0000
2894+++ src/common/priv/ubuntu/transfers/system/application.cpp 2014-04-11 16:06:36 +0000
2895@@ -21,11 +21,10 @@
2896
2897 namespace Ubuntu {
2898
2899-namespace DownloadManager {
2900+namespace Transfers {
2901
2902 namespace System {
2903
2904-
2905 Application::Application(QObject* parent)
2906 : QObject(parent) {
2907 }
2908@@ -44,6 +43,6 @@
2909
2910 } // System
2911
2912-} // DownloadManager
2913+} // Transfers
2914
2915 } // Ubuntu
2916
2917=== modified file 'src/common/priv/ubuntu/transfers/system/application.h'
2918--- ubuntu-download-manager-priv/system/application.h 2014-01-16 15:42:53 +0000
2919+++ src/common/priv/ubuntu/transfers/system/application.h 2014-04-11 16:06:36 +0000
2920@@ -24,7 +24,7 @@
2921
2922 namespace Ubuntu {
2923
2924-namespace DownloadManager {
2925+namespace Transfers {
2926
2927 namespace System {
2928
2929@@ -40,7 +40,7 @@
2930
2931 } // System
2932
2933-} // DownloadManager
2934+} // Transfers
2935
2936 } // Ubuntu
2937
2938
2939=== added file 'src/common/priv/ubuntu/transfers/system/cryptographic_hash.cpp'
2940--- src/common/priv/ubuntu/transfers/system/cryptographic_hash.cpp 1970-01-01 00:00:00 +0000
2941+++ src/common/priv/ubuntu/transfers/system/cryptographic_hash.cpp 2014-04-11 16:06:36 +0000
2942@@ -0,0 +1,92 @@
2943+/*
2944+ * Copyright 2014 Canonical Ltd.
2945+ *
2946+ * This library is free software; you can redistribute it and/or
2947+ * modify it under the terms of version 3 of the GNU Lesser General Public
2948+ * License as published by the Free Software Foundation.
2949+ *
2950+ * This program is distributed in the hope that it will be useful,
2951+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2952+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2953+ * General Public License for more details.
2954+ *
2955+ * You should have received a copy of the GNU Lesser General Public
2956+ * License along with this library; if not, write to the
2957+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2958+ * Boston, MA 02110-1301, USA.
2959+ */
2960+
2961+#include "cryptographic_hash.h"
2962+
2963+namespace Ubuntu {
2964+
2965+namespace Transfers {
2966+
2967+namespace System {
2968+
2969+CryptographicHashFactory* CryptographicHashFactory::_instance = nullptr;
2970+QMutex CryptographicHashFactory::_mutex;
2971+
2972+CryptographicHash::CryptographicHash(QCryptographicHash::Algorithm method,
2973+ QObject* parent)
2974+ : QObject(parent),
2975+ _hash(method) {
2976+}
2977+
2978+
2979+bool
2980+CryptographicHash::addData(QIODevice * device) {
2981+ return _hash.addData(device);
2982+}
2983+
2984+QByteArray
2985+CryptographicHash::result() const {
2986+ return _hash.result();
2987+}
2988+
2989+
2990+CryptographicHashFactory::CryptographicHashFactory(QObject* parent)
2991+ : QObject(parent) {
2992+}
2993+
2994+CryptographicHash*
2995+CryptographicHashFactory::createCryptographicHash(
2996+ QCryptographicHash::Algorithm method,
2997+ QObject* parent) {
2998+ return new CryptographicHash(method, parent);
2999+}
3000+
3001+CryptographicHashFactory*
3002+CryptographicHashFactory::instance() {
3003+ if(_instance == nullptr) {
3004+ _mutex.lock();
3005+ if(_instance == nullptr)
3006+ _instance = new CryptographicHashFactory();
3007+ _mutex.unlock();
3008+ }
3009+ return _instance;
3010+}
3011+
3012+// only used for testing purposes
3013+void
3014+CryptographicHashFactory::setInstance(CryptographicHashFactory* instance) {
3015+ _instance = instance;
3016+}
3017+
3018+void
3019+CryptographicHashFactory::deleteInstance() {
3020+ if(_instance != nullptr) {
3021+ _mutex.lock();
3022+ if(_instance != nullptr) {
3023+ delete _instance;
3024+ _instance = nullptr;
3025+ }
3026+ _mutex.unlock();
3027+ }
3028+}
3029+
3030+} // System
3031+
3032+} // Transfers
3033+
3034+} // Ubuntu
3035
3036=== added file 'src/common/priv/ubuntu/transfers/system/cryptographic_hash.h'
3037--- src/common/priv/ubuntu/transfers/system/cryptographic_hash.h 1970-01-01 00:00:00 +0000
3038+++ src/common/priv/ubuntu/transfers/system/cryptographic_hash.h 2014-04-11 16:06:36 +0000
3039@@ -0,0 +1,71 @@
3040+/*
3041+ * Copyright 2014 Canonical Ltd.
3042+ *
3043+ * This library is free software; you can redistribute it and/or
3044+ * modify it under the terms of version 3 of the GNU Lesser General Public
3045+ * License as published by the Free Software Foundation.
3046+ *
3047+ * This program is distributed in the hope that it will be useful,
3048+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3049+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3050+ * General Public License for more details.
3051+ *
3052+ * You should have received a copy of the GNU Lesser General Public
3053+ * License along with this library; if not, write to the
3054+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
3055+ * Boston, MA 02110-1301, USA.
3056+ */
3057+
3058+#ifndef DOWNLOADER_LIB_CRYPTOGRAPHIC_HASH_H
3059+#define DOWNLOADER_LIB_CRYPTOGRAPHIC_HASH_H
3060+
3061+#include <QByteArray>
3062+#include <QCryptographicHash>
3063+#include <QMutex>
3064+#include <QIODevice>
3065+
3066+namespace Ubuntu {
3067+
3068+namespace Transfers {
3069+
3070+namespace System {
3071+
3072+class CryptographicHash : public QObject {
3073+
3074+ public:
3075+ CryptographicHash(QCryptographicHash::Algorithm method,
3076+ QObject* parent = 0);
3077+ virtual bool addData(QIODevice* device);
3078+ virtual QByteArray result() const;
3079+
3080+ private:
3081+ QCryptographicHash _hash;
3082+};
3083+
3084+class CryptographicHashFactory : public QObject {
3085+
3086+ public:
3087+ explicit CryptographicHashFactory(QObject* parent = 0);
3088+ virtual CryptographicHash* createCryptographicHash(
3089+ QCryptographicHash::Algorithm method,
3090+ QObject* parent = 0);
3091+
3092+ static CryptographicHashFactory* instance();
3093+
3094+ // only used for testing purposes
3095+ static void setInstance(CryptographicHashFactory* instance);
3096+ static void deleteInstance();
3097+
3098+ private:
3099+ static CryptographicHashFactory* _instance;
3100+ static QMutex _mutex;
3101+
3102+};
3103+
3104+} // System
3105+
3106+} // Transfers
3107+
3108+} // Ubuntu
3109+
3110+#endif
3111
3112=== modified file 'src/common/priv/ubuntu/transfers/system/dbus_proxy.h'
3113--- ubuntu-download-manager-priv/system/dbus_proxy.h 2013-11-12 12:30:18 +0000
3114+++ src/common/priv/ubuntu/transfers/system/dbus_proxy.h 2014-04-11 16:06:36 +0000
3115@@ -19,7 +19,8 @@
3116 #include <QtCore/QStringList>
3117 #include <QtCore/QVariant>
3118 #include <QtDBus/QtDBus>
3119-#include <ubuntu/download_manager/metatypes.h>
3120+
3121+typedef QMap<QString, QString> StringMap;
3122
3123 /*
3124 * Proxy class for interface org.freedesktop.DBus
3125
3126=== modified file 'src/common/priv/ubuntu/transfers/system/file_manager.cpp'
3127--- ubuntu-download-manager-priv/system/file_manager.cpp 2014-02-18 18:43:25 +0000
3128+++ src/common/priv/ubuntu/transfers/system/file_manager.cpp 2014-04-11 16:06:36 +0000
3129@@ -17,11 +17,12 @@
3130 */
3131
3132 #include <QFile>
3133+#include <QTemporaryFile>
3134 #include "file_manager.h"
3135
3136 namespace Ubuntu {
3137
3138-namespace DownloadManager {
3139+namespace Transfers {
3140
3141 namespace System {
3142
3143@@ -29,6 +30,10 @@
3144 _file = new QFile(name);
3145 }
3146
3147+File::File(QFile* file)
3148+ : _file(file) {
3149+}
3150+
3151 File::~File() {
3152 delete _file;
3153 }
3154@@ -97,6 +102,16 @@
3155 return new File(name);
3156 }
3157
3158+File*
3159+FileManager::copyToTempFile(const QString& name) {
3160+ // create a temp file, and copy the old name to the
3161+ // new file path
3162+ auto tempFile = new QTemporaryFile();
3163+ QFile file(name);
3164+ file.copy(tempFile->fileName());
3165+ return new File(tempFile);
3166+}
3167+
3168 bool
3169 FileManager::remove(const QString& path) {
3170 return QFile::remove(path);
3171@@ -139,6 +154,6 @@
3172
3173 } // System
3174
3175-} // DownloadManager
3176+} // Transfers
3177
3178 } // Ubuntu
3179
3180=== modified file 'src/common/priv/ubuntu/transfers/system/file_manager.h'
3181--- ubuntu-download-manager-priv/system/file_manager.h 2014-02-18 18:43:25 +0000
3182+++ src/common/priv/ubuntu/transfers/system/file_manager.h 2014-04-11 16:06:36 +0000
3183@@ -26,7 +26,7 @@
3184
3185 namespace Ubuntu {
3186
3187-namespace DownloadManager {
3188+namespace Transfers {
3189
3190 namespace System {
3191
3192@@ -39,20 +39,21 @@
3193 virtual ~File();
3194
3195 // wrappers around the used QFile methods
3196- void close();
3197+ virtual void close();
3198 virtual QFile::FileError error() const; // virtual for testing purposes
3199- QString fileName() const;
3200+ virtual QString fileName() const;
3201 virtual bool flush(); // virtual for testing purposes
3202- bool open(QIODevice::OpenMode mode);
3203- QByteArray readAll();
3204- bool remove();
3205- bool reset();
3206- qint64 size() const;
3207- qint64 write(const QByteArray& byteArray);
3208- QIODevice* device();
3209+ virtual bool open(QIODevice::OpenMode mode);
3210+ virtual QByteArray readAll();
3211+ virtual bool remove();
3212+ virtual bool reset();
3213+ virtual qint64 size() const;
3214+ virtual qint64 write(const QByteArray& byteArray);
3215+ virtual QIODevice* device();
3216
3217 protected:
3218 explicit File(const QString& name);
3219+ explicit File(QFile* file);
3220
3221 private:
3222 QFile* _file = nullptr;
3223@@ -64,6 +65,7 @@
3224
3225 public:
3226 virtual File* createFile(const QString& name);
3227+ virtual File* copyToTempFile(const QString& name);
3228 virtual bool remove(const QString& path);
3229 virtual bool exists(const QString& path);
3230 virtual bool rename(const QString& oldName, const QString& newName);
3231@@ -86,7 +88,7 @@
3232
3233 } // System
3234
3235-} // DownloadManager
3236+} // Transfers
3237
3238 } // Ubuntu
3239
3240
3241=== modified file 'src/common/priv/ubuntu/transfers/system/filename_mutex.cpp'
3242--- ubuntu-download-manager-priv/system/filename_mutex.cpp 2014-03-03 17:07:20 +0000
3243+++ src/common/priv/ubuntu/transfers/system/filename_mutex.cpp 2014-04-11 16:06:36 +0000
3244@@ -18,13 +18,13 @@
3245
3246 #include <QFile>
3247 #include <QFileInfo>
3248-#include <ubuntu/download_manager/metadata.h>
3249-#include "logger.h"
3250+#include <ubuntu/transfers/metadata.h>
3251+#include <ubuntu/transfers/system/logger.h>
3252 #include "filename_mutex.h"
3253
3254 namespace Ubuntu {
3255
3256-namespace DownloadManager {
3257+namespace Transfers {
3258
3259 namespace System {
3260
3261@@ -128,6 +128,6 @@
3262
3263 } // System
3264
3265-} // DownloadManager
3266+} // Transfers
3267
3268 } // Ubuntu
3269
3270=== modified file 'src/common/priv/ubuntu/transfers/system/filename_mutex.h'
3271--- ubuntu-download-manager-priv/system/filename_mutex.h 2014-02-22 10:41:59 +0000
3272+++ src/common/priv/ubuntu/transfers/system/filename_mutex.h 2014-04-11 16:06:36 +0000
3273@@ -26,7 +26,7 @@
3274
3275 namespace Ubuntu {
3276
3277-namespace DownloadManager {
3278+namespace Transfers {
3279
3280 namespace System {
3281
3282@@ -57,7 +57,7 @@
3283
3284 } // System
3285
3286-} // DownloadManager
3287+} // Transfers
3288
3289 } // Ubuntu
3290
3291
3292=== modified file 'src/common/priv/ubuntu/transfers/system/network_reply.cpp'
3293--- ubuntu-download-manager-priv/system/network_reply.cpp 2014-03-18 11:22:26 +0000
3294+++ src/common/priv/ubuntu/transfers/system/network_reply.cpp 2014-04-11 16:06:36 +0000
3295@@ -16,12 +16,13 @@
3296 * Boston, MA 02110-1301, USA.
3297 */
3298
3299+#include <ubuntu/transfers/system/logger.h>
3300+#include <glog/logging.h>
3301 #include "network_reply.h"
3302-#include "logger.h"
3303
3304 namespace Ubuntu {
3305
3306-namespace DownloadManager {
3307+namespace Transfers {
3308
3309 namespace System {
3310
3311@@ -30,16 +31,23 @@
3312 _reply(reply) {
3313 // connect to all the signals so that we forward them
3314 if (_reply != nullptr) {
3315- connect(_reply, &QNetworkReply::downloadProgress,
3316- this, &NetworkReply::downloadProgress);
3317- connect(_reply, &QNetworkReply::finished,
3318- this, &NetworkReply::finished);
3319- connect(_reply, &QNetworkReply::sslErrors,
3320- this, &NetworkReply::sslErrors);
3321+ CHECK(connect(_reply, &QNetworkReply::downloadProgress,
3322+ this, &NetworkReply::downloadProgress))
3323+ << "Could not connect to signal";
3324+ CHECK(connect(_reply, &QNetworkReply::uploadProgress,
3325+ this, &NetworkReply::uploadProgress))
3326+ << "Could not connect to signal";
3327+ CHECK(connect(_reply, &QNetworkReply::finished,
3328+ this, &NetworkReply::finished))
3329+ << "Could not connect to signal";
3330+ CHECK(connect(_reply, &QNetworkReply::sslErrors,
3331+ this, &NetworkReply::sslErrors))
3332+ << "Could not connect to signal";
3333 // because error is overloaded we need to help the compiler
3334- connect(_reply, static_cast<void(QNetworkReply::*)
3335+ CHECK(connect(_reply, static_cast<void(QNetworkReply::*)
3336 (QNetworkReply::NetworkError)>(&QNetworkReply::error),
3337- this, &NetworkReply::error);
3338+ this, &NetworkReply::error))
3339+ << "Could not connect to signal";
3340 }
3341 }
3342
3343@@ -113,6 +121,6 @@
3344
3345 } // System
3346
3347-} // DownloadManager
3348+} // Transfers
3349
3350 } // Ubuntu
3351
3352=== modified file 'src/common/priv/ubuntu/transfers/system/network_reply.h'
3353--- ubuntu-download-manager-priv/system/network_reply.h 2014-02-11 15:35:52 +0000
3354+++ src/common/priv/ubuntu/transfers/system/network_reply.h 2014-04-11 16:06:36 +0000
3355@@ -27,7 +27,7 @@
3356
3357 namespace Ubuntu {
3358
3359-namespace DownloadManager {
3360+namespace Transfers {
3361
3362 namespace System {
3363
3364@@ -49,6 +49,7 @@
3365 signals:
3366 // signals forwarded from the real reply object
3367 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
3368+ void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
3369 void error(QNetworkReply::NetworkError code);
3370 void finished();
3371 void sslErrors(const QList<QSslError>& errors);
3372@@ -61,7 +62,7 @@
3373
3374 } // System
3375
3376-} // DownloadManager
3377+} // Transfers
3378
3379 } // Ubuntu
3380
3381
3382=== modified file 'src/common/priv/ubuntu/transfers/system/process.cpp'
3383--- ubuntu-download-manager-priv/system/process.cpp 2014-01-29 14:40:16 +0000
3384+++ src/common/priv/ubuntu/transfers/system/process.cpp 2014-04-11 16:06:36 +0000
3385@@ -17,34 +17,38 @@
3386 */
3387
3388 #include <QProcess>
3389+#include <glog/logging.h>
3390+#include <ubuntu/transfers/system/logger.h>
3391 #include "process.h"
3392-#include "logger.h"
3393
3394 namespace Ubuntu {
3395
3396-namespace DownloadManager {
3397+namespace Transfers {
3398
3399 namespace System {
3400
3401-
3402 Process::Process(QObject* parent)
3403 : QObject(parent) {
3404 _process = new QProcess(this);
3405 _process->setProcessChannelMode(QProcess::SeparateChannels);
3406
3407 // connect so that we foward the signals
3408- connect(_process, static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>
3409- (&QProcess::finished),
3410- this, &Process::finished);
3411- connect(_process, static_cast<void(QProcess::*)(QProcess::ProcessError)>
3412- (&QProcess::error),
3413- this, &Process::error);
3414+ CHECK(connect(_process,
3415+ static_cast<void(QProcess::*)(int, QProcess::ExitStatus)>
3416+ (&QProcess::finished), this, &Process::finished))
3417+ << "Could not connect to signal";
3418+ CHECK(connect(_process,
3419+ static_cast<void(QProcess::*)(QProcess::ProcessError)>
3420+ (&QProcess::error), this, &Process::error))
3421+ << "Could not connect to signal";
3422
3423 // connect so that we can log the stdout and stderr of the process
3424- connect(_process, &QProcess::readyReadStandardError,
3425- this, &Process::onReadyReadStandardError);
3426- connect(_process, &QProcess::readyReadStandardOutput,
3427- this, &Process::onReadyReadStandardOutput);
3428+ CHECK(connect(_process, &QProcess::readyReadStandardError,
3429+ this, &Process::onReadyReadStandardError))
3430+ << "Could not connect to signal";
3431+ CHECK(connect(_process, &QProcess::readyReadStandardOutput,
3432+ this, &Process::onReadyReadStandardOutput))
3433+ << "Could not connect to signal";
3434 }
3435
3436 void
3437@@ -87,6 +91,6 @@
3438
3439 } // System
3440
3441-} // DownloadManager
3442+} // Transfers
3443
3444 } // Ubuntu
3445
3446=== modified file 'src/common/priv/ubuntu/transfers/system/process.h'
3447--- ubuntu-download-manager-priv/system/process.h 2014-01-29 14:40:16 +0000
3448+++ src/common/priv/ubuntu/transfers/system/process.h 2014-04-11 16:06:36 +0000
3449@@ -24,7 +24,7 @@
3450
3451 namespace Ubuntu {
3452
3453-namespace DownloadManager {
3454+namespace Transfers {
3455
3456 namespace System {
3457
3458@@ -57,7 +57,7 @@
3459
3460 } // System
3461
3462-} // DownloadManager
3463+} // Transfers
3464
3465 } // Ubuntu
3466
3467
3468=== modified file 'src/common/priv/ubuntu/transfers/system/process_factory.cpp'
3469--- ubuntu-download-manager-priv/system/process_factory.cpp 2014-02-01 09:01:47 +0000
3470+++ src/common/priv/ubuntu/transfers/system/process_factory.cpp 2014-04-11 16:06:36 +0000
3471@@ -20,7 +20,7 @@
3472
3473 namespace Ubuntu {
3474
3475-namespace DownloadManager {
3476+namespace Transfers {
3477
3478 namespace System {
3479
3480@@ -66,6 +66,6 @@
3481
3482 } // System
3483
3484-} // DownloadManager
3485+} // Transfers
3486
3487 } // Ubuntu
3488
3489=== modified file 'src/common/priv/ubuntu/transfers/system/process_factory.h'
3490--- ubuntu-download-manager-priv/system/process_factory.h 2014-01-16 15:42:53 +0000
3491+++ src/common/priv/ubuntu/transfers/system/process_factory.h 2014-04-11 16:06:36 +0000
3492@@ -25,7 +25,7 @@
3493
3494 namespace Ubuntu {
3495
3496-namespace DownloadManager {
3497+namespace Transfers {
3498
3499 namespace System {
3500
3501@@ -52,7 +52,7 @@
3502
3503 } // System
3504
3505-} // DownloadManager
3506+} // Transfers
3507
3508 } // Ubuntu
3509
3510
3511=== modified file 'src/common/priv/ubuntu/transfers/system/request_factory.cpp'
3512--- ubuntu-download-manager-priv/system/request_factory.cpp 2014-02-01 09:01:47 +0000
3513+++ src/common/priv/ubuntu/transfers/system/request_factory.cpp 2014-04-11 16:06:36 +0000
3514@@ -16,12 +16,13 @@
3515 * Boston, MA 02110-1301, USA.
3516 */
3517
3518+#include <ubuntu/transfers/system/logger.h>
3519+#include <glog/logging.h>
3520 #include "request_factory.h"
3521-#include "logger.h"
3522
3523 namespace Ubuntu {
3524
3525-namespace DownloadManager {
3526+namespace Transfers {
3527
3528 namespace System {
3529
3530@@ -36,8 +37,7 @@
3531 }
3532
3533 NetworkReply*
3534-RequestFactory::get(const QNetworkRequest& request) {
3535- QNetworkReply* qreply = _nam->get(request);
3536+RequestFactory::buildRequest(QNetworkReply* qreply) {
3537 NetworkReply* reply = new NetworkReply(qreply);
3538
3539 if (_certs.count() > 0) {
3540@@ -50,16 +50,31 @@
3541 // the connections for too long
3542 _replies.append(reply);
3543
3544- connect(reply, &NetworkReply::error,
3545- this, &RequestFactory::onError);
3546- connect(reply, &NetworkReply::finished,
3547- this, &RequestFactory::onFinished);
3548- connect(reply, &NetworkReply::sslErrors,
3549- this, &RequestFactory::onSslErrors);
3550+ CHECK(connect(reply, &NetworkReply::error,
3551+ this, &RequestFactory::onError))
3552+ << "Could not connect to signal";
3553+ CHECK(connect(reply, &NetworkReply::finished,
3554+ this, &RequestFactory::onFinished))
3555+ << "Could not connect to signal";
3556+ CHECK(connect(reply, &NetworkReply::sslErrors,
3557+ this, &RequestFactory::onSslErrors))
3558+ << "Could not connect to signal";
3559 }
3560 return reply;
3561 }
3562
3563+NetworkReply*
3564+RequestFactory::get(const QNetworkRequest& request) {
3565+ auto qreply = _nam->get(request);
3566+ return buildRequest(qreply);
3567+}
3568+
3569+NetworkReply*
3570+RequestFactory::post(const QNetworkRequest& request, File* data) {
3571+ auto qreply = _nam->post(request, data->device());
3572+ return buildRequest(qreply);
3573+}
3574+
3575 QList<QSslCertificate>
3576 RequestFactory::acceptedCertificates() {
3577 return _certs;
3578@@ -155,6 +170,6 @@
3579
3580 } // System
3581
3582-} // DownloadManager
3583+} // Transfers
3584
3585 } // Ubuntu
3586
3587=== modified file 'src/common/priv/ubuntu/transfers/system/request_factory.h'
3588--- ubuntu-download-manager-priv/system/request_factory.h 2014-02-07 10:06:24 +0000
3589+++ src/common/priv/ubuntu/transfers/system/request_factory.h 2014-04-11 16:06:36 +0000
3590@@ -25,11 +25,12 @@
3591 #include <QObject>
3592 #include <QSslCertificate>
3593 #include <QSslError>
3594+#include <ubuntu/transfers/system/file_manager.h>
3595 #include "network_reply.h"
3596
3597 namespace Ubuntu {
3598
3599-namespace DownloadManager {
3600+namespace Transfers {
3601
3602 namespace System {
3603
3604@@ -38,6 +39,7 @@
3605
3606 public:
3607 virtual NetworkReply* get(const QNetworkRequest& request);
3608+ virtual NetworkReply* post(const QNetworkRequest& request, File* data);
3609
3610 // mainly for testing purposes
3611 virtual QList<QSslCertificate> acceptedCertificates();
3612@@ -55,6 +57,7 @@
3613
3614 private:
3615 void removeNetworkReply(NetworkReply* reply);
3616+ NetworkReply* buildRequest(QNetworkReply* qreply);
3617
3618 private slots:
3619 void onError(QNetworkReply::NetworkError);
3620@@ -78,7 +81,7 @@
3621
3622 } // System
3623
3624-} // DownloadManager
3625+} // Transfers
3626
3627 } // Ubuntu
3628
3629
3630=== modified file 'src/common/priv/ubuntu/transfers/system/system_network_info.cpp'
3631--- ubuntu-download-manager-priv/system/system_network_info.cpp 2014-02-01 09:01:47 +0000
3632+++ src/common/priv/ubuntu/transfers/system/system_network_info.cpp 2014-04-11 16:06:36 +0000
3633@@ -18,12 +18,13 @@
3634
3635 #include <QNetworkConfigurationManager>
3636 #include <QNetworkSession>
3637-#include "logger.h"
3638+#include <glog/logging.h>
3639+#include <ubuntu/transfers/system/logger.h>
3640 #include "system_network_info.h"
3641
3642 namespace Ubuntu {
3643
3644-namespace DownloadManager {
3645+namespace Transfers {
3646
3647 namespace System {
3648
3649@@ -37,56 +38,78 @@
3650
3651 #ifdef DEBUG
3652 // in debug do log the changes else just fwd them
3653- connect(_info, &QNetworkInfo::cellIdChanged, this,
3654- &SystemNetworkInfo::onCellIdChanged);
3655- connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged, this,
3656- &SystemNetworkInfo::onCurrentCellDataTechnologyChanged);
3657- connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
3658- &SystemNetworkInfo::onCurrentMobileCountryCodeChanged);
3659- connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
3660- &SystemNetworkInfo::onCurrentMobileNetworkCodeChanged);
3661- connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
3662- &SystemNetworkInfo::onCurrentNetworkModeChanged);
3663- connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
3664- &SystemNetworkInfo::onLocationAreaCodeChanged);
3665- connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
3666- &SystemNetworkInfo::onNetworkInterfaceCountChanged);
3667- connect(_info, &QNetworkInfo::networkNameChanged, this,
3668- &SystemNetworkInfo::onNetworkNameChanged);
3669- connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
3670- &SystemNetworkInfo::onNetworkSignalStrengthChanged);
3671- connect(_info, &QNetworkInfo::networkStatusChanged, this,
3672- &SystemNetworkInfo::onNetworkStatusChanged);
3673+ CHECK(connect(_info, &QNetworkInfo::cellIdChanged, this,
3674+ &SystemNetworkInfo::onCellIdChanged))
3675+ << "Could not connect to signal";
3676+ CHECK(connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged,
3677+ this, &SystemNetworkInfo::onCurrentCellDataTechnologyChanged))
3678+ << "Could not connect to signal";
3679+ CHECK(connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
3680+ &SystemNetworkInfo::onCurrentMobileCountryCodeChanged))
3681+ << "Could not connect to signal";
3682+ CHECK(connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
3683+ &SystemNetworkInfo::onCurrentMobileNetworkCodeChanged))
3684+ << "Could not connect to signal";
3685+ CHECK(connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
3686+ &SystemNetworkInfo::onCurrentNetworkModeChanged))
3687+ << "Could not connect to signal";
3688+ CHECK(connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
3689+ &SystemNetworkInfo::onLocationAreaCodeChanged))
3690+ << "Could not connect to signal";
3691+ CHECK(connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
3692+ &SystemNetworkInfo::onNetworkInterfaceCountChanged))
3693+ << "Could not connect to signal";
3694+ CHECK(connect(_info, &QNetworkInfo::networkNameChanged, this,
3695+ &SystemNetworkInfo::onNetworkNameChanged))
3696+ << "Could not connect to signal";
3697+ CHECK(connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
3698+ &SystemNetworkInfo::onNetworkSignalStrengthChanged))
3699+ << "Could not connect to signal";
3700+ CHECK(connect(_info, &QNetworkInfo::networkStatusChanged, this,
3701+ &SystemNetworkInfo::onNetworkStatusChanged))
3702+ << "Could not connect to signal";
3703
3704- connect(_configMan,
3705+ CHECK(connect(_configMan,
3706 &QNetworkConfigurationManager::onlineStateChanged, this,
3707- &SystemNetworkInfo::onOnlineStateChanged);
3708+ &SystemNetworkInfo::onOnlineStateChanged))
3709+ << "Could not connect to signal";
3710 #else
3711 // connect to interesting signals
3712- connect(_info, &QNetworkInfo::cellIdChanged, this,
3713- &SystemNetworkInfo::cellIdChanged);
3714- connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged, this,
3715- &SystemNetworkInfo::currentCellDataTechnologyChanged);
3716- connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
3717- &SystemNetworkInfo::currentMobileCountryCodeChanged);
3718- connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
3719- &SystemNetworkInfo::currentMobileNetworkCodeChanged);
3720- connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
3721- &SystemNetworkInfo::currentNetworkModeChanged);
3722- connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
3723- &SystemNetworkInfo::locationAreaCodeChanged);
3724- connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
3725- &SystemNetworkInfo::networkInterfaceCountChanged);
3726- connect(_info, &QNetworkInfo::networkNameChanged, this,
3727- &SystemNetworkInfo::networkNameChanged);
3728- connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
3729- &SystemNetworkInfo::networkSignalStrengthChanged);
3730- connect(_info, &QNetworkInfo::networkStatusChanged, this,
3731- &SystemNetworkInfo::networkStatusChanged);
3732+ CHECK(connect(_info, &QNetworkInfo::cellIdChanged, this,
3733+ &SystemNetworkInfo::cellIdChanged))
3734+ << "Could not connect to signal";
3735+ CHECK(connect(_info, &QNetworkInfo::currentCellDataTechnologyChanged,
3736+ this, &SystemNetworkInfo::currentCellDataTechnologyChanged))
3737+ << "Could not connect to signal";
3738+ CHECK(connect(_info, &QNetworkInfo::currentMobileCountryCodeChanged, this,
3739+ &SystemNetworkInfo::currentMobileCountryCodeChanged))
3740+ << "Could not connect to signal";
3741+ CHECK(connect(_info, &QNetworkInfo::currentMobileNetworkCodeChanged, this,
3742+ &SystemNetworkInfo::currentMobileNetworkCodeChanged))
3743+ << "Could not connect to signal";
3744+ CHECK(connect(_info, &QNetworkInfo::currentNetworkModeChanged, this,
3745+ &SystemNetworkInfo::currentNetworkModeChanged))
3746+ << "Could not connect to signal";
3747+ CHECK(connect(_info, &QNetworkInfo::locationAreaCodeChanged, this,
3748+ &SystemNetworkInfo::locationAreaCodeChanged))
3749+ << "Could not connect to signal";
3750+ CHECK(connect(_info, &QNetworkInfo::networkInterfaceCountChanged, this,
3751+ &SystemNetworkInfo::networkInterfaceCountChanged))
3752+ << "Could not connect to signal";
3753+ CHECK(connect(_info, &QNetworkInfo::networkNameChanged, this,
3754+ &SystemNetworkInfo::networkNameChanged))
3755+ << "Could not connect to signal";
3756+ CHECK(connect(_info, &QNetworkInfo::networkSignalStrengthChanged, this,
3757+ &SystemNetworkInfo::networkSignalStrengthChanged))
3758+ << "Could not connect to signal";
3759+ CHECK(connect(_info, &QNetworkInfo::networkStatusChanged, this,
3760+ &SystemNetworkInfo::networkStatusChanged))
3761+ << "Could not connect to signal";
3762
3763- connect(_configMan,
3764+ CHECK(connect(_configMan,
3765 &QNetworkConfigurationManager::onlineStateChanged, this,
3766- &SystemNetworkInfo::onlineStateChanged);
3767+ &SystemNetworkInfo::onlineStateChanged))
3768+ << "Could not connect to signal";
3769 #endif
3770
3771 }
3772@@ -209,6 +232,6 @@
3773
3774 } // System
3775
3776-} // DownloadManager
3777+} // Transfers
3778
3779 } // Ubuntu
3780
3781=== modified file 'src/common/priv/ubuntu/transfers/system/system_network_info.h'
3782--- ubuntu-download-manager-priv/system/system_network_info.h 2014-01-16 15:42:53 +0000
3783+++ src/common/priv/ubuntu/transfers/system/system_network_info.h 2014-04-11 16:06:36 +0000
3784@@ -28,7 +28,7 @@
3785
3786 namespace Ubuntu {
3787
3788-namespace DownloadManager {
3789+namespace Transfers {
3790
3791 namespace System {
3792
3793@@ -97,7 +97,7 @@
3794
3795 } // System
3796
3797-} // DownloadManager
3798+} // Transfers
3799
3800 } // Ubuntu
3801
3802
3803=== modified file 'src/common/priv/ubuntu/transfers/system/timer.cpp'
3804--- ubuntu-download-manager-priv/system/timer.cpp 2014-01-16 15:42:53 +0000
3805+++ src/common/priv/ubuntu/transfers/system/timer.cpp 2014-04-11 16:06:36 +0000
3806@@ -17,12 +17,13 @@
3807 */
3808
3809 #include <QTimer>
3810+#include <glog/logging.h>
3811 #include "timer.h"
3812
3813
3814 namespace Ubuntu {
3815
3816-namespace DownloadManager {
3817+namespace Transfers {
3818
3819 namespace System {
3820
3821@@ -31,7 +32,8 @@
3822 _timer = new QTimer(this);
3823 _timer->setSingleShot(true);
3824
3825- connect(_timer, &QTimer::timeout, this, &Timer::timeout);
3826+ CHECK(connect(_timer, &QTimer::timeout, this, &Timer::timeout))
3827+ << "Could not connect to signal";
3828 }
3829
3830 bool
3831@@ -51,6 +53,6 @@
3832
3833 } // System
3834
3835-} // DownloadManager
3836+} // Transfers
3837
3838 } // Ubuntu
3839
3840=== modified file 'src/common/priv/ubuntu/transfers/system/timer.h'
3841--- ubuntu-download-manager-priv/system/timer.h 2014-01-16 15:42:53 +0000
3842+++ src/common/priv/ubuntu/transfers/system/timer.h 2014-04-11 16:06:36 +0000
3843@@ -24,7 +24,7 @@
3844
3845 namespace Ubuntu {
3846
3847-namespace DownloadManager {
3848+namespace Transfers {
3849
3850 namespace System {
3851
3852@@ -49,7 +49,7 @@
3853
3854 } // System
3855
3856-} // DownloadManager
3857+} // Transfers
3858
3859 } // Ubuntu
3860
3861
3862=== modified file 'src/common/priv/ubuntu/transfers/system/uuid_factory.cpp'
3863--- ubuntu-download-manager-priv/system/uuid_factory.cpp 2014-01-16 15:42:53 +0000
3864+++ src/common/priv/ubuntu/transfers/system/uuid_factory.cpp 2014-04-11 16:06:36 +0000
3865@@ -20,7 +20,7 @@
3866
3867 namespace Ubuntu {
3868
3869-namespace DownloadManager {
3870+namespace Transfers {
3871
3872 namespace System {
3873
3874@@ -35,6 +35,6 @@
3875
3876 } // System
3877
3878-} // DownloadManager
3879+} // Transfers
3880
3881 } // Ubuntu
3882
3883=== modified file 'src/common/priv/ubuntu/transfers/system/uuid_factory.h'
3884--- ubuntu-download-manager-priv/system/uuid_factory.h 2014-01-16 15:42:53 +0000
3885+++ src/common/priv/ubuntu/transfers/system/uuid_factory.h 2014-04-11 16:06:36 +0000
3886@@ -24,7 +24,7 @@
3887
3888 namespace Ubuntu {
3889
3890-namespace DownloadManager {
3891+namespace Transfers {
3892
3893 namespace System {
3894
3895@@ -39,7 +39,7 @@
3896
3897 } // System
3898
3899-} // DownloadManager
3900+} // Transfers
3901
3902 } // Ubuntu
3903 #endif // DOWNLOADER_LIB_UUID_FACTORY_H
3904
3905=== modified file 'src/common/priv/ubuntu/transfers/system/uuid_utils.cpp'
3906--- ubuntu-download-manager-priv/system/uuid_utils.cpp 2013-10-29 13:42:44 +0000
3907+++ src/common/priv/ubuntu/transfers/system/uuid_utils.cpp 2014-04-11 16:06:36 +0000
3908@@ -21,7 +21,7 @@
3909
3910 namespace Ubuntu {
3911
3912-namespace DownloadManager {
3913+namespace Transfers {
3914
3915 namespace System {
3916
3917@@ -32,6 +32,6 @@
3918
3919 } // System
3920
3921-} // DownloadManager
3922+} // Transfers
3923
3924 } // Ubuntu
3925
3926=== modified file 'src/common/priv/ubuntu/transfers/system/uuid_utils.h'
3927--- ubuntu-download-manager-priv/system/uuid_utils.h 2013-10-29 13:42:44 +0000
3928+++ src/common/priv/ubuntu/transfers/system/uuid_utils.h 2014-04-11 16:06:36 +0000
3929@@ -24,7 +24,7 @@
3930
3931 namespace Ubuntu {
3932
3933-namespace DownloadManager {
3934+namespace Transfers {
3935
3936 namespace System {
3937
3938@@ -35,7 +35,7 @@
3939
3940 } // System
3941
3942-} // DownloadManager
3943+} // Transfers
3944
3945 } // Ubuntu
3946
3947
3948=== added file 'src/common/priv/ubuntu/transfers/transfer.cpp'
3949--- src/common/priv/ubuntu/transfers/transfer.cpp 1970-01-01 00:00:00 +0000
3950+++ src/common/priv/ubuntu/transfers/transfer.cpp 2014-04-11 16:06:36 +0000
3951@@ -0,0 +1,181 @@
3952+/*
3953+ * Copyright 2014 Canonical Ltd.
3954+ *
3955+ * This library is free software; you can redistribute it and/or
3956+ * modify it under the terms of version 3 of the GNU Lesser General Public
3957+ * License as published by the Free Software Foundation.
3958+ *
3959+ * This program is distributed in the hope that it will be useful,
3960+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3961+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3962+ * General Public License for more details.
3963+ *
3964+ * You should have received a copy of the GNU Lesser General Public
3965+ * License along with this library; if not, write to the
3966+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
3967+ * Boston, MA 02110-1301, USA.
3968+ */
3969+
3970+#include <ubuntu/transfers/system/logger.h>
3971+#include "transfer.h"
3972+
3973+namespace Ubuntu {
3974+
3975+namespace Transfers {
3976+
3977+Transfer::Transfer(const QString& id,
3978+ const QString& path,
3979+ bool isConfined,
3980+ QObject* parent)
3981+ : QObject(parent),
3982+ _id(id),
3983+ _throttle(0),
3984+ _allowMobileData(true),
3985+ _state(Transfer::IDLE),
3986+ _dbusPath(path),
3987+ _isConfined(isConfined) {
3988+ _networkInfo = System::SystemNetworkInfo::instance();
3989+ setObjectName(id);
3990+}
3991+
3992+QString
3993+Transfer::transferId() const {
3994+ return _id;
3995+}
3996+
3997+QString
3998+Transfer::path() const {
3999+ return _dbusPath;
4000+}
4001+
4002+bool
4003+Transfer::isConfined() const {
4004+ return _isConfined;
4005+}
4006+
4007+Transfer::State
4008+Transfer::state() const {
4009+ return _state;
4010+}
4011+
4012+void
4013+Transfer::setState(Transfer::State state) {
4014+ if (_state != state) {
4015+ _state = state;
4016+ emit stateChanged();
4017+ }
4018+}
4019+
4020+bool
4021+Transfer::canTransfer() {
4022+ TRACE;
4023+ QNetworkInfo::NetworkMode mode = _networkInfo->currentNetworkMode();
4024+ switch (mode) {
4025+ case QNetworkInfo::UnknownMode:
4026+ qWarning() << "Network Mode unknown!";
4027+ return _allowMobileData;
4028+ break;
4029+ case QNetworkInfo::GsmMode:
4030+ case QNetworkInfo::CdmaMode:
4031+ case QNetworkInfo::WcdmaMode:
4032+ case QNetworkInfo::WimaxMode:
4033+ case QNetworkInfo::TdscdmaMode:
4034+ case QNetworkInfo::LteMode:
4035+ return _allowMobileData;
4036+ case QNetworkInfo::WlanMode:
4037+ case QNetworkInfo::EthernetMode:
4038+ case QNetworkInfo::BluetoothMode:
4039+ return true;
4040+ default:
4041+ return false;
4042+ }
4043+}
4044+
4045+bool
4046+Transfer::isValid() const {
4047+ return _isValid;
4048+}
4049+
4050+QString
4051+Transfer::lastError() const {
4052+ return _lastError;
4053+}
4054+
4055+bool
4056+Transfer::addToQueue() const {
4057+ return _addToQueue;
4058+}
4059+
4060+void
4061+Transfer::setIsValid(bool isValid) {
4062+ _isValid = isValid;
4063+}
4064+
4065+void
4066+Transfer::setAddToQueue(bool addToQueue) {
4067+ _addToQueue = addToQueue;
4068+}
4069+
4070+void
4071+Transfer::setLastError(const QString& lastError) {
4072+ _lastError = lastError;
4073+}
4074+
4075+void
4076+Transfer::setThrottle(qulonglong speed) {
4077+ if (speed != _throttle) {
4078+ _throttle = speed;
4079+ emit throttleChanged();
4080+ }
4081+}
4082+
4083+qulonglong
4084+Transfer::throttle() {
4085+ return _throttle;
4086+}
4087+
4088+void
4089+Transfer::allowGSMData(bool allowed) {
4090+ if (_allowMobileData != allowed) {
4091+ _allowMobileData = allowed;
4092+ // emit the signals so that they q knows what to do
4093+ emit stateChanged();
4094+ }
4095+}
4096+
4097+bool
4098+Transfer::isGSMDataAllowed() {
4099+ return _allowMobileData;
4100+}
4101+
4102+void
4103+Transfer::cancel() {
4104+ setState(Transfer::CANCEL);
4105+ if(!_addToQueue)
4106+ cancelTransfer();
4107+}
4108+
4109+void
4110+Transfer::pause() {
4111+ setState(Transfer::PAUSE);
4112+ if(!_addToQueue)
4113+ pauseTransfer();
4114+}
4115+
4116+void
4117+Transfer::resume() {
4118+ setState(Transfer::RESUME);
4119+ if(!_addToQueue)
4120+ resumeTransfer();
4121+}
4122+
4123+void
4124+Transfer::start() {
4125+ setState(Transfer::START);
4126+ if(!_addToQueue)
4127+ startTransfer();
4128+}
4129+
4130+} // General
4131+
4132+} // Ubuntu
4133
4134=== added file 'src/common/priv/ubuntu/transfers/transfer.h'
4135--- src/common/priv/ubuntu/transfers/transfer.h 1970-01-01 00:00:00 +0000
4136+++ src/common/priv/ubuntu/transfers/transfer.h 2014-04-11 16:06:36 +0000
4137@@ -0,0 +1,110 @@
4138+/*
4139+ * Copyright 2014 Canonical Ltd.
4140+ *
4141+ * This library is free software; you can redistribute it and/or
4142+ * modify it under the terms of version 3 of the GNU Lesser General Public
4143+ * License as published by the Free Software Foundation.
4144+ *
4145+ * This program is distributed in the hope that it will be useful,
4146+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4147+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4148+ * General Public License for more details.
4149+ *
4150+ * You should have received a copy of the GNU Lesser General Public
4151+ * License along with this library; if not, write to the
4152+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
4153+ * Boston, MA 02110-1301, USA.
4154+ */
4155+
4156+#ifndef UBUNTU_GENERAL_LIB_TRANSFER_H
4157+#define UBUNTU_GENERAL_LIB_TRANSFER_H
4158+
4159+#include <QObject>
4160+#include "ubuntu/transfers/system/system_network_info.h"
4161+
4162+namespace Ubuntu {
4163+
4164+namespace Transfers {
4165+
4166+class Transfer : public QObject {
4167+ Q_OBJECT
4168+
4169+ public:
4170+ enum State {
4171+ IDLE,
4172+ START,
4173+ PAUSE,
4174+ RESUME,
4175+ CANCEL,
4176+ FINISH,
4177+ ERROR
4178+ };
4179+
4180+ Transfer(const QString& id,
4181+ const QString& path,
4182+ bool isConfined,
4183+ QObject* parent = 0);
4184+
4185+ virtual QString transferId() const;
4186+ virtual QString path() const;
4187+ virtual bool isConfined() const;
4188+ virtual Transfer::State state() const;
4189+ virtual void setState(Transfer::State state);
4190+ virtual bool canTransfer();
4191+ virtual bool isValid() const;
4192+ virtual QString lastError() const;
4193+ virtual bool addToQueue() const;
4194+ virtual void setAddToQueue(bool addToQueue);
4195+
4196+ // methods to be overridden by the children
4197+ virtual bool pausable() { return false; }
4198+ virtual void cancelTransfer() {}
4199+ virtual void pauseTransfer() {}
4200+ virtual void resumeTransfer() {}
4201+ virtual void startTransfer() {}
4202+
4203+ public slots: // NOLINT(whitespace/indent)
4204+
4205+ virtual void setThrottle(qulonglong speed);
4206+ virtual qulonglong throttle();
4207+ virtual void allowGSMData(bool allowed);
4208+ virtual bool isGSMDataAllowed();
4209+
4210+ virtual void cancel();
4211+ virtual void pause();
4212+ virtual void resume();
4213+ virtual void start();
4214+
4215+ signals:
4216+ void canceled(bool success);
4217+ void error(const QString& error);
4218+ void paused(bool success);
4219+ void resumed(bool success);
4220+ void started(bool success);
4221+
4222+ // internal signals
4223+ void stateChanged();
4224+ void throttleChanged();
4225+
4226+ protected:
4227+ void setIsValid(bool isValid);
4228+ void setLastError(const QString& lastError);
4229+
4230+ private:
4231+ bool _isValid = true;
4232+ bool _addToQueue = true;
4233+ QString _lastError = "";
4234+ QString _id;
4235+ qulonglong _throttle;
4236+ bool _allowMobileData;
4237+ Transfer::State _state;
4238+ QString _dbusPath;
4239+ bool _isConfined;
4240+ System::SystemNetworkInfo* _networkInfo;
4241+};
4242+
4243+} // Transfers
4244+
4245+} // Ubuntu
4246+
4247+#endif
4248
4249=== added file 'src/common/priv/udm-priv-common.pro.THIS'
4250--- src/common/priv/udm-priv-common.pro.THIS 1970-01-01 00:00:00 +0000
4251+++ src/common/priv/udm-priv-common.pro.THIS 2014-04-11 16:06:36 +0000
4252@@ -0,0 +1,67 @@
4253+include(../common-project-config.pri)
4254+include(../common-vars.pri)
4255+
4256+QT += network dbus systeminfo sql
4257+QT -= gui
4258+DEFINES += NDEBUG
4259+
4260+TARGET = udm-priv-common
4261+TEMPLATE = lib
4262+
4263+DEFINES += UDMPRIVCOMMON_LIBRARY
4264+
4265+SOURCES += \
4266+ ubuntu/transfers/base_daemon.cpp \
4267+ ubuntu/transfers/base_manager.cpp \
4268+ ubuntu/transfers/queue.cpp \
4269+ ubuntu/transfers/transfer.cpp \
4270+ ubuntu/transfers/system/uuid_utils.cpp \
4271+ ubuntu/transfers/system/uuid_factory.cpp \
4272+ ubuntu/transfers/system/timer.cpp \
4273+ ubuntu/transfers/system/system_network_info.cpp \
4274+ ubuntu/transfers/system/request_factory.cpp \
4275+ ubuntu/transfers/system/process_factory.cpp \
4276+ ubuntu/transfers/system/process.cpp \
4277+ ubuntu/transfers/system/file_manager.cpp \
4278+ ubuntu/transfers/system/filename_mutex.cpp \
4279+ ubuntu/transfers/system/application.cpp \
4280+ ubuntu/transfers/system/apparmor.cpp \
4281+ ubuntu/transfers/system/network_reply.cpp \
4282+ ubuntu/transfers/system/dbus_proxy.cpp \
4283+ ubuntu/transfers/system/apn_request_factory.cpp \
4284+ ubuntu/transfers/system/apn_proxy.cpp
4285+
4286+HEADERS += \
4287+ ubuntu/transfers/base_daemon.h \
4288+ ubuntu/transfers/base_manager.h \
4289+ ubuntu/transfers/queue.h \
4290+ ubuntu/transfers/transfer.h \
4291+ ubuntu/transfers/adaptor_factory.h \
4292+ ubuntu/transfers/manager_factory.h \
4293+ ubuntu/transfers/system/uuid_utils.h \
4294+ ubuntu/transfers/system/uuid_factory.h \
4295+ ubuntu/transfers/system/timer.h \
4296+ ubuntu/transfers/system/system_network_info.h \
4297+ ubuntu/transfers/system/request_factory.h \
4298+ ubuntu/transfers/system/process_factory.h \
4299+ ubuntu/transfers/system/process.h \
4300+ ubuntu/transfers/system/file_manager.h \
4301+ ubuntu/transfers/system/filename_mutex.h \
4302+ ubuntu/transfers/system/application.h \
4303+ ubuntu/transfers/system/apparmor.h \
4304+ ubuntu/transfers/system/network_reply.h \
4305+ ubuntu/transfers/system/dbus_proxy.h \
4306+ ubuntu/transfers/system/apn_request_factory.h \
4307+ ubuntu/transfers/system/apn_proxy.h
4308+
4309+include(../common-installs-config.pri)
4310+
4311+LIBS += -lnih-dbus
4312+
4313+PKGCONFIG += dbus-1
4314+PKGCONFIG += libglog
4315+
4316+LIBS += -L$$OUT_PWD/../udm-common/ -ludm-common
4317+
4318+INCLUDEPATH += $$PWD/../udm-common
4319+DEPENDPATH += $$PWD/../udm-common
4320
4321=== added file 'src/common/priv/udm-priv-common_global.h'
4322--- src/common/priv/udm-priv-common_global.h 1970-01-01 00:00:00 +0000
4323+++ src/common/priv/udm-priv-common_global.h 2014-04-11 16:06:36 +0000
4324@@ -0,0 +1,12 @@
4325+#ifndef UDMPRIVCOMMON_GLOBAL_H
4326+#define UDMPRIVCOMMON_GLOBAL_H
4327+
4328+#include <QtCore/qglobal.h>
4329+
4330+#if defined(UDMPRIVCOMMON_LIBRARY)
4331+# define UDMPRIVCOMMONSHARED_EXPORT Q_DECL_EXPORT
4332+#else
4333+# define UDMPRIVCOMMONSHARED_EXPORT Q_DECL_IMPORT
4334+#endif
4335+
4336+#endif // UDMPRIVCOMMON_GLOBAL_H
4337
4338=== added directory 'src/common/public'
4339=== added file 'src/common/public/CMakeLists.txt'
4340--- src/common/public/CMakeLists.txt 1970-01-01 00:00:00 +0000
4341+++ src/common/public/CMakeLists.txt 2014-04-11 16:06:36 +0000
4342@@ -0,0 +1,62 @@
4343+pkg_check_modules(GLOG libglog)
4344+
4345+set(TARGET udm-common)
4346+
4347+set(SOURCES
4348+ ubuntu/transfers/metadata.cpp
4349+ ubuntu/transfers/errors/auth_error_struct.cpp
4350+ ubuntu/transfers/errors/http_error_struct.cpp
4351+ ubuntu/transfers/errors/network_error_struct.cpp
4352+ ubuntu/transfers/errors/process_error_struct.cpp
4353+ ubuntu/transfers/system/dbus_connection.cpp
4354+ ubuntu/transfers/system/hash_algorithm.cpp
4355+ ubuntu/transfers/system/logger.cpp
4356+)
4357+
4358+set(TRANSFERS_PUBLIC_HEADERS
4359+ ubuntu/transfers/metadata.h
4360+)
4361+
4362+set(ERRORS_PUBLIC_HEADERS
4363+ ubuntu/transfers/errors/auth_error_struct.h
4364+ ubuntu/transfers/errors/http_error_struct.h
4365+ ubuntu/transfers/errors/network_error_struct.h
4366+ ubuntu/transfers/errors/process_error_struct.h
4367+)
4368+
4369+set(PRIVATE_HEADERS
4370+ ubuntu/transfers/system/dbus_connection.h
4371+ ubuntu/transfers/system/hash_algorithm.h
4372+ ubuntu/transfers/system/logger.h
4373+)
4374+
4375+include_directories(${Qt5DBus_INCLUDE_DIRS})
4376+include_directories(${Qt5Network_INCLUDE_DIRS})
4377+
4378+add_library(${TARGET} SHARED
4379+ ${SOURCES}
4380+ ${TRANSFERS_PUBLIC_HEADERS}
4381+ ${ERRORS_PUBLIC_HEADERS}
4382+ ${PRIVATE_HEADERS}
4383+)
4384+
4385+set_target_properties(
4386+ ${TARGET}
4387+
4388+ PROPERTIES
4389+ VERSION ${UDM_VERSION_MAJOR}.${UDM_VERSION_MINOR}.${UDM_VERSION_PATCH}
4390+ SOVERSION ${UDM_VERSION_MAJOR}
4391+)
4392+
4393+target_link_libraries(${TARGET}
4394+ ${Qt5DBus_LIBRARIES}
4395+ ${Qt5Network_LIBRARIES}
4396+ glog
4397+)
4398+
4399+configure_file(${TARGET}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.pc @ONLY)
4400+
4401+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
4402+install(TARGETS ${TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR})
4403+install(FILES ${TRANSFERS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ubuntu/transfers)
4404+install(FILES ${ERRORS_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ubuntu/transfers/errors)
4405
4406=== added directory 'src/common/public/ubuntu'
4407=== added directory 'src/common/public/ubuntu/transfers'
4408=== added directory 'src/common/public/ubuntu/transfers/errors'
4409=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.cpp' => 'src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp'
4410--- ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.cpp 2014-02-11 15:35:52 +0000
4411+++ src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp 2014-04-11 16:06:36 +0000
4412@@ -21,7 +21,9 @@
4413
4414 namespace Ubuntu {
4415
4416-namespace DownloadManager {
4417+namespace Transfers {
4418+
4419+namespace Errors {
4420
4421 AuthErrorStruct::AuthErrorStruct()
4422 : _type(),
4423@@ -87,6 +89,7 @@
4424 return _phrase;
4425 }
4426
4427-} // DownloadManager
4428+} // Errors
4429
4430+} // Transfers
4431 } // Ubuntu
4432
4433=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h' => 'src/common/public/ubuntu/transfers/errors/auth_error_struct.h'
4434--- ubuntu-download-manager-common/ubuntu/download_manager/auth_error_struct.h 2014-03-06 12:39:08 +0000
4435+++ src/common/public/ubuntu/transfers/errors/auth_error_struct.h 2014-04-11 16:06:36 +0000
4436@@ -19,13 +19,13 @@
4437 #ifndef DOWNLOADER_LIB_AUTH_ERROR_STRUCT_H
4438 #define DOWNLOADER_LIB_AUTH_ERROR_STRUCT_H
4439
4440-#include "common.h"
4441-
4442 class QDBusArgument;
4443
4444 namespace Ubuntu {
4445
4446-namespace DownloadManager {
4447+namespace Transfers {
4448+
4449+namespace Errors {
4450
4451 /*!
4452 \class AuthErrorStruct
4453@@ -113,7 +113,9 @@
4454 QString _phrase;
4455 };
4456
4457-} // DownloadManager
4458+} // Errors
4459+
4460+} // Transfers
4461
4462 } // Ubuntu
4463
4464
4465=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp' => 'src/common/public/ubuntu/transfers/errors/http_error_struct.cpp'
4466--- ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.cpp 2014-03-06 12:39:08 +0000
4467+++ src/common/public/ubuntu/transfers/errors/http_error_struct.cpp 2014-04-11 16:06:36 +0000
4468@@ -21,7 +21,9 @@
4469
4470 namespace Ubuntu {
4471
4472-namespace DownloadManager {
4473+namespace Transfers {
4474+
4475+namespace Errors {
4476
4477 HttpErrorStruct::HttpErrorStruct()
4478 : _code(200),
4479@@ -75,6 +77,8 @@
4480 return _phrase;
4481 }
4482
4483-} // DownloadManager
4484+} // Errors
4485+
4486+} // Transfers
4487
4488 } // Ubuntu
4489
4490=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h' => 'src/common/public/ubuntu/transfers/errors/http_error_struct.h'
4491--- ubuntu-download-manager-common/ubuntu/download_manager/http_error_struct.h 2014-03-06 12:39:08 +0000
4492+++ src/common/public/ubuntu/transfers/errors/http_error_struct.h 2014-04-11 16:06:36 +0000
4493@@ -20,13 +20,14 @@
4494 #define DOWNLOADER_LIB_HTTP_ERROR_STRUCT_H
4495
4496 #include <QString>
4497-#include "common.h"
4498
4499 class QDBusArgument;
4500
4501 namespace Ubuntu {
4502
4503-namespace DownloadManager {
4504+namespace Transfers {
4505+
4506+namespace Errors {
4507
4508 /*!
4509 \class HttpErrorStruct
4510@@ -35,7 +36,7 @@
4511 manager to the different clients.
4512 \since 0.3
4513 */
4514-class DOWNLOAD_MANAGER_EXPORT HttpErrorStruct {
4515+class HttpErrorStruct {
4516 Q_PROPERTY(int code READ getCode)
4517 Q_PROPERTY(QString phrase READ getPhrase)
4518
4519@@ -101,8 +102,9 @@
4520 QString _phrase;
4521 };
4522
4523-} // DownloadManager
4524+} // Errors
4525+
4526+} // Transfers
4527
4528 } // Ubuntu
4529-
4530 #endif // HTTP_ERROR_STRUCT_H
4531
4532=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp' => 'src/common/public/ubuntu/transfers/errors/network_error_struct.cpp'
4533--- ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.cpp 2014-03-06 12:39:08 +0000
4534+++ src/common/public/ubuntu/transfers/errors/network_error_struct.cpp 2014-04-11 16:06:36 +0000
4535@@ -22,7 +22,9 @@
4536
4537 namespace Ubuntu {
4538
4539-namespace DownloadManager {
4540+namespace Transfers {
4541+
4542+namespace Errors {
4543
4544 NetworkErrorStruct::NetworkErrorStruct()
4545 : _code(0),
4546@@ -161,6 +163,8 @@
4547 return _phrase;
4548 }
4549
4550-} // DownloadManager
4551+} // Errors
4552+
4553+} // Transfers
4554
4555 } // Ubuntu
4556
4557=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h' => 'src/common/public/ubuntu/transfers/errors/network_error_struct.h'
4558--- ubuntu-download-manager-common/ubuntu/download_manager/network_error_struct.h 2014-03-06 12:39:08 +0000
4559+++ src/common/public/ubuntu/transfers/errors/network_error_struct.h 2014-04-11 16:06:36 +0000
4560@@ -20,13 +20,14 @@
4561 #define DOWNLOADER_LIB_NETWORK_ERROR_STRUCT_H
4562
4563 #include <QString>
4564-#include "common.h"
4565
4566 class QDBusArgument;
4567
4568 namespace Ubuntu {
4569
4570-namespace DownloadManager {
4571+namespace Transfers {
4572+
4573+namespace Errors {
4574
4575 /*!
4576 \class NetworkErrorStruct
4577@@ -35,7 +36,7 @@
4578 manager to the different clients.
4579 \since 0.3
4580 */
4581-class DOWNLOAD_MANAGER_EXPORT NetworkErrorStruct {
4582+class NetworkErrorStruct {
4583 Q_PROPERTY(int code READ getCode)
4584 Q_PROPERTY(QString phrase READ getPhrase)
4585
4586@@ -106,7 +107,9 @@
4587 QString _phrase;
4588 };
4589
4590-} // DownloadManager
4591+} // Errors
4592+
4593+} // Transfers
4594
4595 } // Ubuntu
4596
4597
4598=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp' => 'src/common/public/ubuntu/transfers/errors/process_error_struct.cpp'
4599--- ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.cpp 2014-03-06 12:39:08 +0000
4600+++ src/common/public/ubuntu/transfers/errors/process_error_struct.cpp 2014-04-11 16:06:36 +0000
4601@@ -22,7 +22,9 @@
4602
4603 namespace Ubuntu {
4604
4605-namespace DownloadManager {
4606+namespace Transfers {
4607+
4608+namespace Errors {
4609
4610 ProcessErrorStruct::ProcessErrorStruct()
4611 : _code(0),
4612@@ -152,7 +154,8 @@
4613 return _stderr;
4614 }
4615
4616+} // Errors
4617
4618-} // DownloadManager
4619+} // Transfers
4620
4621 } // Ubuntu
4622
4623=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h' => 'src/common/public/ubuntu/transfers/errors/process_error_struct.h'
4624--- ubuntu-download-manager-common/ubuntu/download_manager/process_error_struct.h 2014-03-06 12:39:08 +0000
4625+++ src/common/public/ubuntu/transfers/errors/process_error_struct.h 2014-04-11 16:06:36 +0000
4626@@ -20,13 +20,14 @@
4627 #define DOWNLOADER_LIB_PROCESS_ERROR_STRUCT_H
4628
4629 #include <QString>
4630-#include "common.h"
4631
4632 class QDBusArgument;
4633
4634 namespace Ubuntu {
4635
4636-namespace DownloadManager {
4637+namespace Transfers {
4638+
4639+namespace Errors {
4640
4641 /*!
4642 \class ProcessErrorStruct
4643@@ -35,7 +36,7 @@
4644 manager to the different clients.
4645 \since 0.3
4646 */
4647-class DOWNLOAD_MANAGER_EXPORT ProcessErrorStruct {
4648+class ProcessErrorStruct {
4649 Q_PROPERTY(int code READ getCode)
4650 Q_PROPERTY(int exitCode READ getExitCode)
4651 Q_PROPERTY(QString phrase READ getPhrase)
4652@@ -163,7 +164,9 @@
4653 QString _stderr;
4654 };
4655
4656-} // DownloadManager
4657+} // Errors
4658+
4659+} // Transfers
4660
4661 } // Ubuntu
4662
4663
4664=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/metadata.cpp' => 'src/common/public/ubuntu/transfers/metadata.cpp'
4665--- ubuntu-download-manager-common/ubuntu/download_manager/metadata.cpp 2014-02-18 23:59:20 +0000
4666+++ src/common/public/ubuntu/transfers/metadata.cpp 2014-04-11 16:06:36 +0000
4667@@ -20,7 +20,7 @@
4668
4669 namespace Ubuntu {
4670
4671-namespace DownloadManager {
4672+namespace Transfers {
4673
4674 const QString Metadata::COMMAND_KEY = "post-download-command";
4675 const QString Metadata::COMMAND_FILE_KEY = "$file";
4676
4677=== renamed file 'ubuntu-download-manager-common/ubuntu/download_manager/metadata.h' => 'src/common/public/ubuntu/transfers/metadata.h'
4678--- ubuntu-download-manager-common/ubuntu/download_manager/metadata.h 2014-02-18 23:59:20 +0000
4679+++ src/common/public/ubuntu/transfers/metadata.h 2014-04-11 16:06:36 +0000
4680@@ -24,7 +24,7 @@
4681
4682 namespace Ubuntu {
4683
4684-namespace DownloadManager {
4685+namespace Transfers {
4686
4687 class Metadata : public QVariantMap {
4688
4689
4690=== renamed directory 'ubuntu-download-manager-common/ubuntu/download_manager/system' => 'src/common/public/ubuntu/transfers/system'
4691=== modified file 'src/common/public/ubuntu/transfers/system/dbus_connection.cpp'
4692--- ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.cpp 2014-01-22 16:53:05 +0000
4693+++ src/common/public/ubuntu/transfers/system/dbus_connection.cpp 2014-04-11 16:06:36 +0000
4694@@ -20,7 +20,7 @@
4695
4696 namespace Ubuntu {
4697
4698-namespace DownloadManager {
4699+namespace Transfers {
4700
4701 namespace System {
4702
4703@@ -64,6 +64,6 @@
4704
4705 } // System
4706
4707-} // DownloadManager
4708+} // Transfers
4709
4710 } // Ubuntu
4711
4712=== modified file 'src/common/public/ubuntu/transfers/system/dbus_connection.h'
4713--- ubuntu-download-manager-common/ubuntu/download_manager/system/dbus_connection.h 2014-01-22 16:53:05 +0000
4714+++ src/common/public/ubuntu/transfers/system/dbus_connection.h 2014-04-11 16:06:36 +0000
4715@@ -24,7 +24,7 @@
4716
4717 namespace Ubuntu {
4718
4719-namespace DownloadManager {
4720+namespace Transfers {
4721
4722 namespace System {
4723
4724@@ -48,7 +48,7 @@
4725
4726 } // System
4727
4728-} // DownloadManager
4729+} // Transfers
4730
4731 } // Ubuntu
4732
4733
4734=== modified file 'src/common/public/ubuntu/transfers/system/hash_algorithm.cpp'
4735--- ubuntu-download-manager-common/ubuntu/download_manager/system/hash_algorithm.cpp 2013-11-12 12:30:18 +0000
4736+++ src/common/public/ubuntu/transfers/system/hash_algorithm.cpp 2014-04-11 16:06:36 +0000
4737@@ -20,7 +20,7 @@
4738
4739 namespace Ubuntu {
4740
4741-namespace DownloadManager {
4742+namespace Transfers {
4743
4744 namespace System {
4745
4746@@ -77,6 +77,6 @@
4747
4748 } // System
4749
4750-} // DownloadManager
4751+} // Transfers
4752
4753 } // Ubuntu
4754
4755=== modified file 'src/common/public/ubuntu/transfers/system/hash_algorithm.h'
4756--- ubuntu-download-manager-common/ubuntu/download_manager/system/hash_algorithm.h 2013-11-12 12:30:18 +0000
4757+++ src/common/public/ubuntu/transfers/system/hash_algorithm.h 2014-04-11 16:06:36 +0000
4758@@ -25,7 +25,7 @@
4759
4760 namespace Ubuntu {
4761
4762-namespace DownloadManager {
4763+namespace Transfers {
4764
4765 namespace System {
4766
4767@@ -40,7 +40,7 @@
4768
4769 } // System
4770
4771-} // DownloadManager
4772+} // Transfers
4773
4774 } // Ubuntu
4775
4776
4777=== renamed file 'ubuntu-download-manager-priv/system/logger.cpp' => 'src/common/public/ubuntu/transfers/system/logger.cpp'
4778--- ubuntu-download-manager-priv/system/logger.cpp 2014-03-06 13:00:01 +0000
4779+++ src/common/public/ubuntu/transfers/system/logger.cpp 2014-04-11 16:06:36 +0000
4780@@ -83,23 +83,13 @@
4781 return out;
4782 }
4783
4784-std::ostream& operator<<(std::ostream &out, StructList list) {
4785- out << "(";
4786- foreach(const GroupDownloadStruct& group, list) {
4787- out << "{ url:" << group.getUrl() << " hash:" << group.getHash()
4788- << " local file:" << group.getLocalFile() << "}";
4789- }
4790- out << ")";
4791- return out;
4792-}
4793-
4794 namespace {
4795 const QString LOG_NAME = "ubuntu-download-manager.log";
4796 }
4797
4798 namespace Ubuntu {
4799
4800-namespace DownloadManager {
4801+namespace Transfers {
4802
4803 namespace System {
4804
4805@@ -163,6 +153,6 @@
4806
4807 } // System
4808
4809-} // DownloadManager
4810+} // Transfers
4811
4812 } // Ubuntu
4813
4814=== renamed file 'ubuntu-download-manager-priv/system/logger.h' => 'src/common/public/ubuntu/transfers/system/logger.h'
4815--- ubuntu-download-manager-priv/system/logger.h 2014-02-13 17:28:10 +0000
4816+++ src/common/public/ubuntu/transfers/system/logger.h 2014-04-11 16:06:36 +0000
4817@@ -24,7 +24,6 @@
4818 #include <QString>
4819 #include <QTextStream>
4820 #include <QtGlobal>
4821-#include <ubuntu/download_manager/metatypes.h>
4822 #include <glog/logging.h>
4823 #include <iostream>
4824 #include <sstream>
4825@@ -36,6 +35,8 @@
4826
4827 #define TRACE DLOG(INFO) << __PRETTY_FUNCTION__
4828
4829+typedef QMap<QString, QString> StringMap;
4830+
4831 std::ostream& operator<<(std::ostream &out, const QString& var);
4832 std::ostream& operator<<(std::ostream &out, const QByteArray& var);
4833 std::ostream& operator<<(std::ostream &out, const QStringList& var);
4834@@ -44,11 +45,10 @@
4835 std::ostream& operator<<(std::ostream &out, const QDBusError& error);
4836 std::ostream& operator<<(std::ostream &out, const QVariantMap& map);
4837 std::ostream& operator<<(std::ostream &out, const QMap<QString, QString>& map);
4838-std::ostream& operator<<(std::ostream &out, StructList list);
4839
4840 namespace Ubuntu {
4841
4842-namespace DownloadManager {
4843+namespace Transfers {
4844
4845 namespace System {
4846
4847@@ -68,7 +68,7 @@
4848
4849 } // System
4850
4851-} // DownloadManager
4852+} // Transfers
4853
4854 } // Ubuntu
4855
4856
4857=== added file 'src/common/public/udm-common.pc.in'
4858--- src/common/public/udm-common.pc.in 1970-01-01 00:00:00 +0000
4859+++ src/common/public/udm-common.pc.in 2014-04-11 16:06:36 +0000
4860@@ -0,0 +1,12 @@
4861+prefix=@CMAKE_INSTALL_PREFIX@
4862+exec_prefix=${prefix}
4863+libdir=${exec_prefix}/lib
4864+includedir=${prefix}/include/ubuntu/transfers
4865+
4866+Name: udm-common
4867+Description: Common Ubuntu Upload Download Manager lib
4868+Version: @UDM_VERSION_MAJOR@.@UDM_VERSION_MINOR@.@UDM_VERSION_PATCH@
4869+Libs: -L${libdir} -ludm-common
4870+Requires: Qt5Core Qt5DBus
4871+Cflags: -I${includedir}
4872+
4873
4874=== added file 'src/common/public/udm-common_global.h'
4875--- src/common/public/udm-common_global.h 1970-01-01 00:00:00 +0000
4876+++ src/common/public/udm-common_global.h 2014-04-11 16:06:36 +0000
4877@@ -0,0 +1,12 @@
4878+#ifndef UDMCOMMON_GLOBAL_H
4879+#define UDMCOMMON_GLOBAL_H
4880+
4881+#include <QtCore/qglobal.h>
4882+
4883+#if defined(UDMCOMMON_LIBRARY)
4884+# define UDMCOMMONSHARED_EXPORT Q_DECL_EXPORT
4885+#else
4886+# define UDMCOMMONSHARED_EXPORT Q_DECL_IMPORT
4887+#endif
4888+
4889+#endif // UDMCOMMON_GLOBAL_H
4890
4891=== added directory 'src/downloads'
4892=== added file 'src/downloads/CMakeLists.txt'
4893--- src/downloads/CMakeLists.txt 1970-01-01 00:00:00 +0000
4894+++ src/downloads/CMakeLists.txt 2014-04-11 16:06:36 +0000
4895@@ -0,0 +1,22 @@
4896+# Copyright © 2013 Canonical Ltd.
4897+#
4898+# This program is free software: you can redistribute it and/or modify
4899+# it under the terms of the GNU General Public License version 3 as
4900+# published by the Free Software Foundation.
4901+#
4902+# This program is distributed in the hope that it will be useful,
4903+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4904+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4905+# GNU General Public License for more details.
4906+#
4907+# You should have received a copy of the GNU General Public License
4908+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4909+#
4910+# Authored by: Manuel de la Peña <manuel.delapena@canonical.com>
4911+
4912+add_subdirectory(client)
4913+add_subdirectory(common)
4914+add_subdirectory(daemon)
4915+add_subdirectory(priv)
4916+add_subdirectory(qml)
4917+add_subdirectory(test-daemon)
4918
4919=== renamed directory 'ubuntu-download-manager-client' => 'src/downloads/client'
4920=== added file 'src/downloads/client/CMakeLists.txt'
4921--- src/downloads/client/CMakeLists.txt 1970-01-01 00:00:00 +0000
4922+++ src/downloads/client/CMakeLists.txt 2014-04-11 16:06:36 +0000
4923@@ -0,0 +1,68 @@
4924+set(TARGET ubuntu-download-manager-client)
4925+
4926+set(SOURCES
4927+ ubuntu/download_manager/download_impl.cpp
4928+ ubuntu/download_manager/download_interface.cpp
4929+ ubuntu/download_manager/downloads_list_impl.cpp
4930+ ubuntu/download_manager/download_pendingcall_watcher.cpp
4931+ ubuntu/download_manager/error.cpp
4932+ ubuntu/download_manager/group_download.cpp
4933+ ubuntu/download_manager/manager.cpp
4934+ ubuntu/download_manager/manager_impl.cpp
4935+ ubuntu/download_manager/manager_interface.cpp
4936+ ubuntu/download_manager/manager_pendingcall_watcher.cpp
4937+ ubuntu/download_manager/pending_call_watcher.cpp
4938+)
4939+
4940+set(PUBLIC_HEADERS
4941+ ubuntu/download_manager/download.h
4942+ ubuntu/download_manager/downloads_list.h
4943+ ubuntu/download_manager/error.h
4944+ ubuntu/download_manager/group_download.h
4945+ ubuntu/download_manager/manager.h
4946+)
4947+
4948+set(PRIVATE_HEADERS
4949+ ubuntu/download_manager/download_impl.h
4950+ ubuntu/download_manager/download_interface.h
4951+ ubuntu/download_manager/downloads_list_impl.h
4952+ ubuntu/download_manager/download_pendingcall_watcher.h
4953+ ubuntu/download_manager/manager_impl.h
4954+ ubuntu/download_manager/manager_interface.h
4955+ ubuntu/download_manager/manager_pendingcall_watcher.h
4956+ ubuntu/download_manager/pending_call_watcher.h
4957+)
4958+
4959+include_directories(${Qt5DBus_INCLUDE_DIRS})
4960+include_directories(${Qt5Network_INCLUDE_DIRS})
4961+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
4962+include_directories(${CMAKE_CURRENT_BINARY_DIR})
4963+include_directories(${CMAKE_SOURCE_DIR}/src/common/public)
4964+include_directories(${CMAKE_SOURCE_DIR}/src/downloads/common)
4965+
4966+add_library(${TARGET} SHARED
4967+ ${SOURCES}
4968+ ${PUBLIC_HEADERS}
4969+ ${PRIVATE_HEADERS}
4970+)
4971+
4972+set_target_properties(
4973+ ${TARGET}
4974+
4975+ PROPERTIES
4976+ VERSION ${UDM_VERSION_MAJOR}.${UDM_VERSION_MINOR}.${UDM_VERSION_PATCH}
4977+ SOVERSION ${UDM_VERSION_MAJOR}
4978+)
4979+
4980+target_link_libraries(${TARGET}
4981+ ${Qt5DBus_LIBRARIES}
4982+ ${GLOG_LIBRARIES}
4983+ udm-common
4984+ ubuntu-download-manager-common
4985+)
4986+
4987+configure_file(${TARGET}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.pc @ONLY)
4988+
4989+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.pc DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
4990+install(TARGETS ${TARGET} DESTINATION ${CMAKE_INSTALL_LIBDIR})
4991+install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ubuntu/download_manager)
4992
4993=== modified file 'src/downloads/client/ubuntu-download-manager-client.pc.in'
4994--- ubuntu-download-manager-client/ubuntu-download-manager-client.pc.in 2013-12-03 13:29:34 +0000
4995+++ src/downloads/client/ubuntu-download-manager-client.pc.in 2014-04-11 16:06:36 +0000
4996@@ -1,12 +1,11 @@
4997-prefix=$$INSTALL_PREFIX
4998+prefix=@CMAKE_INSTALL_PREFIX@
4999 exec_prefix=${prefix}
5000-libdir=$$INSTALL_LIBDIR
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches