Merge lp:~unity-api-team/indicator-network/connectivity-service-bindings into lp:indicator-network/14.10

Proposed by Antti Kaijanmäki
Status: Merged
Approved by: Antti Kaijanmäki
Approved revision: 406
Merged at revision: 405
Proposed branch: lp:~unity-api-team/indicator-network/connectivity-service-bindings
Merge into: lp:indicator-network/14.10
Prerequisite: lp:~unity-api-team/indicator-network/connectivity-service
Diff against target: 2036 lines (+1283/-110)
61 files modified
.bzrignore (+9/-2)
CMakeLists.txt (+32/-9)
cmake/Coverage.cmake (+0/-37)
cmake/EnableCoverageReport.cmake (+153/-0)
cmake/FindLcov.cmake (+29/-0)
cmake/Findgcovr.cmake (+31/-0)
cmake/ParseArguments.cmake (+52/-0)
debian/connectivity-doc.install (+1/-0)
debian/control (+53/-0)
debian/libconnectivity-qt1-dev.install (+3/-0)
debian/libconnectivity-qt1.install (+1/-0)
debian/qtdeclarative5-connectivity-plugin.install (+1/-0)
src/CMakeLists.txt (+1/-0)
src/dbus-cpp/services/ofono.h (+4/-4)
src/indicator/connectivity-service/connectivity-service.cpp (+22/-20)
src/indicator/indicator-menu.h (+2/-2)
src/indicator/indicator-network-service.cpp (+3/-3)
src/indicator/menuitems/access-point-item.h (+1/-1)
src/indicator/menuitems/switch-item.h (+1/-0)
src/indicator/menuitems/text-item.h (+1/-0)
src/indicator/modem.h (+1/-1)
src/indicator/root-state.cpp (+1/-1)
src/indicator/wifi-link-item.h (+1/-0)
src/indicator/wifi-section.h (+2/-2)
src/indicator/wwan-link-item.h (+1/-1)
src/indicator/wwan-section.cpp (+1/-1)
src/indicator/wwan-section.h (+2/-2)
src/menumodel-cpp/action-group-merger.h (+1/-1)
src/menumodel-cpp/gio-helpers/util.h (+9/-9)
src/menumodel-cpp/gio-helpers/variant.h (+1/-1)
src/menumodel-cpp/menu-item.h (+3/-3)
src/notify-cpp/notification.cpp (+3/-3)
src/notify-cpp/snapdecision/sim-unlock.h (+1/-1)
src/qt/CMakeLists.txt (+8/-0)
src/qt/include/ubuntu/connectivity/NetworkingStatus (+1/-0)
src/qt/include/ubuntu/connectivity/networking-status.h (+79/-0)
src/qt/qml/CMakeLists.txt (+1/-0)
src/qt/qml/Ubuntu/CMakeLists.txt (+1/-0)
src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt (+38/-0)
src/qt/qml/Ubuntu/Connectivity/networking-status.cpp (+43/-0)
src/qt/qml/Ubuntu/Connectivity/networking-status.h (+52/-0)
src/qt/qml/Ubuntu/Connectivity/plugin.cpp (+40/-0)
src/qt/qml/Ubuntu/Connectivity/plugin.h (+36/-0)
src/qt/qml/Ubuntu/Connectivity/qmldir (+2/-0)
src/qt/src/CMakeLists.txt (+48/-0)
src/qt/src/connectivity-qt.pc.in (+10/-0)
src/qt/src/dbus-properties-interface.cpp (+34/-0)
src/qt/src/dbus-properties-interface.h (+53/-0)
src/qt/src/networking-status.cpp (+188/-0)
src/secret-agent/CMakeLists.txt (+1/-0)
src/secret-agent/PasswordMenu.cpp (+4/-4)
tests/CMakeLists.txt (+0/-2)
tests/integration/CMakeLists.txt (+1/-0)
tests/integration/qt/CMakeLists.txt (+4/-0)
tests/integration/qt/cpp/CMakeLists.txt (+16/-0)
tests/integration/qt/cpp/main.cpp (+33/-0)
tests/integration/qt/cpp/tst_networking.cpp (+51/-0)
tests/integration/qt/cpp/tst_networking.h (+39/-0)
tests/integration/qt/qml/CMakeLists.txt (+19/-0)
tests/integration/qt/qml/tst_api.qml (+53/-0)
tests/unit/secret-agent/CMakeLists.txt (+1/-0)
To merge this branch: bzr merge lp:~unity-api-team/indicator-network/connectivity-service-bindings
Reviewer Review Type Date Requested Status
Antti Kaijanmäki (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Jussi Pakkanen (community) Approve
Review via email: mp+230902@code.launchpad.net

Commit message

Connectivity Service Qt and QML bindings.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

This branch has a bug which is not in trunk. I don't know at which point it was introduced but let's fix it here. In wwan-section.cpp there is this:

m_items.erase(iter);
--iter;

Erase invalidates the iterator it points to so this is undefined behaviour. What is probably meant here is this:

iter = m_items.erase(iter);
--iter;

One more thing in inline comments.

review: Needs Fixing
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Will leave the q-pointer as is.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

> This branch has a bug which is not in trunk. I don't know at which point it
> was introduced but let's fix it here. In wwan-section.cpp there is this:
>
> m_items.erase(iter);
> --iter;
>
> Erase invalidates the iterator it points to so this is undefined behaviour.
> What is probably meant here is this:
>
> iter = m_items.erase(iter);
> --iter;

Good catch! Fix is on it's way.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Ok.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Merged cleanups from jussi.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2014-03-25 23:22:16 +0000
3+++ .bzrignore 2014-08-15 11:57:07 +0000
4@@ -1,3 +1,10 @@
5 *.autosave
6-CMakeLists.txt.user
7-CMakeLists.txt.user.3.0-pre1
8+CMakeLists.txt.user*
9+*~
10+/.cproject
11+/.project
12+/.pydevproject
13+/.settings
14+/build
15+/buildclang
16+
17
18=== modified file 'CMakeLists.txt'
19--- CMakeLists.txt 2014-08-15 11:57:07 +0000
20+++ CMakeLists.txt 2014-08-15 11:57:07 +0000
21@@ -4,8 +4,8 @@
22 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
23
24 find_package(PkgConfig REQUIRED)
25+include(EnableCoverageReport)
26 include(GNUInstallDirs)
27-include(Coverage)
28 include(UseGSettings)
29
30 set(GETTEXT_PACKAGE indicator-network)
31@@ -82,28 +82,49 @@
32 pkg_check_modules(GIO REQUIRED gio-2.0>=${GLIB_REQUIRED_VERSION})
33 include_directories(${GIO_INCLUDE_DIRS})
34
35-set(CMAKE_AUTOMOC ON)
36 set(CMAKE_INCLUDE_CURRENT_DIR ON)
37
38 find_package(GObjectIntrospection 0.9.12)
39
40 include_directories(${CMAKE_BINARY_DIR})
41
42-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
43-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
44+set(COMMON_FLAGS "-Wall -Wextra -Wpedantic -fno-permissive")
45+string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
46+if(NOT BUILD_TYPE MATCHES debug)
47+ set(COMMON_FLAGS "${COMMON_FLAGS} -Werror")
48+endif()
49
50-add_definitions(
51- -Wall
52- -Wextra
53- -Wpedantic
54-)
55+# "nice bug" in cmake... http://www.cmake.org/Bug/view.php?id=15058
56+# let's not set C_FLAGS as it will break pthreads detection \o/
57+#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${COMMON_FLAGS}")
58+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${COMMON_FLAGS}")
59
60 configure_file(
61 "config.h.in"
62 "config.h"
63 )
64
65+#####################################################################
66+# Enable code coverage calculation with gcov/gcovr/lcov
67+# Usage:
68+# * Switch build type to coverage (use ccmake or cmake-gui)
69+# * Invoke make, make test, make coverage
70+# * Find html report in subdir coveragereport
71+# * Find xml report feasible for jenkins in coverage.xml
72+#####################################################################
73+IF(BUILD_TYPE MATCHES coverage)
74+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
75+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
76+ SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
77+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
78+ENDIF()
79+
80+
81+set(CONNECTIVITY_QT_VERSION_MAJOR 1)
82+set(CONNECTIVITY_QT_VERSION_MINOR 0)
83+set(CONNECTIVITY_QT_LIB_TARGET connectivity-qt${CONNECTIVITY_QT_VERSION_MAJOR})
84 add_subdirectory(data)
85+#add_subdirectory(doc)
86 add_subdirectory(src)
87 add_subdirectory(po)
88
89@@ -115,3 +136,5 @@
90 ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
91 )
92
93+enable_coverage_report(TARGETS connectivity-qt1 menumodel_cpp indicator-secret-agent
94+ FILTER ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)
95
96=== removed file 'cmake/Coverage.cmake'
97--- cmake/Coverage.cmake 2013-08-27 13:48:41 +0000
98+++ cmake/Coverage.cmake 1970-01-01 00:00:00 +0000
99@@ -1,37 +0,0 @@
100-if (CMAKE_BUILD_TYPE MATCHES coverage)
101- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
102- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
103- set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage")
104- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
105-
106- find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
107- if (NOT GCOVR_EXECUTABLE)
108- message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
109- else ()
110- message(STATUS "Gcovr found, can generate XML coverage info.")
111- add_custom_target (coverage-xml
112- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
113- COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" --exclude="obj.*" -x -r "${CMAKE_SOURCE_DIR}"
114- --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
115- endif()
116-
117- find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
118- find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
119- if (NOT LCOV_EXECUTABLE)
120- message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
121- else ()
122- if(NOT GENHTML_EXECUTABLE)
123- message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
124- else()
125- message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
126- add_custom_target (coverage-html
127- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
128- COMMAND "${LCOV_EXECUTABLE}" --capture --output-file "${CMAKE_BINARY_DIR}/coverage.info" --no-checksum --directory "${CMAKE_BINARY_DIR}"
129- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '/usr/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
130- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_BINARY_DIR}/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
131- COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_SOURCE_DIR}/tests/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
132- COMMAND "${GENHTML_EXECUTABLE}" --prefix "${CMAKE_BINARY_DIR}" --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
133- )
134- endif()
135- endif()
136-endif()
137
138=== added file 'cmake/EnableCoverageReport.cmake'
139--- cmake/EnableCoverageReport.cmake 1970-01-01 00:00:00 +0000
140+++ cmake/EnableCoverageReport.cmake 2014-08-15 11:57:07 +0000
141@@ -0,0 +1,153 @@
142+# - Creates a special coverage build type and target on GCC.
143+#
144+# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
145+# for selected targets. Optional arguments to this function are used to filter
146+# unwanted results using globbing expressions. Moreover targets with tests for
147+# the source code can be specified to trigger regenerating the report if the
148+# test has changed
149+#
150+# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
151+#
152+# To generate a coverage report first build the project with
153+# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
154+#
155+# The coverage report is based on gcov. Depending on the availability of lcov
156+# a HTML report will be generated and/or an XML report of gcovr is found.
157+# The generated coverage target executes all found solutions. Special targets
158+# exist to create e.g. only the xml report: coverage-xml.
159+#
160+# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
161+#
162+# This program is free software; you can redistribute it
163+# and/or modify it under the terms of the GNU General
164+# Public License as published by the Free Software Foundation;
165+# either version 2, or (at your option)
166+# any later version.
167+#
168+# This program is distributed in the hope that it will be useful,
169+# but WITHOUT ANY WARRANTY; without even the implied warranty of
170+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
171+# GNU General Public License for more details.
172+#
173+
174+INCLUDE(ParseArguments)
175+
176+FIND_PACKAGE(Lcov)
177+FIND_PACKAGE(gcovr)
178+
179+FUNCTION(ENABLE_COVERAGE_REPORT)
180+
181+ # argument parsing
182+ PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
183+
184+ SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
185+ SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
186+ SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
187+ SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
188+ SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
189+
190+ # decide if there is any tool to create coverage data
191+ SET(TOOL_FOUND FALSE)
192+ IF(LCOV_FOUND OR GCOVR_FOUND)
193+ SET(TOOL_FOUND TRUE)
194+ ENDIF()
195+ IF(NOT TOOL_FOUND)
196+ MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
197+ ENDIF()
198+
199+ STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
200+ IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
201+
202+ MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
203+
204+ # create coverage build type
205+ SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
206+ SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
207+ SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
208+
209+ # instrument targets
210+ SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
211+ LINK_FLAGS --coverage)
212+
213+ # html report
214+ IF (LCOV_FOUND)
215+
216+ MESSAGE(STATUS "Enabling HTML coverage report")
217+
218+ # set up coverage target
219+
220+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
221+ COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
222+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
223+ COMMENT "Collecting coverage data"
224+ DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
225+ VERBATIM)
226+
227+ # filter unwanted stuff
228+ LIST(LENGTH ARG_FILTER FILTER_LENGTH)
229+ IF(${FILTER_LENGTH} GREATER 0)
230+ SET(FILTER COMMAND ${LCOV_EXECUTABLE})
231+ FOREACH(F ${ARG_FILTER})
232+ SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
233+ ENDFOREACH()
234+ SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
235+ ELSE()
236+ SET(FILTER "")
237+ ENDIF()
238+
239+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
240+ COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
241+ ${FILTER}
242+ DEPENDS ${COVERAGE_RAW_FILE}
243+ COMMENT "Filtering recorded coverage data for project-relevant entries"
244+ VERBATIM)
245+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
246+ COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
247+ COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
248+ DEPENDS ${COVERAGE_FILTERED_FILE}
249+ COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
250+ VERBATIM)
251+
252+ ADD_CUSTOM_TARGET(coverage-html
253+ DEPENDS ${COVERAGE_REPORT_DIR})
254+
255+ ENDIF()
256+
257+ # xml coverage report
258+ IF(GCOVR_FOUND)
259+
260+ MESSAGE(STATUS "Enabling XML coverage report")
261+
262+ # gcovr cannot write directly to a file so the execution needs to
263+ # be wrapped in a cmake file that generates the file output
264+ FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
265+ "SET(ENV{LANG} en)\n")
266+ FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
267+ "EXECUTE_PROCESS(COMMAND \"${GCOVR_EXECUTABLE}\" --exclude=tests.* --exclude=obj-.* --exclude=cmake.* -x -r \"${CMAKE_SOURCE_DIR}\" OUTPUT_FILE \"${COVERAGE_XML_FILE}\" WORKING_DIRECTORY \"${CMAKE_BINARY_DIR}\")\n")
268+
269+ ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
270+ COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
271+ COMMENT "Generating coverage XML report"
272+ VERBATIM)
273+
274+ ADD_CUSTOM_TARGET(coverage-xml
275+ DEPENDS ${COVERAGE_XML_FILE})
276+
277+ ENDIF()
278+
279+ # provide a global coverage target executing both steps if available
280+ SET(GLOBAL_DEPENDS "")
281+ IF(LCOV_FOUND)
282+ LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
283+ ENDIF()
284+ IF(GCOVR_FOUND)
285+ LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
286+ ENDIF()
287+ IF(LCOV_FOUND OR GCOVR_FOUND)
288+ ADD_CUSTOM_TARGET(coverage
289+ DEPENDS ${GLOBAL_DEPENDS})
290+ ENDIF()
291+
292+ ENDIF()
293+
294+ENDFUNCTION()
295
296=== added file 'cmake/FindLcov.cmake'
297--- cmake/FindLcov.cmake 1970-01-01 00:00:00 +0000
298+++ cmake/FindLcov.cmake 2014-08-15 11:57:07 +0000
299@@ -0,0 +1,29 @@
300+# - Find lcov
301+# Will define:
302+#
303+# LCOV_EXECUTABLE - the lcov binary
304+# GENHTML_EXECUTABLE - the genhtml executable
305+#
306+# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
307+#
308+# This program is free software; you can redistribute it
309+# and/or modify it under the terms of the GNU General
310+# Public License as published by the Free Software Foundation;
311+# either version 2, or (at your option)
312+# any later version.
313+#
314+# This program is distributed in the hope that it will be useful,
315+# but WITHOUT ANY WARRANTY; without even the implied warranty of
316+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
317+# GNU General Public License for more details.
318+#
319+
320+INCLUDE(FindPackageHandleStandardArgs)
321+
322+FIND_PROGRAM(LCOV_EXECUTABLE lcov)
323+FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
324+
325+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
326+
327+# only visible in advanced view
328+MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
329
330=== added file 'cmake/Findgcovr.cmake'
331--- cmake/Findgcovr.cmake 1970-01-01 00:00:00 +0000
332+++ cmake/Findgcovr.cmake 2014-08-15 11:57:07 +0000
333@@ -0,0 +1,31 @@
334+# - Find gcovr scrip
335+# Will define:
336+#
337+# GCOVR_EXECUTABLE - the gcovr script
338+#
339+# Uses:
340+#
341+# GCOVR_ROOT - root to search for the script
342+#
343+# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
344+#
345+# This program is free software; you can redistribute it
346+# and/or modify it under the terms of the GNU General
347+# Public License as published by the Free Software Foundation;
348+# either version 2, or (at your option)
349+# any later version.
350+#
351+# This program is distributed in the hope that it will be useful,
352+# but WITHOUT ANY WARRANTY; without even the implied warranty of
353+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
354+# GNU General Public License for more details.
355+#
356+
357+INCLUDE(FindPackageHandleStandardArgs)
358+
359+FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
360+
361+FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
362+
363+# only visible in advanced view
364+MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
365
366=== added file 'cmake/ParseArguments.cmake'
367--- cmake/ParseArguments.cmake 1970-01-01 00:00:00 +0000
368+++ cmake/ParseArguments.cmake 2014-08-15 11:57:07 +0000
369@@ -0,0 +1,52 @@
370+# Parse arguments passed to a function into several lists separated by
371+# upper-case identifiers and options that do not have an associated list e.g.:
372+#
373+# SET(arguments
374+# hello OPTION3 world
375+# LIST3 foo bar
376+# OPTION2
377+# LIST1 fuz baz
378+# )
379+# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
380+#
381+# results in 7 distinct variables:
382+# * ARG_DEFAULT_ARGS: hello;world
383+# * ARG_LIST1: fuz;baz
384+# * ARG_LIST2:
385+# * ARG_LIST3: foo;bar
386+# * ARG_OPTION1: FALSE
387+# * ARG_OPTION2: TRUE
388+# * ARG_OPTION3: TRUE
389+#
390+# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
391+
392+MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
393+ SET(DEFAULT_ARGS)
394+ FOREACH(arg_name ${arg_names})
395+ SET(${prefix}_${arg_name})
396+ ENDFOREACH(arg_name)
397+ FOREACH(option ${option_names})
398+ SET(${prefix}_${option} FALSE)
399+ ENDFOREACH(option)
400+
401+ SET(current_arg_name DEFAULT_ARGS)
402+ SET(current_arg_list)
403+ FOREACH(arg ${ARGN})
404+ SET(larg_names ${arg_names})
405+ LIST(FIND larg_names "${arg}" is_arg_name)
406+ IF (is_arg_name GREATER -1)
407+ SET(${prefix}_${current_arg_name} ${current_arg_list})
408+ SET(current_arg_name ${arg})
409+ SET(current_arg_list)
410+ ELSE (is_arg_name GREATER -1)
411+ SET(loption_names ${option_names})
412+ LIST(FIND loption_names "${arg}" is_option)
413+ IF (is_option GREATER -1)
414+ SET(${prefix}_${arg} TRUE)
415+ ELSE (is_option GREATER -1)
416+ SET(current_arg_list ${current_arg_list} ${arg})
417+ ENDIF (is_option GREATER -1)
418+ ENDIF (is_arg_name GREATER -1)
419+ ENDFOREACH(arg)
420+ SET(${prefix}_${current_arg_name} ${current_arg_list})
421+ENDMACRO(PARSE_ARGUMENTS)
422
423=== added file 'debian/connectivity-doc.install'
424--- debian/connectivity-doc.install 1970-01-01 00:00:00 +0000
425+++ debian/connectivity-doc.install 2014-08-15 11:57:07 +0000
426@@ -0,0 +1,1 @@
427+usr/share/doc/libconnectivity/*
428
429=== modified file 'debian/control'
430--- debian/control 2014-08-06 12:22:27 +0000
431+++ debian/control 2014-08-15 11:57:07 +0000
432@@ -9,6 +9,7 @@
433 g++-4.9,
434 debhelper (>= 9.0.0),
435 google-mock (>= 1.6.0+svn437),
436+ dbus-test-runner,
437 libconnectivity-cpp-dev (>=0.0.1+14.10.20140709),
438 libdbus-cpp-dev (>= 4.0.0),
439 libglib2.0-dev,
440@@ -24,7 +25,13 @@
441 pkg-config,
442 python3-dbusmock,
443 python3-setuptools,
444+ qt5-default,
445 qtbase5-dev,
446+ qtbase5-dev-tools,
447+ qtdeclarative5-dev,
448+ qtdeclarative5-dev-tools,
449+ qtdeclarative5-qtquick2-plugin,
450+ qtdeclarative5-test-plugin,
451 valgrind [amd64 armhf i386 powerpc],
452 Standards-Version: 3.9.3
453 # If you aren't a member of ~indicator-applet-developers but need to upload
454@@ -60,3 +67,49 @@
455 Description: Autopilot tests for the network indicator for Ubuntu
456 The Indicator-network service is responsible for exporting the system settings
457 menu through dbus. This package contains its autopilot tests.
458+
459+Package: libconnectivity-qt1
460+Architecture: any
461+Pre-Depends: ${misc:Pre-Depends}
462+Multi-Arch: same
463+Depends: ${misc:Depends},
464+ ${shlibs:Depends},
465+Description: Unity Action Qt API
466+ Ubuntu Connectivity API - Qt bindings
467+
468+Package: libconnectivity-qt1-dev
469+Section: libdevel
470+Architecture: any
471+Pre-Depends: ${misc:Pre-Depends}
472+Multi-Arch: same
473+Depends: ${misc:Depends},
474+ ${shlibs:Depends},
475+ libconnectivity-qt1 (= ${binary:Version}),
476+ qtbase5-dev
477+Suggests: unity-action-doc,
478+Description: Unity Action Qt API - development files
479+ Ubuntu Connectivity API - Qt bindings
480+ .
481+ This package contains development files to develop against the Qt library.
482+
483+Package: qtdeclarative5-connectivity-plugin
484+Architecture: any
485+Pre-Depends: ${misc:Pre-Depends}
486+Multi-Arch: same
487+Depends: ${misc:Depends},
488+ ${shlibs:Depends},
489+ libconnectivity-qt1 (= ${binary:Version}),
490+Description: Unity Action QML Components
491+ Ubuntu Connectivity API - QML bindings
492+ .
493+ This package contains the qtdeclarative bindings for Ubuntu connectivity API.
494+
495+#Package: connectivity-doc
496+#Section: doc
497+#Architecture: all
498+#Depends: ${misc:Depends},
499+# ${shlibs:Depends},
500+#Description: Unity Action API - documentation
501+# Ubuntu Connectivity API
502+# .
503+# This package contains developer documentation.
504
505=== added file 'debian/libconnectivity-qt1-dev.install'
506--- debian/libconnectivity-qt1-dev.install 1970-01-01 00:00:00 +0000
507+++ debian/libconnectivity-qt1-dev.install 2014-08-15 11:57:07 +0000
508@@ -0,0 +1,3 @@
509+usr/lib/*/libconnectivity-qt1.so
510+usr/include/*
511+usr/lib/*/pkgconfig/*
512
513=== added file 'debian/libconnectivity-qt1.install'
514--- debian/libconnectivity-qt1.install 1970-01-01 00:00:00 +0000
515+++ debian/libconnectivity-qt1.install 2014-08-15 11:57:07 +0000
516@@ -0,0 +1,1 @@
517+usr/lib/*/libconnectivity-qt1.so.*
518
519=== added file 'debian/qtdeclarative5-connectivity-plugin.install'
520--- debian/qtdeclarative5-connectivity-plugin.install 1970-01-01 00:00:00 +0000
521+++ debian/qtdeclarative5-connectivity-plugin.install 2014-08-15 11:57:07 +0000
522@@ -0,0 +1,1 @@
523+usr/lib/*/qt5/qml
524
525=== modified file 'src/CMakeLists.txt'
526--- src/CMakeLists.txt 2014-08-15 11:57:07 +0000
527+++ src/CMakeLists.txt 2014-08-15 11:57:07 +0000
528@@ -2,5 +2,6 @@
529 add_subdirectory(indicator)
530 add_subdirectory(menumodel-cpp)
531 add_subdirectory(notify-cpp)
532+add_subdirectory(qt)
533 add_subdirectory(secret-agent)
534 add_subdirectory(url-dispatcher-cpp)
535
536=== modified file 'src/dbus-cpp/services/ofono.h'
537--- src/dbus-cpp/services/ofono.h 2014-08-05 17:02:58 +0000
538+++ src/dbus-cpp/services/ofono.h 2014-08-15 11:57:07 +0000
539@@ -198,7 +198,7 @@
540 }
541
542 typedef std::shared_ptr<NetworkRegistration> Ptr;
543- NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object)
544+ explicit NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object)
545 : object(object),
546 propertyChanged(object->get_signal<Signal::PropertyChanged>())
547 {
548@@ -722,7 +722,7 @@
549 }
550
551 typedef std::shared_ptr<SimManager> Ptr;
552- SimManager(const std::shared_ptr<core::dbus::Object>& object)
553+ explicit SimManager(const std::shared_ptr<core::dbus::Object>& object)
554 : object(object),
555 propertyChanged(object->get_signal<Signal::PropertyChanged>())
556 {
557@@ -1296,7 +1296,7 @@
558 }
559
560
561- Service(const core::dbus::Bus::Ptr& bus)
562+ explicit Service(const core::dbus::Bus::Ptr& bus)
563 {
564 auto service = core::dbus::Service::use_service<Service>(bus);
565 auto object = service->object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));
566@@ -1307,7 +1307,7 @@
567 {
568 std::shared_ptr<Interface::Manager> manager;
569
570- Mock(const core::dbus::Bus::Ptr& bus)
571+ explicit Mock(const core::dbus::Bus::Ptr& bus)
572 {
573 auto service = core::dbus::Service::add_service<Service>(bus);
574 auto object = service->add_object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));
575
576=== modified file 'src/indicator/connectivity-service/connectivity-service.cpp'
577--- src/indicator/connectivity-service/connectivity-service.cpp 2014-08-15 11:57:07 +0000
578+++ src/indicator/connectivity-service/connectivity-service.cpp 2014-08-15 11:57:07 +0000
579@@ -32,7 +32,7 @@
580 {
581 std::ostringstream output;
582
583- output << "<property ";
584+ output << " <property ";
585 output << "name=\"" << T::name() << "\" ";
586 output << "type=\"" << core::dbus::helper::TypeMapper<typename T::ValueType>::signature() << "\" ";
587
588@@ -252,46 +252,48 @@
589 std::ostringstream output;
590
591 static const std::string header(
592- "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\n"
593- "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
594- "<node>\n"
595+ "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
596+ "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
597+
598+ static const std::string introspectable_interface(
599 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
600 " <method name=\"Introspect\">\n"
601- " <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"
602+ " <arg name=\"xml_data\" direction=\"out\" type=\"s\"/>\n"
603 " </method>\n"
604- " </interface>\n"
605+ " </interface>\n");
606+
607+ static const std::string dbus_properties_interface(
608 " <interface name=\"org.freedesktop.DBus.Properties\">\n"
609 " <method name=\"Get\">\n"
610- " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"
611- " <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n"
612+ " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
613+ " <arg name=\"property_name\" direction=\"in\" type=\"s\"/>\n"
614 " <arg name=\"value\" direction=\"out\" type=\"v\"/>\n"
615 " </method>\n"
616 " <method name=\"Set\">\n"
617- " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"
618- " <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n"
619+ " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
620+ " <arg name=\"property_name\" direction=\"in\" type=\"s\"/>\n"
621 " <arg name=\"value\" direction=\"in\" type=\"v\"/>\n"
622 " </method>\n"
623 " <method name=\"GetAll\">\n"
624- " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"
625+ " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
626 " <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n"
627 " </method>\n"
628- " <signal name=\"PropertiesChanged\"\n>"
629+ " <signal name=\"PropertiesChanged\">\n"
630 " <arg type=\"s\" name=\"interface_name\"/>\n"
631 " <arg type=\"a{sv}\" name=\"changed_properties\"/>\n"
632 " <arg type=\"as\" name=\"invalidated_properties\"/>\n"
633- " </signal>\n"
634+ " </signal>\n"
635 " </interface>\n");
636
637- static const std::string footer("</node>\n");
638-
639 output << header;
640-
641- output << "<interface name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::name() << "\">\n";
642+ output << "<node name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::path() << "\">\n";
643+ output << introspectable_interface;
644+ output << dbus_properties_interface;
645+ output << " <interface name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::name() << "\">\n";
646 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Limitations>() << std::endl;
647 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Status>() << std::endl;
648- output << "</interface>\n";
649-
650- output << footer;
651+ output << " </interface>\n";
652+ output << "</node>\n";
653
654 return output.str();
655 }
656
657=== modified file 'src/indicator/indicator-menu.h'
658--- src/indicator/indicator-menu.h 2014-06-05 14:12:19 +0000
659+++ src/indicator/indicator-menu.h 2014-08-15 11:57:07 +0000
660@@ -33,6 +33,8 @@
661 typedef std::shared_ptr<IndicatorMenu> Ptr;
662
663 IndicatorMenu() = delete;
664+ virtual ~IndicatorMenu() = default;
665+
666 IndicatorMenu(RootState::Ptr rootState, const std::string &prefix)
667 : m_rootState{rootState},
668 m_prefix{prefix}
669@@ -60,8 +62,6 @@
670 m_rootMenu->append(m_rootItem);
671 }
672
673- virtual ~IndicatorMenu() {}
674-
675 virtual void
676 addSection(Section::Ptr section)
677 {
678
679=== modified file 'src/indicator/indicator-network-service.cpp'
680--- src/indicator/indicator-network-service.cpp 2014-08-15 11:57:07 +0000
681+++ src/indicator/indicator-network-service.cpp 2014-08-15 11:57:07 +0000
682@@ -35,7 +35,7 @@
683 {
684 GMainLoop *ptr;
685 public:
686- MainLoop() { ptr = g_main_loop_new(NULL, FALSE); }
687+ MainLoop() { ptr = g_main_loop_new(nullptr, FALSE); }
688 ~MainLoop() { g_main_loop_unref(ptr); }
689
690 void run() { g_main_loop_run(ptr); }
691@@ -89,12 +89,12 @@
692 connectivityService->unlockAllModems().connect([menu](){ menu->unlockAllModems(); });
693
694 if (getenv("VALGRIND") != 0) {
695- g_timeout_add(1000, (GSourceFunc)stop_main_loop, NULL);
696+ g_timeout_add(1000, (GSourceFunc)stop_main_loop, nullptr);
697 mainloop.run();
698
699 menu.reset();
700 // give gio time to do cleanup.
701- g_timeout_add(500, (GSourceFunc)stop_main_loop, NULL);
702+ g_timeout_add(500, (GSourceFunc)stop_main_loop, nullptr);
703 mainloop.run();
704 } else {
705 mainloop.run();
706
707=== modified file 'src/indicator/menuitems/access-point-item.h'
708--- src/indicator/menuitems/access-point-item.h 2014-05-12 18:25:45 +0000
709+++ src/indicator/menuitems/access-point-item.h 2014-08-15 11:57:07 +0000
710@@ -40,7 +40,7 @@
711 typedef std::shared_ptr<AccessPointItem> Ptr;
712
713 AccessPointItem() = delete;
714- AccessPointItem(networking::wifi::AccessPoint::Ptr accessPoint, bool isActive = false)
715+ explicit AccessPointItem(networking::wifi::AccessPoint::Ptr accessPoint, bool isActive = false)
716 : m_accessPoint{accessPoint},
717 m_isActive{isActive}
718 {
719
720=== modified file 'src/indicator/menuitems/switch-item.h'
721--- src/indicator/menuitems/switch-item.h 2014-05-27 16:06:14 +0000
722+++ src/indicator/menuitems/switch-item.h 2014-08-15 11:57:07 +0000
723@@ -31,6 +31,7 @@
724 typedef std::shared_ptr<SwitchItem> Ptr;
725
726 SwitchItem() = delete;
727+ virtual ~SwitchItem() = default;
728 SwitchItem(const std::string &label, const std::string &prefix, const std::string &name)
729 {
730 m_state.changed().connect([this](bool value){
731
732=== modified file 'src/indicator/menuitems/text-item.h'
733--- src/indicator/menuitems/text-item.h 2014-05-12 11:36:59 +0000
734+++ src/indicator/menuitems/text-item.h 2014-08-15 11:57:07 +0000
735@@ -33,6 +33,7 @@
736 typedef std::shared_ptr<TextItem> Ptr;
737
738 TextItem() = delete;
739+ virtual ~TextItem() = default;
740 TextItem(const std::string &label, const std::string &prefix, const std::string &name)
741 {
742 std::string action_name = prefix + "." + name;
743
744=== modified file 'src/indicator/modem.h'
745--- src/indicator/modem.h 2014-08-15 11:57:07 +0000
746+++ src/indicator/modem.h 2014-08-15 11:57:07 +0000
747@@ -67,7 +67,7 @@
748 };
749
750 Modem() = delete;
751- Modem(org::ofono::Interface::Modem::Ptr ofonoModem);
752+ explicit Modem(org::ofono::Interface::Modem::Ptr ofonoModem);
753 virtual ~Modem();
754
755 org::ofono::Interface::Modem::Ptr ofonoModem() const;
756
757=== modified file 'src/indicator/root-state.cpp'
758--- src/indicator/root-state.cpp 2014-08-15 11:57:07 +0000
759+++ src/indicator/root-state.cpp 2014-08-15 11:57:07 +0000
760@@ -232,7 +232,7 @@
761 Variant
762 RootState::Private::createIcon(const std::string name)
763 {
764- GError *error = NULL;
765+ GError *error = nullptr;
766 auto gicon = g_icon_new_for_string(name.c_str(), &error);
767 if (error) {
768 g_error_free(error);
769
770=== modified file 'src/indicator/wifi-link-item.h'
771--- src/indicator/wifi-link-item.h 2014-05-27 16:06:14 +0000
772+++ src/indicator/wifi-link-item.h 2014-08-15 11:57:07 +0000
773@@ -71,6 +71,7 @@
774 typedef std::shared_ptr<WifiLinkItem> Ptr;
775
776 WifiLinkItem() = delete;
777+ virtual ~WifiLinkItem() = default;
778 WifiLinkItem(networking::wifi::Link::Ptr link)
779 : m_link {link}
780 {
781
782=== modified file 'src/indicator/wifi-section.h'
783--- src/indicator/wifi-section.h 2014-05-12 11:36:59 +0000
784+++ src/indicator/wifi-section.h 2014-08-15 11:57:07 +0000
785@@ -32,8 +32,8 @@
786 public:
787 typedef std::shared_ptr<WifiSection> Ptr;
788 WifiSection() = delete;
789- WifiSection(std::shared_ptr<connectivity::networking::Manager> manager);
790- ~WifiSection();
791+ explicit WifiSection(std::shared_ptr<connectivity::networking::Manager> manager);
792+ virtual ~WifiSection();
793
794 // from Section
795 virtual ActionGroup::Ptr actionGroup();
796
797=== modified file 'src/indicator/wwan-link-item.h'
798--- src/indicator/wwan-link-item.h 2014-08-07 00:19:35 +0000
799+++ src/indicator/wwan-link-item.h 2014-08-15 11:57:07 +0000
800@@ -32,7 +32,7 @@
801 typedef std::shared_ptr<WwanLinkItem> Ptr;
802 WwanLinkItem() = delete;
803 WwanLinkItem(Modem::Ptr, ModemManager::Ptr modemManager);
804- ~WwanLinkItem();
805+ virtual ~WwanLinkItem();
806
807 // from Section
808 virtual ActionGroup::Ptr actionGroup();
809
810=== modified file 'src/indicator/wwan-section.cpp'
811--- src/indicator/wwan-section.cpp 2014-08-15 11:57:07 +0000
812+++ src/indicator/wwan-section.cpp 2014-08-15 11:57:07 +0000
813@@ -109,7 +109,7 @@
814 for (auto iter = m_items.begin(); iter != m_items.end(); ++iter) {
815 m_linkMenuMerger->remove(*(*iter).second);
816 m_actionGroupMerger->remove(*(*iter).second);
817- m_items.erase(iter);
818+ iter = m_items.erase(iter);
819 --iter;
820 }
821 }
822
823=== modified file 'src/indicator/wwan-section.h'
824--- src/indicator/wwan-section.h 2014-08-15 11:57:07 +0000
825+++ src/indicator/wwan-section.h 2014-08-15 11:57:07 +0000
826@@ -31,8 +31,8 @@
827 public:
828 typedef std::shared_ptr<WwanSection> Ptr;
829 WwanSection() = delete;
830- WwanSection(ModemManager::Ptr modemManager);
831- ~WwanSection();
832+ explicit WwanSection(ModemManager::Ptr modemManager);
833+ virtual ~WwanSection();
834
835 virtual ActionGroup::Ptr actionGroup();
836 virtual MenuModel::Ptr menuModel();
837
838=== modified file 'src/menumodel-cpp/action-group-merger.h'
839--- src/menumodel-cpp/action-group-merger.h 2014-08-15 11:57:07 +0000
840+++ src/menumodel-cpp/action-group-merger.h 2014-08-15 11:57:07 +0000
841@@ -96,7 +96,7 @@
842 public:
843 typedef std::shared_ptr<ActionGroupMerger> Ptr;
844
845- ActionGroupMerger(const std::string &prefix = "")
846+ explicit ActionGroupMerger(const std::string &prefix = "")
847 : m_prefix {prefix}
848 {
849 m_actionGroup = std::make_shared<ActionGroup>(m_prefix);
850
851=== modified file 'src/menumodel-cpp/gio-helpers/util.h'
852--- src/menumodel-cpp/gio-helpers/util.h 2014-05-12 11:36:59 +0000
853+++ src/menumodel-cpp/gio-helpers/util.h 2014-08-15 11:57:07 +0000
854@@ -56,7 +56,7 @@
855 g_idle_add_full(G_PRIORITY_HIGH,
856 GSourceFunc(GMainLoopSync::dispatch_cb),
857 this,
858- NULL);
859+ nullptr);
860 if (m_cv.wait_for(lk, std::chrono::seconds(3)) == std::cv_status::timeout) {
861 std::cerr << "Timeout when waiting for GMainLoop sync." << std::endl;
862 }
863@@ -143,13 +143,13 @@
864
865 SessionBus()
866 {
867- GError *error = NULL;
868+ GError *error = nullptr;
869
870 gchar *address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION,
871- NULL, &error);
872+ nullptr, &error);
873 if (!address)
874 {
875- g_assert(error != NULL);
876+ g_assert(error != nullptr);
877 if (error->domain != G_IO_ERROR
878 || error->code != G_IO_ERROR_CANCELLED)
879 {
880@@ -160,20 +160,20 @@
881 return;
882 }
883
884- error = NULL;
885+ error = nullptr;
886 m_bus.reset(
887 g_dbus_connection_new_for_address_sync(
888 address,
889 (GDBusConnectionFlags) (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT
890 | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),
891- NULL,
892- NULL,
893+ nullptr,
894+ nullptr,
895 &error),
896 GObjectDeleter());
897 g_free(address);
898
899 if (!m_bus) {
900- g_assert(error != NULL);
901+ g_assert(error != nullptr);
902 if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_CANCELLED) {
903 std::cerr << "Error getting the bus: " << error->message;
904 }
905@@ -236,7 +236,7 @@
906 (GBusNameAcquiredCallback)nameAcquired,
907 (GBusNameLostCallback)nameLost,
908 this,
909- NULL);
910+ nullptr);
911
912 }
913 ~BusName()
914
915=== modified file 'src/menumodel-cpp/gio-helpers/variant.h'
916--- src/menumodel-cpp/gio-helpers/variant.h 2014-04-24 13:24:05 +0000
917+++ src/menumodel-cpp/gio-helpers/variant.h 2014-08-15 11:57:07 +0000
918@@ -140,7 +140,7 @@
919 {
920 assert(variant);
921 assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING));
922- value = g_variant_get_string(variant, NULL);
923+ value = g_variant_get_string(variant, nullptr);
924 }
925 };
926
927
928=== modified file 'src/menumodel-cpp/menu-item.h'
929--- src/menumodel-cpp/menu-item.h 2014-04-02 23:12:55 +0000
930+++ src/menumodel-cpp/menu-item.h 2014-08-15 11:57:07 +0000
931@@ -64,13 +64,13 @@
932 return menu;
933 }
934
935- MenuItem(const std::string &label = "",
936+ explicit MenuItem(const std::string &label = "",
937 const std::string &action = "")
938 : m_label{label},
939 m_action{action}
940 {
941 /// @todo validate that action is valid
942- m_gmenuitem = make_gmenuitem_ptr(g_menu_item_new(NULL, NULL));
943+ m_gmenuitem = make_gmenuitem_ptr(g_menu_item_new(nullptr, nullptr));
944 if (!label.empty()) {
945 g_menu_item_set_label(m_gmenuitem.get(), label.c_str());
946 }
947@@ -136,7 +136,7 @@
948 assert(!attribute.empty());
949 std::lock_guard<std::recursive_mutex> lg(m_mutex);
950 m_attributes.erase(attribute);
951- g_menu_item_set_attribute(m_gmenuitem.get(), attribute.c_str(), NULL);
952+ g_menu_item_set_attribute(m_gmenuitem.get(), attribute.c_str(), nullptr);
953 m_changed();
954 }
955
956
957=== modified file 'src/notify-cpp/notification.cpp'
958--- src/notify-cpp/notification.cpp 2014-03-25 23:22:16 +0000
959+++ src/notify-cpp/notification.cpp 2014-08-15 11:57:07 +0000
960@@ -57,13 +57,13 @@
961 d->disconnectId = g_signal_connect(d->notification.get(), "closed", G_CALLBACK(Private::closed_cb), d.get());
962
963 d->summary.changed().connect([this](const std::string &value){
964- g_object_set(d->notification.get(), "summary", value.c_str(), NULL);
965+ g_object_set(d->notification.get(), "summary", value.c_str(), nullptr);
966 });
967 d->body.changed().connect([this](const std::string &value){
968- g_object_set(d->notification.get(), "body", value.c_str(), NULL);
969+ g_object_set(d->notification.get(), "body", value.c_str(), nullptr);
970 });
971 d->icon.changed().connect([this](const std::string &value){
972- g_object_set(d->notification.get(), "icon", value.c_str(), NULL);
973+ g_object_set(d->notification.get(), "icon", value.c_str(), nullptr);
974 });
975
976 }
977
978=== modified file 'src/notify-cpp/snapdecision/sim-unlock.h'
979--- src/notify-cpp/snapdecision/sim-unlock.h 2014-04-23 13:18:25 +0000
980+++ src/notify-cpp/snapdecision/sim-unlock.h 2014-08-15 11:57:07 +0000
981@@ -36,7 +36,7 @@
982
983 typedef std::shared_ptr<SimUnlock> Ptr;
984
985- SimUnlock(const std::string &title = "",
986+ explicit SimUnlock(const std::string &title = "",
987 const std::string &body = "",
988 std::pair<std::uint8_t, std::uint8_t> pinMinMax = {0, -0});
989 ~SimUnlock();
990
991=== added directory 'src/qt'
992=== added file 'src/qt/CMakeLists.txt'
993--- src/qt/CMakeLists.txt 1970-01-01 00:00:00 +0000
994+++ src/qt/CMakeLists.txt 2014-08-15 11:57:07 +0000
995@@ -0,0 +1,8 @@
996+set(CMAKE_AUTOMOC ON)
997+add_definitions(-DQT_NO_KEYWORDS)
998+
999+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
1000+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
1001+
1002+add_subdirectory(src)
1003+add_subdirectory(qml)
1004
1005=== added directory 'src/qt/include'
1006=== added directory 'src/qt/include/ubuntu'
1007=== added directory 'src/qt/include/ubuntu/connectivity'
1008=== added file 'src/qt/include/ubuntu/connectivity/NetworkingStatus'
1009--- src/qt/include/ubuntu/connectivity/NetworkingStatus 1970-01-01 00:00:00 +0000
1010+++ src/qt/include/ubuntu/connectivity/NetworkingStatus 2014-08-15 11:57:07 +0000
1011@@ -0,0 +1,1 @@
1012+#include <ubuntu/connectivity/networking-status.h>
1013
1014=== added file 'src/qt/include/ubuntu/connectivity/networking-status.h'
1015--- src/qt/include/ubuntu/connectivity/networking-status.h 1970-01-01 00:00:00 +0000
1016+++ src/qt/include/ubuntu/connectivity/networking-status.h 2014-08-15 11:57:07 +0000
1017@@ -0,0 +1,79 @@
1018+/*
1019+ * Copyright © 2014 Canonical Ltd.
1020+ *
1021+ * This program is free software: you can redistribute it and/or modify it
1022+ * under the terms of the GNU Lesser General Public License version 3,
1023+ * as published by the Free Software Foundation.
1024+ *
1025+ * This program is distributed in the hope that it will be useful,
1026+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1027+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1028+ * GNU Lesser General Public License for more details.
1029+ *
1030+ * You should have received a copy of the GNU Lesser General Public License
1031+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1032+ *
1033+ * Authors:
1034+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1035+ */
1036+
1037+#ifndef CONNECTIVITY_NETWORKING_STATUS_H
1038+#define CONNECTIVITY_NETWORKING_STATUS_H
1039+
1040+#include <QObject>
1041+#include <QScopedPointer>
1042+#include <QVector>
1043+
1044+namespace ubuntu {
1045+namespace connectivity {
1046+
1047+
1048+class Q_DECL_EXPORT NetworkingStatus : public QObject
1049+{
1050+ Q_OBJECT
1051+ Q_DISABLE_COPY(NetworkingStatus)
1052+
1053+ Q_ENUMS(Limitations)
1054+ Q_ENUMS(Status)
1055+
1056+ Q_PROPERTY(QVector<Limitations> limitations
1057+ READ limitations
1058+ NOTIFY limitationsChanged)
1059+ Q_PROPERTY(Status status
1060+ READ status
1061+ NOTIFY statusChanged)
1062+
1063+public:
1064+ explicit NetworkingStatus(QObject *parent = 0);
1065+ virtual ~NetworkingStatus();
1066+
1067+ enum Limitations {
1068+ Bandwith
1069+ };
1070+
1071+ enum Status {
1072+ Offline,
1073+ Connecting,
1074+ Online
1075+ };
1076+
1077+ QVector<Limitations> limitations() const;
1078+ Status status() const;
1079+
1080+Q_SIGNALS:
1081+ void limitationsChanged();
1082+ void statusChanged(Status value);
1083+
1084+private:
1085+ class Private;
1086+ QScopedPointer<Private> d;
1087+};
1088+
1089+}
1090+}
1091+
1092+Q_DECLARE_METATYPE(ubuntu::connectivity::NetworkingStatus::Limitations)
1093+Q_DECLARE_METATYPE(QVector<ubuntu::connectivity::NetworkingStatus::Limitations>)
1094+Q_DECLARE_METATYPE(ubuntu::connectivity::NetworkingStatus::Status)
1095+
1096+#endif // CONNECTIVITY_NETWORKING_STATUS_H
1097
1098=== added directory 'src/qt/qml'
1099=== added file 'src/qt/qml/CMakeLists.txt'
1100--- src/qt/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
1101+++ src/qt/qml/CMakeLists.txt 2014-08-15 11:57:07 +0000
1102@@ -0,0 +1,1 @@
1103+add_subdirectory(Ubuntu)
1104
1105=== added directory 'src/qt/qml/Ubuntu'
1106=== added file 'src/qt/qml/Ubuntu/CMakeLists.txt'
1107--- src/qt/qml/Ubuntu/CMakeLists.txt 1970-01-01 00:00:00 +0000
1108+++ src/qt/qml/Ubuntu/CMakeLists.txt 2014-08-15 11:57:07 +0000
1109@@ -0,0 +1,1 @@
1110+add_subdirectory(Connectivity)
1111
1112=== added directory 'src/qt/qml/Ubuntu/Connectivity'
1113=== added file 'src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt'
1114--- src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000
1115+++ src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt 2014-08-15 11:57:07 +0000
1116@@ -0,0 +1,38 @@
1117+# Find includes in corresponding build directories
1118+set(CMAKE_INCLUDE_CURRENT_DIR ON)
1119+
1120+find_package(Qt5Quick REQUIRED)
1121+
1122+set(CORE_SRCS
1123+ networking-status.cpp
1124+ plugin.cpp
1125+)
1126+include_directories(${CMAKE_SOURCE_DIR}/src/qt/include)
1127+
1128+add_library(connectivity-qml SHARED
1129+ ${CORE_SRCS}
1130+)
1131+target_link_libraries(connectivity-qml ${CONNECTIVITY_QT_LIB_TARGET})
1132+
1133+qt5_use_modules(connectivity-qml Qml)
1134+
1135+get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
1136+exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" OUTPUT_VARIABLE QT_IMPORTS_DIR)
1137+file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR)
1138+
1139+install(
1140+ TARGETS connectivity-qml
1141+ ARCHIVE DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
1142+ RUNTIME DESTINATION bin
1143+ LIBRARY DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
1144+)
1145+
1146+install(
1147+ FILES qmldir
1148+ DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
1149+)
1150+
1151+# copy qmldir file into build directory for shadow builds
1152+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
1153+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
1154+ )
1155
1156=== added file 'src/qt/qml/Ubuntu/Connectivity/networking-status.cpp'
1157--- src/qt/qml/Ubuntu/Connectivity/networking-status.cpp 1970-01-01 00:00:00 +0000
1158+++ src/qt/qml/Ubuntu/Connectivity/networking-status.cpp 2014-08-15 11:57:07 +0000
1159@@ -0,0 +1,43 @@
1160+/*
1161+ * Copyright © 2013 Canonical Ltd.
1162+ *
1163+ * This program is free software: you can redistribute it and/or modify it
1164+ * under the terms of the GNU Lesser General Public License version 3,
1165+ * as published by the Free Software Foundation.
1166+ *
1167+ * This program is distributed in the hope that it will be useful,
1168+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1169+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1170+ * GNU Lesser General Public License for more details.
1171+ *
1172+ * You should have received a copy of the GNU Lesser General Public License
1173+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1174+ *
1175+ * Authors:
1176+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1177+ */
1178+
1179+#include "networking-status.h"
1180+
1181+NetworkingStatus::NetworkingStatus(QObject *parent)
1182+ : ubuntu::connectivity::NetworkingStatus(parent)
1183+{
1184+ connect(this, &NetworkingStatus::statusChanged, [this](Status value){
1185+ value == Status::Online ? Q_EMIT onlineChanged(true) : Q_EMIT onlineChanged(false);
1186+ });
1187+}
1188+
1189+NetworkingStatus::~NetworkingStatus()
1190+{}
1191+
1192+bool
1193+NetworkingStatus::online() const
1194+{
1195+ return status() == Status::Online;
1196+}
1197+
1198+bool
1199+NetworkingStatus::limitedBandwith() const
1200+{
1201+ return limitations().contains(Limitations::Bandwith);
1202+}
1203
1204=== added file 'src/qt/qml/Ubuntu/Connectivity/networking-status.h'
1205--- src/qt/qml/Ubuntu/Connectivity/networking-status.h 1970-01-01 00:00:00 +0000
1206+++ src/qt/qml/Ubuntu/Connectivity/networking-status.h 2014-08-15 11:57:07 +0000
1207@@ -0,0 +1,52 @@
1208+/*
1209+ * Copyright © 2014 Canonical Ltd.
1210+ *
1211+ * This program is free software: you can redistribute it and/or modify it
1212+ * under the terms of the GNU Lesser General Public License version 3,
1213+ * as published by the Free Software Foundation.
1214+ *
1215+ * This program is distributed in the hope that it will be useful,
1216+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1217+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1218+ * GNU Lesser General Public License for more details.
1219+ *
1220+ * You should have received a copy of the GNU Lesser General Public License
1221+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1222+ *
1223+ * Authors:
1224+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1225+ */
1226+
1227+#ifndef QML_CONNECTIVITY_NETWORKING_STATUS_H
1228+#define QML_CONNECTIVITY_NETWORKING_STATUS_H
1229+
1230+#include <QObject>
1231+#include <QThread>
1232+
1233+#include <ubuntu/connectivity/NetworkingStatus>
1234+
1235+class Q_DECL_EXPORT NetworkingStatus : public ubuntu::connectivity::NetworkingStatus
1236+{
1237+ Q_OBJECT
1238+
1239+ Q_PROPERTY(bool online
1240+ READ online
1241+ NOTIFY onlineChanged)
1242+
1243+ Q_PROPERTY(bool limitedBandwith
1244+ READ limitedBandwith
1245+ NOTIFY limitedBandwithChanged)
1246+
1247+public:
1248+ explicit NetworkingStatus(QObject *parent = 0);
1249+ virtual ~NetworkingStatus();
1250+
1251+ bool online() const;
1252+ bool limitedBandwith() const;
1253+
1254+Q_SIGNALS:
1255+ void onlineChanged(bool value);
1256+ void limitedBandwithChanged(bool value);
1257+};
1258+
1259+#endif // QML_CONNECTIVITY_NETWORKING_STATUS_H
1260
1261=== added file 'src/qt/qml/Ubuntu/Connectivity/plugin.cpp'
1262--- src/qt/qml/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000
1263+++ src/qt/qml/Ubuntu/Connectivity/plugin.cpp 2014-08-15 11:57:07 +0000
1264@@ -0,0 +1,40 @@
1265+/*
1266+ * Copyright © 2014 Canonical Ltd.
1267+ *
1268+ * This program is free software: you can redistribute it and/or modify it
1269+ * under the terms of the GNU Lesser General Public License version 3,
1270+ * as published by the Free Software Foundation.
1271+ *
1272+ * This program is distributed in the hope that it will be useful,
1273+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1274+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1275+ * GNU Lesser General Public License for more details.
1276+ *
1277+ * You should have received a copy of the GNU Lesser General Public License
1278+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1279+ *
1280+ * Authors:
1281+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1282+ */
1283+
1284+#include "plugin.h"
1285+
1286+#include <QtQml>
1287+
1288+#include "networking-status.h"
1289+
1290+void
1291+QmlConnectivityNetworkingPlugin::registerTypes(const char *uri)
1292+{
1293+ // @uri Ubuntu.Connectivity
1294+ qmlRegisterType<NetworkingStatus> (uri, 1, 0, "NetworkingStatus");
1295+}
1296+
1297+void
1298+QmlConnectivityNetworkingPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
1299+{
1300+ Q_UNUSED(uri);
1301+ Q_UNUSED(engine);
1302+}
1303+
1304+
1305
1306=== added file 'src/qt/qml/Ubuntu/Connectivity/plugin.h'
1307--- src/qt/qml/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000
1308+++ src/qt/qml/Ubuntu/Connectivity/plugin.h 2014-08-15 11:57:07 +0000
1309@@ -0,0 +1,36 @@
1310+/*
1311+ * Copyright © 2014 Canonical Ltd.
1312+ *
1313+ * This program is free software: you can redistribute it and/or modify it
1314+ * under the terms of the GNU Lesser General Public License version 3,
1315+ * as published by the Free Software Foundation.
1316+ *
1317+ * This program is distributed in the hope that it will be useful,
1318+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1319+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1320+ * GNU Lesser General Public License for more details.
1321+ *
1322+ * You should have received a copy of the GNU Lesser General Public License
1323+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1324+ *
1325+ * Authors:
1326+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1327+ */
1328+
1329+#ifndef QML_CONNECTIVITY_PLUGIN_H
1330+#define QML_CONNECTIVITY_PLUGIN_H
1331+
1332+#include <QQmlExtensionPlugin>
1333+
1334+class QmlConnectivityNetworkingPlugin : public QQmlExtensionPlugin {
1335+ Q_OBJECT
1336+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1337+ Q_INTERFACES(QQmlExtensionInterface)
1338+
1339+public:
1340+ void registerTypes(const char *uri);
1341+ void initializeEngine(QQmlEngine *engine, const char *uri);
1342+};
1343+
1344+#endif // QML_CONNECTIVITY_PLUGIN_H
1345+
1346
1347=== added file 'src/qt/qml/Ubuntu/Connectivity/qmldir'
1348--- src/qt/qml/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000
1349+++ src/qt/qml/Ubuntu/Connectivity/qmldir 2014-08-15 11:57:07 +0000
1350@@ -0,0 +1,2 @@
1351+module Ubuntu.Connectivity
1352+plugin connectivity-qml
1353
1354=== added directory 'src/qt/src'
1355=== added file 'src/qt/src/CMakeLists.txt'
1356--- src/qt/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
1357+++ src/qt/src/CMakeLists.txt 2014-08-15 11:57:07 +0000
1358@@ -0,0 +1,48 @@
1359+
1360+set(CONNECTIVITY_QT_INCLUDE_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}/connectivity-api/qt${CONNECTIVITY_QT_VERSION_MAJOR}")
1361+
1362+set(PUBLIC_HEADER_DIR "${CMAKE_SOURCE_DIR}/src/qt/include/ubuntu/connectivity")
1363+set(PUBLIC_HEADERS
1364+ ${PUBLIC_HEADER_DIR}/NetworkingStatus
1365+ ${PUBLIC_HEADER_DIR}/networking-status.h
1366+)
1367+
1368+#install the headers
1369+install(FILES ${PUBLIC_HEADERS}
1370+ DESTINATION "${CONNECTIVITY_QT_INCLUDE_DIR}/ubuntu/connectivity")
1371+
1372+include_directories(../include)
1373+set(CORE_SRCS
1374+ networking-status.cpp
1375+ dbus-properties-interface.cpp
1376+)
1377+
1378+add_library(${CONNECTIVITY_QT_LIB_TARGET} SHARED
1379+ ${CORE_SRCS}
1380+ ${PUBLIC_HEADERS} # public headers have to be included here for Q_DECL_EXPORT to work properly
1381+)
1382+
1383+qt5_use_modules(${CONNECTIVITY_QT_LIB_TARGET} Core DBus)
1384+
1385+install(
1386+ TARGETS ${CONNECTIVITY_QT_LIB_TARGET}
1387+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
1388+ RUNTIME DESTINATION bin
1389+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1390+)
1391+
1392+set(SO_VERSION ${CONNECTIVITY_QT_VERSION_MAJOR})
1393+
1394+set_target_properties(${CONNECTIVITY_QT_LIB_TARGET} PROPERTIES
1395+ SOVERSION ${SO_VERSION}
1396+)
1397+
1398+set(PC_FILE_TARGET "${CMAKE_CURRENT_BINARY_DIR}/${CONNECTIVITY_QT_LIB_TARGET}.pc")
1399+set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
1400+set(includedir "${CCONNECTIVITY_QT_INCLUDE_DIR}")
1401+set(ABSOLUTE_SO_FILE "${CMAKE_INSTALL_FULL_LIBDIR}/${CONNECTIVITY_QT_LIB_TARGET}.so.${SO_VERSION}")
1402+configure_file("connectivity-qt.pc.in" ${PC_FILE_TARGET} @ONLY)
1403+install(
1404+ FILES ${PC_FILE_TARGET}
1405+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
1406+)
1407
1408=== added file 'src/qt/src/connectivity-qt.pc.in'
1409--- src/qt/src/connectivity-qt.pc.in 1970-01-01 00:00:00 +0000
1410+++ src/qt/src/connectivity-qt.pc.in 2014-08-15 11:57:07 +0000
1411@@ -0,0 +1,10 @@
1412+libdir=@libdir@
1413+includedir=@includedir@
1414+
1415+Cflags: -I${includedir}/
1416+Requires: Qt5DBus
1417+Libs: @ABSOLUTE_SO_FILE@
1418+
1419+Name: connectivity-qt1
1420+Description: Ubuntu Connectivity API
1421+Version: @CONNECTIVITY_QT_VERSION_MAJOR@.@CONNECTIVITY_QT_VERSION_MINOR@
1422
1423=== added file 'src/qt/src/dbus-properties-interface.cpp'
1424--- src/qt/src/dbus-properties-interface.cpp 1970-01-01 00:00:00 +0000
1425+++ src/qt/src/dbus-properties-interface.cpp 2014-08-15 11:57:07 +0000
1426@@ -0,0 +1,34 @@
1427+/*
1428+ * Copyright © 2014 Canonical Ltd.
1429+ *
1430+ * This program is free software: you can redistribute it and/or modify it
1431+ * under the terms of the GNU Lesser General Public License version 3,
1432+ * as published by the Free Software Foundation.
1433+ *
1434+ * This program is distributed in the hope that it will be useful,
1435+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1436+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1437+ * GNU Lesser General Public License for more details.
1438+ *
1439+ * You should have received a copy of the GNU Lesser General Public License
1440+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1441+ *
1442+ * Authors:
1443+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1444+ */
1445+
1446+#include "dbus-properties-interface.h"
1447+
1448+DBusPropertiesInterface::DBusPropertiesInterface(const QString &service,
1449+ const QString &path,
1450+ const QDBusConnection &connection,
1451+ QObject *parent)
1452+ : QDBusAbstractInterface(service,
1453+ path,
1454+ staticInterfaceName(),
1455+ connection,
1456+ parent)
1457+{}
1458+
1459+DBusPropertiesInterface::~DBusPropertiesInterface()
1460+{}
1461
1462=== added file 'src/qt/src/dbus-properties-interface.h'
1463--- src/qt/src/dbus-properties-interface.h 1970-01-01 00:00:00 +0000
1464+++ src/qt/src/dbus-properties-interface.h 2014-08-15 11:57:07 +0000
1465@@ -0,0 +1,53 @@
1466+/*
1467+ * Copyright © 2014 Canonical Ltd.
1468+ *
1469+ * This program is free software: you can redistribute it and/or modify it
1470+ * under the terms of the GNU Lesser General Public License version 3,
1471+ * as published by the Free Software Foundation.
1472+ *
1473+ * This program is distributed in the hope that it will be useful,
1474+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1475+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1476+ * GNU Lesser General Public License for more details.
1477+ *
1478+ * You should have received a copy of the GNU Lesser General Public License
1479+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1480+ *
1481+ * Authors:
1482+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1483+ */
1484+
1485+#ifndef DBUSPROPERTIES_H
1486+#define DBUSPROPERTIES_H
1487+
1488+#include <QtCore/QObject>
1489+#include <QtCore/QByteArray>
1490+#include <QtCore/QList>
1491+#include <QtCore/QMap>
1492+#include <QtCore/QString>
1493+#include <QtCore/QStringList>
1494+#include <QtCore/QVariant>
1495+#include <QtDBus/QtDBus>
1496+
1497+class DBusPropertiesInterface: public QDBusAbstractInterface
1498+{
1499+ Q_OBJECT
1500+public:
1501+ static inline const char *staticInterfaceName()
1502+ { return "org.freedesktop.DBus.Properties"; }
1503+
1504+public:
1505+ DBusPropertiesInterface(const QString &service,
1506+ const QString &path,
1507+ const QDBusConnection &connection,
1508+ QObject *parent = 0);
1509+
1510+ ~DBusPropertiesInterface();
1511+
1512+Q_SIGNALS:
1513+ void PropertiesChanged(const QString interface_name,
1514+ const QVariantMap &changed_properties,
1515+ const QStringList &invalidated_properties);
1516+};
1517+
1518+#endif
1519
1520=== added file 'src/qt/src/networking-status.cpp'
1521--- src/qt/src/networking-status.cpp 1970-01-01 00:00:00 +0000
1522+++ src/qt/src/networking-status.cpp 2014-08-15 11:57:07 +0000
1523@@ -0,0 +1,188 @@
1524+/*
1525+ * Copyright © 2014 Canonical Ltd.
1526+ *
1527+ * This program is free software: you can redistribute it and/or modify it
1528+ * under the terms of the GNU Lesser General Public License version 3,
1529+ * as published by the Free Software Foundation.
1530+ *
1531+ * This program is distributed in the hope that it will be useful,
1532+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1533+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1534+ * GNU Lesser General Public License for more details.
1535+ *
1536+ * You should have received a copy of the GNU Lesser General Public License
1537+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1538+ *
1539+ * Authors:
1540+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1541+ */
1542+
1543+#include <ubuntu/connectivity/NetworkingStatus>
1544+#include "dbus-properties-interface.h"
1545+
1546+#include <QDBusConnection>
1547+#include <QDBusConnectionInterface>
1548+#include <QDBusInterface>
1549+#include <QDBusServiceWatcher>
1550+#include <QDBusMetaType>
1551+
1552+#include <QDebug>
1553+
1554+using namespace ubuntu::connectivity;
1555+
1556+#define SERVICE_NAME "com.ubuntu.connectivity1"
1557+#define SERVICE_INTERFACE "com.ubuntu.connectivity1.NetworkingStatus"
1558+#define SERVICE_PATH "/com/ubuntu/connectivity1/NetworkingStatus"
1559+
1560+
1561+class Q_DECL_HIDDEN NetworkingStatus::Private : public QObject
1562+{
1563+ Q_OBJECT
1564+
1565+public:
1566+ // Yes, it's raw.
1567+ NetworkingStatus *q;
1568+
1569+ QDBusConnection m_bus;
1570+
1571+ QVector<NetworkingStatus::Limitations> m_limitations;
1572+ NetworkingStatus::Status m_status;
1573+
1574+ QScopedPointer<QDBusServiceWatcher> m_watch;
1575+ QScopedPointer<QDBusInterface> m_interface;
1576+ QScopedPointer<DBusPropertiesInterface> m_properties_interface;
1577+
1578+ Private() = delete;
1579+ Private(NetworkingStatus *q)
1580+ : q{q},
1581+ m_bus{QDBusConnection::sessionBus()}
1582+ {
1583+ m_limitations = {};
1584+ m_status = Status::Online;
1585+
1586+ m_interface.reset(new QDBusInterface(SERVICE_NAME,
1587+ SERVICE_PATH,
1588+ SERVICE_INTERFACE,
1589+ m_bus));
1590+ m_properties_interface.reset(new DBusPropertiesInterface(SERVICE_NAME,
1591+ SERVICE_PATH,
1592+ m_bus));
1593+ connect(m_properties_interface.data(),
1594+ SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
1595+ this,
1596+ SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
1597+
1598+ m_watch.reset(new QDBusServiceWatcher(SERVICE_NAME,
1599+ m_bus,
1600+ QDBusServiceWatcher::WatchForOwnerChange));
1601+ connect(m_watch.data(), &QDBusServiceWatcher::serviceOwnerChanged, this, &Private::serviceOwnerChanged);
1602+ if (m_bus.interface()->isServiceRegistered(SERVICE_NAME)) {
1603+ serviceOwnerChanged(SERVICE_NAME,
1604+ "",
1605+ m_bus.interface()->serviceOwner(SERVICE_NAME).value());
1606+ } else {
1607+ serviceOwnerChanged(SERVICE_NAME, "", "");
1608+ }
1609+ }
1610+
1611+ void updateLimitations(QStringList values)
1612+ {
1613+ QVector<NetworkingStatus::Limitations> tmp;
1614+ for (auto str : values) {
1615+ if (str == "bandwith")
1616+ tmp << NetworkingStatus::Limitations::Bandwith;
1617+ else
1618+ qWarning() << __PRETTY_FUNCTION__ << ": Invalid limitation: " << str;
1619+ }
1620+ if (m_limitations == tmp)
1621+ return;
1622+ m_limitations = tmp;
1623+ Q_EMIT q->limitationsChanged();
1624+ }
1625+
1626+ void updateStatus(QString value)
1627+ {
1628+ NetworkingStatus::Status tmp;
1629+ if (value == "offline")
1630+ tmp = NetworkingStatus::Status::Offline;
1631+ else if (value == "connecting")
1632+ tmp = NetworkingStatus::Status::Connecting;
1633+ else if (value == "online")
1634+ tmp = NetworkingStatus::Status::Online;
1635+ else {
1636+ qWarning() << __PRETTY_FUNCTION__ << ": Invalid status: " << value;
1637+ return;
1638+ }
1639+
1640+ if (m_status == tmp)
1641+ return;
1642+ m_status = tmp;
1643+ Q_EMIT q->statusChanged(m_status);
1644+ }
1645+
1646+ void reset()
1647+ {
1648+ updateLimitations({});
1649+ updateStatus("online");
1650+ }
1651+
1652+public Q_SLOTS:
1653+ void serviceOwnerChanged(const QString &serviceName,
1654+ const QString &oldOwner,
1655+ const QString &newOwner)
1656+ {
1657+ Q_UNUSED(serviceName);
1658+ Q_UNUSED(oldOwner);
1659+ if (newOwner.isEmpty()) {
1660+ // disappeared
1661+ reset();
1662+ } else {
1663+ // appeared
1664+ updateLimitations(m_interface->property("Limitations").toStringList());
1665+ updateStatus(m_interface->property("Status").toString());
1666+ }
1667+ }
1668+
1669+ void propertiesChanged(const QString &interface_name,
1670+ const QVariantMap &changed_properties,
1671+ const QStringList &invalidated_properties)
1672+ {
1673+ Q_UNUSED(interface_name);
1674+ Q_UNUSED(invalidated_properties);
1675+
1676+ if (changed_properties.contains("Limitations")) {
1677+ updateLimitations(changed_properties["Limitations"].toStringList());
1678+ }
1679+
1680+ if (changed_properties.contains("Status")) {
1681+ updateStatus(changed_properties["Status"].toString());
1682+ }
1683+ }
1684+};
1685+
1686+NetworkingStatus::NetworkingStatus(QObject *parent)
1687+ : QObject(parent),
1688+ d{new Private(this)}
1689+{
1690+
1691+ qRegisterMetaType<ubuntu::connectivity::NetworkingStatus::Limitations>();
1692+ qRegisterMetaType<QVector<ubuntu::connectivity::NetworkingStatus::Limitations>>();
1693+ qRegisterMetaType<ubuntu::connectivity::NetworkingStatus::Status>();
1694+}
1695+
1696+NetworkingStatus::~NetworkingStatus()
1697+{}
1698+
1699+QVector<NetworkingStatus::Limitations>
1700+NetworkingStatus::limitations() const
1701+{
1702+ return d->m_limitations;
1703+}
1704+
1705+NetworkingStatus::Status
1706+NetworkingStatus::status() const
1707+{
1708+ return d->m_status;
1709+}
1710+
1711+#include "networking-status.moc"
1712
1713=== modified file 'src/secret-agent/CMakeLists.txt'
1714--- src/secret-agent/CMakeLists.txt 2013-10-14 21:00:54 +0000
1715+++ src/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
1716@@ -1,3 +1,4 @@
1717+set(CMAKE_AUTOMOC ON)
1718
1719 set(
1720 INDICATOR_SECRET_AGENT_SOURCES
1721
1722=== modified file 'src/secret-agent/PasswordMenu.cpp'
1723--- src/secret-agent/PasswordMenu.cpp 2014-03-28 15:47:23 +0000
1724+++ src/secret-agent/PasswordMenu.cpp 2014-08-15 11:57:07 +0000
1725@@ -28,8 +28,8 @@
1726 class PasswordMenuPriv {
1727 public:
1728 PasswordMenuPriv() :
1729- m_connection(g_bus_get_sync(G_BUS_TYPE_SESSION, NULL,
1730- NULL)), m_exportedActionGroupId(0), m_exportedMenuModelId(0) {
1731+ m_connection(g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr,
1732+ nullptr)), m_exportedActionGroupId(0), m_exportedMenuModelId(0) {
1733 }
1734
1735 ~PasswordMenuPriv() {
1736@@ -104,7 +104,7 @@
1737 exportrev++;
1738 p->m_actionPath = PASSWORD_ACTION_PATH.arg(exportrev);
1739 p->m_exportedActionGroupId = g_dbus_connection_export_action_group(
1740- p->m_connection, p->m_actionPath.toUtf8().data(), actions, NULL);
1741+ p->m_connection, p->m_actionPath.toUtf8().data(), actions, nullptr);
1742 } while (p->m_exportedActionGroupId == 0 && exportrev < 128);
1743
1744 /* Export the menu. If we can't get a name, keep trying to
1745@@ -116,7 +116,7 @@
1746 p->m_menuPath = PASSWORD_MENU_PATH.arg(exportrev);
1747 p->m_exportedMenuModelId = g_dbus_connection_export_menu_model(
1748 p->m_connection, p->m_menuPath.toUtf8().data(),
1749- G_MENU_MODEL(menu), NULL);
1750+ G_MENU_MODEL(menu), nullptr);
1751 } while (p->m_exportedMenuModelId == 0 && exportrev < 128);
1752
1753 /* Unref the objects as a reference is maintained by the fact that they're
1754
1755=== modified file 'tests/CMakeLists.txt'
1756--- tests/CMakeLists.txt 2014-05-02 08:44:47 +0000
1757+++ tests/CMakeLists.txt 2014-08-15 11:57:07 +0000
1758@@ -1,7 +1,5 @@
1759
1760-set(CMAKE_AUTOMOC OFF)
1761 include(FindGMock)
1762-set(CMAKE_AUTOMOC ON)
1763
1764 find_package("Valgrind" REQUIRED)
1765
1766
1767=== modified file 'tests/integration/CMakeLists.txt'
1768--- tests/integration/CMakeLists.txt 2014-04-01 16:12:16 +0000
1769+++ tests/integration/CMakeLists.txt 2014-08-15 11:57:07 +0000
1770@@ -1,3 +1,4 @@
1771+add_subdirectory(qt)
1772
1773 add_definitions(-DNETWORK_SERVICE_BIN="${CMAKE_BINARY_DIR}/network/indicator-network-service")
1774
1775
1776=== added directory 'tests/integration/qt'
1777=== added file 'tests/integration/qt/CMakeLists.txt'
1778--- tests/integration/qt/CMakeLists.txt 1970-01-01 00:00:00 +0000
1779+++ tests/integration/qt/CMakeLists.txt 2014-08-15 11:57:07 +0000
1780@@ -0,0 +1,4 @@
1781+set(CMAKE_AUTOMOC ON)
1782+
1783+add_subdirectory(cpp)
1784+add_subdirectory(qml)
1785
1786=== added directory 'tests/integration/qt/cpp'
1787=== added file 'tests/integration/qt/cpp/CMakeLists.txt'
1788--- tests/integration/qt/cpp/CMakeLists.txt 1970-01-01 00:00:00 +0000
1789+++ tests/integration/qt/cpp/CMakeLists.txt 2014-08-15 11:57:07 +0000
1790@@ -0,0 +1,16 @@
1791+
1792+include_directories(${CMAKE_SOURCE_DIR}/src/qt/include)
1793+set(TEST_SRCS
1794+ main.cpp
1795+ tst_networking.cpp
1796+)
1797+
1798+set(testCommand dbus-test-runner -t ${CMAKE_CURRENT_BINARY_DIR}/cpptest
1799+ -p -o -p ${CMAKE_BINARY_DIR}/cpptest.xml,xunitxml
1800+ -p -o -p -,txt)
1801+
1802+add_executable(cpptest ${TEST_SRCS})
1803+target_link_libraries(cpptest ${CONNECTIVITY_QT_LIB_TARGET})
1804+qt5_use_modules(cpptest Core Test)
1805+
1806+add_test(qtcpptests ${testCommand})
1807
1808=== added file 'tests/integration/qt/cpp/main.cpp'
1809--- tests/integration/qt/cpp/main.cpp 1970-01-01 00:00:00 +0000
1810+++ tests/integration/qt/cpp/main.cpp 2014-08-15 11:57:07 +0000
1811@@ -0,0 +1,33 @@
1812+/* This file is part of unity-action-api
1813+ * Copyright 2013 Canonical Ltd.
1814+ *
1815+ * unity-action-api is free software: you can redistribute it and/or modify it
1816+ * under the terms of the GNU Lesser General Public License version 3,
1817+ * as published by the Free Software Foundation.
1818+ *
1819+ * unity-action-api is distributed in the hope that it will be useful, but
1820+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1821+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1822+ * PURPOSE. See the GNU Lesser General Public License for more details.
1823+ *
1824+ * You should have received a copy of the GNU Lesser General Public License
1825+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1826+ */
1827+
1828+#include <QtTest/QtTest>
1829+#include <QCoreApplication>
1830+
1831+#include "tst_networking.h"
1832+
1833+int main(int argc, char *argv[])
1834+{
1835+ // needed for QTest::qWait
1836+ QCoreApplication app(argc, argv);
1837+
1838+ TestNetworking tst_networking;
1839+
1840+ if (QTest::qExec(&tst_networking, argc, argv) != 0)
1841+ return 1;
1842+
1843+ return 0;
1844+}
1845
1846=== added file 'tests/integration/qt/cpp/tst_networking.cpp'
1847--- tests/integration/qt/cpp/tst_networking.cpp 1970-01-01 00:00:00 +0000
1848+++ tests/integration/qt/cpp/tst_networking.cpp 2014-08-15 11:57:07 +0000
1849@@ -0,0 +1,51 @@
1850+/*
1851+ * Copyright © 2014 Canonical Ltd.
1852+ *
1853+ * This program is free software: you can redistribute it and/or modify it
1854+ * under the terms of the GNU Lesser General Public License version 3,
1855+ * as published by the Free Software Foundation.
1856+ *
1857+ * This program is distributed in the hope that it will be useful,
1858+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1859+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1860+ * GNU Lesser General Public License for more details.
1861+ *
1862+ * You should have received a copy of the GNU Lesser General Public License
1863+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1864+ *
1865+ * Authors:
1866+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1867+ */
1868+
1869+#include "tst_networking.h"
1870+
1871+#include <ubuntu/connectivity/NetworkingStatus>
1872+
1873+#include <QtTest/QtTest>
1874+
1875+void
1876+TestNetworking::initTestCase()
1877+{}
1878+
1879+void
1880+TestNetworking::cleanupTestCase()
1881+{}
1882+
1883+void
1884+TestNetworking::cleanup()
1885+{}
1886+
1887+
1888+void
1889+TestNetworking::testApi()
1890+{
1891+ using namespace ubuntu::connectivity;
1892+
1893+ auto ns = new NetworkingStatus();
1894+
1895+ QVERIFY(ns->metaObject()->indexOfProperty("limitations") != -1);
1896+ QVERIFY(ns->metaObject()->indexOfProperty("status") != -1);
1897+
1898+ QVERIFY(ns->limitations() == QVector<NetworkingStatus::Limitations>());
1899+ QVERIFY(ns->status() == NetworkingStatus::Online);
1900+}
1901
1902=== added file 'tests/integration/qt/cpp/tst_networking.h'
1903--- tests/integration/qt/cpp/tst_networking.h 1970-01-01 00:00:00 +0000
1904+++ tests/integration/qt/cpp/tst_networking.h 2014-08-15 11:57:07 +0000
1905@@ -0,0 +1,39 @@
1906+/*
1907+ * Copyright © 2014 Canonical Ltd.
1908+ *
1909+ * This program is free software: you can redistribute it and/or modify it
1910+ * under the terms of the GNU Lesser General Public License version 3,
1911+ * as published by the Free Software Foundation.
1912+ *
1913+ * This program is distributed in the hope that it will be useful,
1914+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1915+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1916+ * GNU Lesser General Public License for more details.
1917+ *
1918+ * You should have received a copy of the GNU Lesser General Public License
1919+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1920+ *
1921+ * Authors:
1922+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1923+ */
1924+
1925+#include <QObject>
1926+
1927+#include <ubuntu/connectivity/NetworkingStatus>
1928+
1929+
1930+class TestNetworking : public QObject
1931+{
1932+ Q_OBJECT
1933+
1934+private slots:
1935+ void initTestCase();
1936+ void cleanupTestCase();
1937+
1938+ void cleanup();
1939+
1940+ void testApi();
1941+
1942+private:
1943+};
1944+
1945
1946=== added directory 'tests/integration/qt/qml'
1947=== added file 'tests/integration/qt/qml/CMakeLists.txt'
1948--- tests/integration/qt/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
1949+++ tests/integration/qt/qml/CMakeLists.txt 2014-08-15 11:57:07 +0000
1950@@ -0,0 +1,19 @@
1951+add_custom_target(qmltests)
1952+
1953+find_program(qmltestrunner_exe qmltestrunner)
1954+
1955+if(NOT qmltestrunner_exe)
1956+ msg(FATAL_ERROR "Could not locate qmltestrunner.")
1957+endif()
1958+
1959+set(qmltest_command
1960+ dbus-test-runner -t env -p "QT_QPA_PLATFORM=minimal"
1961+ -p ${qmltestrunner_exe} -p -input -p ${CMAKE_CURRENT_SOURCE_DIR}/tst_api.qml
1962+ -p -import -p ${CMAKE_BINARY_DIR}/src/qt/qml
1963+ -p -o -p ${CMAKE_BINARY_DIR}/testapi.xml,xunitxml
1964+ -p -o -p -,txt
1965+)
1966+
1967+add_custom_target(qmltest_api ${qmltest_command})
1968+add_dependencies(qmltests qmltest_api)
1969+add_test(qmltests ${qmltest_command})
1970
1971=== added file 'tests/integration/qt/qml/tst_api.qml'
1972--- tests/integration/qt/qml/tst_api.qml 1970-01-01 00:00:00 +0000
1973+++ tests/integration/qt/qml/tst_api.qml 2014-08-15 11:57:07 +0000
1974@@ -0,0 +1,53 @@
1975+/*
1976+ * Copyright © 2014 Canonical Ltd.
1977+ *
1978+ * This program is free software: you can redistribute it and/or modify it
1979+ * under the terms of the GNU Lesser General Public License version 3,
1980+ * as published by the Free Software Foundation.
1981+ *
1982+ * This program is distributed in the hope that it will be useful,
1983+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1984+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1985+ * GNU Lesser General Public License for more details.
1986+ *
1987+ * You should have received a copy of the GNU Lesser General Public License
1988+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1989+ *
1990+ * Authors:
1991+ * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
1992+ */
1993+
1994+import Ubuntu.Connectivity 1.0
1995+import QtQuick 2.0
1996+import QtTest 1.0
1997+
1998+/* This test will make sure there are no unintentional changes to the
1999+ * schemantics of the API (default properties work as expected, etc)
2000+ * so that any files written to the prior release of the library
2001+ * will not bail out when loaded resulting in client applications failing
2002+ * to start.
2003+ */
2004+Item {
2005+
2006+ NetworkingStatus {
2007+ id: networkingStatus
2008+ onStatusChanged: {}
2009+ onLimitationsChanged: {}
2010+ onOnlineChanged: {}
2011+ onLimitedBandwithChanged: {}
2012+ }
2013+
2014+ TestCase {
2015+ name: "API Test"
2016+ id: test_api
2017+
2018+ property int status : networkingStatus.status
2019+ property int online : networkingStatus.online
2020+ property int limitedBandwith : networkingStatus.limitedBandwith
2021+
2022+ function test_api() {
2023+ // just make sure this file can be loaded properly by the QmlEngine.
2024+ verify(1)
2025+ }
2026+ }
2027+}
2028
2029=== modified file 'tests/unit/secret-agent/CMakeLists.txt'
2030--- tests/unit/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
2031+++ tests/unit/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
2032@@ -1,3 +1,4 @@
2033+set(CMAKE_AUTOMOC ON)
2034
2035 include_directories("${CMAKE_SOURCE_DIR}/src/secret-agent")
2036 include_directories("${CMAKE_BINARY_DIR}/src/secret-agent")

Subscribers

People subscribed via source and target branches