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
=== modified file '.bzrignore'
--- .bzrignore 2014-03-25 23:22:16 +0000
+++ .bzrignore 2014-08-15 11:57:07 +0000
@@ -1,3 +1,10 @@
1*.autosave1*.autosave
2CMakeLists.txt.user2CMakeLists.txt.user*
3CMakeLists.txt.user.3.0-pre13*~
4/.cproject
5/.project
6/.pydevproject
7/.settings
8/build
9/buildclang
10
411
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-08-15 11:57:07 +0000
+++ CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -4,8 +4,8 @@
4set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")4set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
55
6find_package(PkgConfig REQUIRED)6find_package(PkgConfig REQUIRED)
7include(EnableCoverageReport)
7include(GNUInstallDirs)8include(GNUInstallDirs)
8include(Coverage)
9include(UseGSettings)9include(UseGSettings)
1010
11set(GETTEXT_PACKAGE indicator-network)11set(GETTEXT_PACKAGE indicator-network)
@@ -82,28 +82,49 @@
82pkg_check_modules(GIO REQUIRED gio-2.0>=${GLIB_REQUIRED_VERSION})82pkg_check_modules(GIO REQUIRED gio-2.0>=${GLIB_REQUIRED_VERSION})
83include_directories(${GIO_INCLUDE_DIRS})83include_directories(${GIO_INCLUDE_DIRS})
8484
85set(CMAKE_AUTOMOC ON)
86set(CMAKE_INCLUDE_CURRENT_DIR ON)85set(CMAKE_INCLUDE_CURRENT_DIR ON)
8786
88find_package(GObjectIntrospection 0.9.12)87find_package(GObjectIntrospection 0.9.12)
8988
90include_directories(${CMAKE_BINARY_DIR})89include_directories(${CMAKE_BINARY_DIR})
9190
92set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")91set(COMMON_FLAGS "-Wall -Wextra -Wpedantic -fno-permissive")
93set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")92string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
93if(NOT BUILD_TYPE MATCHES debug)
94 set(COMMON_FLAGS "${COMMON_FLAGS} -Werror")
95endif()
9496
95add_definitions(97# "nice bug" in cmake... http://www.cmake.org/Bug/view.php?id=15058
96 -Wall98# let's not set C_FLAGS as it will break pthreads detection \o/
97 -Wextra99#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${COMMON_FLAGS}")
98 -Wpedantic100set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${COMMON_FLAGS}")
99)
100101
101configure_file(102configure_file(
102 "config.h.in"103 "config.h.in"
103 "config.h"104 "config.h"
104)105)
105106
107#####################################################################
108# Enable code coverage calculation with gcov/gcovr/lcov
109# Usage:
110# * Switch build type to coverage (use ccmake or cmake-gui)
111# * Invoke make, make test, make coverage
112# * Find html report in subdir coveragereport
113# * Find xml report feasible for jenkins in coverage.xml
114#####################################################################
115IF(BUILD_TYPE MATCHES coverage)
116 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs" )
117 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs" )
118 SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
119 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs" )
120ENDIF()
121
122
123set(CONNECTIVITY_QT_VERSION_MAJOR 1)
124set(CONNECTIVITY_QT_VERSION_MINOR 0)
125set(CONNECTIVITY_QT_LIB_TARGET connectivity-qt${CONNECTIVITY_QT_VERSION_MAJOR})
106add_subdirectory(data)126add_subdirectory(data)
127#add_subdirectory(doc)
107add_subdirectory(src)128add_subdirectory(src)
108add_subdirectory(po)129add_subdirectory(po)
109130
@@ -115,3 +136,5 @@
115 ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure136 ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure
116)137)
117138
139enable_coverage_report(TARGETS connectivity-qt1 menumodel_cpp indicator-secret-agent
140 FILTER ${CMAKE_SOURCE_DIR}/tests/* ${CMAKE_BINARY_DIR}/*)
118141
=== removed file 'cmake/Coverage.cmake'
--- cmake/Coverage.cmake 2013-08-27 13:48:41 +0000
+++ cmake/Coverage.cmake 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
1if (CMAKE_BUILD_TYPE MATCHES coverage)
2 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
3 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
4 set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --coverage")
5 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
6
7 find_program(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
8 if (NOT GCOVR_EXECUTABLE)
9 message(STATUS "Gcovr binary was not found, can not generate XML coverage info.")
10 else ()
11 message(STATUS "Gcovr found, can generate XML coverage info.")
12 add_custom_target (coverage-xml
13 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
14 COMMAND "${GCOVR_EXECUTABLE}" --exclude="test.*" --exclude="obj.*" -x -r "${CMAKE_SOURCE_DIR}"
15 --object-directory=${CMAKE_BINARY_DIR} -o coverage.xml)
16 endif()
17
18 find_program(LCOV_EXECUTABLE lcov HINTS ${LCOV_ROOT} "${GCOVR_ROOT}/bin")
19 find_program(GENHTML_EXECUTABLE genhtml HINTS ${GENHTML_ROOT})
20 if (NOT LCOV_EXECUTABLE)
21 message(STATUS "Lcov binary was not found, can not generate HTML coverage info.")
22 else ()
23 if(NOT GENHTML_EXECUTABLE)
24 message(STATUS "Genthml binary not found, can not generate HTML coverage info.")
25 else()
26 message(STATUS "Lcov and genhtml found, can generate HTML coverage info.")
27 add_custom_target (coverage-html
28 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
29 COMMAND "${LCOV_EXECUTABLE}" --capture --output-file "${CMAKE_BINARY_DIR}/coverage.info" --no-checksum --directory "${CMAKE_BINARY_DIR}"
30 COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '/usr/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
31 COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_BINARY_DIR}/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
32 COMMAND "${LCOV_EXECUTABLE}" --remove "${CMAKE_BINARY_DIR}/coverage.info" '${CMAKE_SOURCE_DIR}/tests/*' --output-file "${CMAKE_BINARY_DIR}/coverage.info"
33 COMMAND "${GENHTML_EXECUTABLE}" --prefix "${CMAKE_BINARY_DIR}" --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info
34 )
35 endif()
36 endif()
37endif()
380
=== added file 'cmake/EnableCoverageReport.cmake'
--- cmake/EnableCoverageReport.cmake 1970-01-01 00:00:00 +0000
+++ cmake/EnableCoverageReport.cmake 2014-08-15 11:57:07 +0000
@@ -0,0 +1,153 @@
1# - Creates a special coverage build type and target on GCC.
2#
3# Defines a function ENABLE_COVERAGE_REPORT which generates the coverage target
4# for selected targets. Optional arguments to this function are used to filter
5# unwanted results using globbing expressions. Moreover targets with tests for
6# the source code can be specified to trigger regenerating the report if the
7# test has changed
8#
9# ENABLE_COVERAGE_REPORT(TARGETS target... [FILTER filter...] [TESTS test targets...])
10#
11# To generate a coverage report first build the project with
12# CMAKE_BUILD_TYPE=coverage, then call make test and afterwards make coverage.
13#
14# The coverage report is based on gcov. Depending on the availability of lcov
15# a HTML report will be generated and/or an XML report of gcovr is found.
16# The generated coverage target executes all found solutions. Special targets
17# exist to create e.g. only the xml report: coverage-xml.
18#
19# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
20#
21# This program is free software; you can redistribute it
22# and/or modify it under the terms of the GNU General
23# Public License as published by the Free Software Foundation;
24# either version 2, or (at your option)
25# any later version.
26#
27# This program is distributed in the hope that it will be useful,
28# but WITHOUT ANY WARRANTY; without even the implied warranty of
29# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30# GNU General Public License for more details.
31#
32
33INCLUDE(ParseArguments)
34
35FIND_PACKAGE(Lcov)
36FIND_PACKAGE(gcovr)
37
38FUNCTION(ENABLE_COVERAGE_REPORT)
39
40 # argument parsing
41 PARSE_ARGUMENTS(ARG "FILTER;TARGETS;TESTS" "" ${ARGN})
42
43 SET(COVERAGE_RAW_FILE "${CMAKE_BINARY_DIR}/coverage.raw.info")
44 SET(COVERAGE_FILTERED_FILE "${CMAKE_BINARY_DIR}/coverage.info")
45 SET(COVERAGE_REPORT_DIR "${CMAKE_BINARY_DIR}/coveragereport")
46 SET(COVERAGE_XML_FILE "${CMAKE_BINARY_DIR}/coverage.xml")
47 SET(COVERAGE_XML_COMMAND_FILE "${CMAKE_BINARY_DIR}/coverage-xml.cmake")
48
49 # decide if there is any tool to create coverage data
50 SET(TOOL_FOUND FALSE)
51 IF(LCOV_FOUND OR GCOVR_FOUND)
52 SET(TOOL_FOUND TRUE)
53 ENDIF()
54 IF(NOT TOOL_FOUND)
55 MESSAGE(STATUS "Cannot enable coverage targets because neither lcov nor gcovr are found.")
56 ENDIF()
57
58 STRING(TOLOWER "${CMAKE_BUILD_TYPE}" COVERAGE_BUILD_TYPE)
59 IF(CMAKE_COMPILER_IS_GNUCXX AND TOOL_FOUND AND "${COVERAGE_BUILD_TYPE}" MATCHES "coverage")
60
61 MESSAGE(STATUS "Coverage support enabled for targets: ${ARG_TARGETS}")
62
63 # create coverage build type
64 SET(CMAKE_CXX_FLAGS_COVERAGE ${CMAKE_CXX_FLAGS_DEBUG} PARENT_SCOPE)
65 SET(CMAKE_C_FLAGS_COVERAGE ${CMAKE_C_FLAGS_DEBUG} PARENT_SCOPE)
66 SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_CONFIGURATION_TYPES} coverage PARENT_SCOPE)
67
68 # instrument targets
69 SET_TARGET_PROPERTIES(${ARG_TARGETS} PROPERTIES COMPILE_FLAGS --coverage
70 LINK_FLAGS --coverage)
71
72 # html report
73 IF (LCOV_FOUND)
74
75 MESSAGE(STATUS "Enabling HTML coverage report")
76
77 # set up coverage target
78
79 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_RAW_FILE}
80 COMMAND ${LCOV_EXECUTABLE} -c -d ${CMAKE_BINARY_DIR} -o ${COVERAGE_RAW_FILE}
81 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
82 COMMENT "Collecting coverage data"
83 DEPENDS ${ARG_TARGETS} ${ARG_TESTS}
84 VERBATIM)
85
86 # filter unwanted stuff
87 LIST(LENGTH ARG_FILTER FILTER_LENGTH)
88 IF(${FILTER_LENGTH} GREATER 0)
89 SET(FILTER COMMAND ${LCOV_EXECUTABLE})
90 FOREACH(F ${ARG_FILTER})
91 SET(FILTER ${FILTER} -r ${COVERAGE_FILTERED_FILE} ${F})
92 ENDFOREACH()
93 SET(FILTER ${FILTER} -o ${COVERAGE_FILTERED_FILE})
94 ELSE()
95 SET(FILTER "")
96 ENDIF()
97
98 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_FILTERED_FILE}
99 COMMAND ${LCOV_EXECUTABLE} -e ${COVERAGE_RAW_FILE} "${CMAKE_SOURCE_DIR}*" -o ${COVERAGE_FILTERED_FILE}
100 ${FILTER}
101 DEPENDS ${COVERAGE_RAW_FILE}
102 COMMENT "Filtering recorded coverage data for project-relevant entries"
103 VERBATIM)
104 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_REPORT_DIR}
105 COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_REPORT_DIR}
106 COMMAND ${GENHTML_EXECUTABLE} --legend --show-details -t "${PROJECT_NAME} test coverage" -o ${COVERAGE_REPORT_DIR} ${COVERAGE_FILTERED_FILE}
107 DEPENDS ${COVERAGE_FILTERED_FILE}
108 COMMENT "Generating HTML coverage report in ${COVERAGE_REPORT_DIR}"
109 VERBATIM)
110
111 ADD_CUSTOM_TARGET(coverage-html
112 DEPENDS ${COVERAGE_REPORT_DIR})
113
114 ENDIF()
115
116 # xml coverage report
117 IF(GCOVR_FOUND)
118
119 MESSAGE(STATUS "Enabling XML coverage report")
120
121 # gcovr cannot write directly to a file so the execution needs to
122 # be wrapped in a cmake file that generates the file output
123 FILE(WRITE ${COVERAGE_XML_COMMAND_FILE}
124 "SET(ENV{LANG} en)\n")
125 FILE(APPEND ${COVERAGE_XML_COMMAND_FILE}
126 "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")
127
128 ADD_CUSTOM_COMMAND(OUTPUT ${COVERAGE_XML_FILE}
129 COMMAND ${CMAKE_COMMAND} ARGS -P ${COVERAGE_XML_COMMAND_FILE}
130 COMMENT "Generating coverage XML report"
131 VERBATIM)
132
133 ADD_CUSTOM_TARGET(coverage-xml
134 DEPENDS ${COVERAGE_XML_FILE})
135
136 ENDIF()
137
138 # provide a global coverage target executing both steps if available
139 SET(GLOBAL_DEPENDS "")
140 IF(LCOV_FOUND)
141 LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_REPORT_DIR})
142 ENDIF()
143 IF(GCOVR_FOUND)
144 LIST(APPEND GLOBAL_DEPENDS ${COVERAGE_XML_FILE})
145 ENDIF()
146 IF(LCOV_FOUND OR GCOVR_FOUND)
147 ADD_CUSTOM_TARGET(coverage
148 DEPENDS ${GLOBAL_DEPENDS})
149 ENDIF()
150
151 ENDIF()
152
153ENDFUNCTION()
0154
=== added file 'cmake/FindLcov.cmake'
--- cmake/FindLcov.cmake 1970-01-01 00:00:00 +0000
+++ cmake/FindLcov.cmake 2014-08-15 11:57:07 +0000
@@ -0,0 +1,29 @@
1# - Find lcov
2# Will define:
3#
4# LCOV_EXECUTABLE - the lcov binary
5# GENHTML_EXECUTABLE - the genhtml executable
6#
7# Copyright (C) 2010 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
8#
9# This program is free software; you can redistribute it
10# and/or modify it under the terms of the GNU General
11# Public License as published by the Free Software Foundation;
12# either version 2, or (at your option)
13# any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20
21INCLUDE(FindPackageHandleStandardArgs)
22
23FIND_PROGRAM(LCOV_EXECUTABLE lcov)
24FIND_PROGRAM(GENHTML_EXECUTABLE genhtml)
25
26FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lcov DEFAULT_MSG LCOV_EXECUTABLE GENHTML_EXECUTABLE)
27
28# only visible in advanced view
29MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
030
=== added file 'cmake/Findgcovr.cmake'
--- cmake/Findgcovr.cmake 1970-01-01 00:00:00 +0000
+++ cmake/Findgcovr.cmake 2014-08-15 11:57:07 +0000
@@ -0,0 +1,31 @@
1# - Find gcovr scrip
2# Will define:
3#
4# GCOVR_EXECUTABLE - the gcovr script
5#
6# Uses:
7#
8# GCOVR_ROOT - root to search for the script
9#
10# Copyright (C) 2011 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
11#
12# This program is free software; you can redistribute it
13# and/or modify it under the terms of the GNU General
14# Public License as published by the Free Software Foundation;
15# either version 2, or (at your option)
16# any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23
24INCLUDE(FindPackageHandleStandardArgs)
25
26FIND_PROGRAM(GCOVR_EXECUTABLE gcovr HINTS ${GCOVR_ROOT} "${GCOVR_ROOT}/bin")
27
28FIND_PACKAGE_HANDLE_STANDARD_ARGS(gcovr DEFAULT_MSG GCOVR_EXECUTABLE)
29
30# only visible in advanced view
31MARK_AS_ADVANCED(GCOVR_EXECUTABLE)
032
=== added file 'cmake/ParseArguments.cmake'
--- cmake/ParseArguments.cmake 1970-01-01 00:00:00 +0000
+++ cmake/ParseArguments.cmake 2014-08-15 11:57:07 +0000
@@ -0,0 +1,52 @@
1# Parse arguments passed to a function into several lists separated by
2# upper-case identifiers and options that do not have an associated list e.g.:
3#
4# SET(arguments
5# hello OPTION3 world
6# LIST3 foo bar
7# OPTION2
8# LIST1 fuz baz
9# )
10# PARSE_ARGUMENTS(ARG "LIST1;LIST2;LIST3" "OPTION1;OPTION2;OPTION3" ${arguments})
11#
12# results in 7 distinct variables:
13# * ARG_DEFAULT_ARGS: hello;world
14# * ARG_LIST1: fuz;baz
15# * ARG_LIST2:
16# * ARG_LIST3: foo;bar
17# * ARG_OPTION1: FALSE
18# * ARG_OPTION2: TRUE
19# * ARG_OPTION3: TRUE
20#
21# taken from http://www.cmake.org/Wiki/CMakeMacroParseArguments
22
23MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
24 SET(DEFAULT_ARGS)
25 FOREACH(arg_name ${arg_names})
26 SET(${prefix}_${arg_name})
27 ENDFOREACH(arg_name)
28 FOREACH(option ${option_names})
29 SET(${prefix}_${option} FALSE)
30 ENDFOREACH(option)
31
32 SET(current_arg_name DEFAULT_ARGS)
33 SET(current_arg_list)
34 FOREACH(arg ${ARGN})
35 SET(larg_names ${arg_names})
36 LIST(FIND larg_names "${arg}" is_arg_name)
37 IF (is_arg_name GREATER -1)
38 SET(${prefix}_${current_arg_name} ${current_arg_list})
39 SET(current_arg_name ${arg})
40 SET(current_arg_list)
41 ELSE (is_arg_name GREATER -1)
42 SET(loption_names ${option_names})
43 LIST(FIND loption_names "${arg}" is_option)
44 IF (is_option GREATER -1)
45 SET(${prefix}_${arg} TRUE)
46 ELSE (is_option GREATER -1)
47 SET(current_arg_list ${current_arg_list} ${arg})
48 ENDIF (is_option GREATER -1)
49 ENDIF (is_arg_name GREATER -1)
50 ENDFOREACH(arg)
51 SET(${prefix}_${current_arg_name} ${current_arg_list})
52ENDMACRO(PARSE_ARGUMENTS)
053
=== added file 'debian/connectivity-doc.install'
--- debian/connectivity-doc.install 1970-01-01 00:00:00 +0000
+++ debian/connectivity-doc.install 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1usr/share/doc/libconnectivity/*
02
=== modified file 'debian/control'
--- debian/control 2014-08-06 12:22:27 +0000
+++ debian/control 2014-08-15 11:57:07 +0000
@@ -9,6 +9,7 @@
9 g++-4.9,9 g++-4.9,
10 debhelper (>= 9.0.0),10 debhelper (>= 9.0.0),
11 google-mock (>= 1.6.0+svn437),11 google-mock (>= 1.6.0+svn437),
12 dbus-test-runner,
12 libconnectivity-cpp-dev (>=0.0.1+14.10.20140709),13 libconnectivity-cpp-dev (>=0.0.1+14.10.20140709),
13 libdbus-cpp-dev (>= 4.0.0),14 libdbus-cpp-dev (>= 4.0.0),
14 libglib2.0-dev,15 libglib2.0-dev,
@@ -24,7 +25,13 @@
24 pkg-config,25 pkg-config,
25 python3-dbusmock,26 python3-dbusmock,
26 python3-setuptools,27 python3-setuptools,
28 qt5-default,
27 qtbase5-dev,29 qtbase5-dev,
30 qtbase5-dev-tools,
31 qtdeclarative5-dev,
32 qtdeclarative5-dev-tools,
33 qtdeclarative5-qtquick2-plugin,
34 qtdeclarative5-test-plugin,
28 valgrind [amd64 armhf i386 powerpc],35 valgrind [amd64 armhf i386 powerpc],
29Standards-Version: 3.9.336Standards-Version: 3.9.3
30# If you aren't a member of ~indicator-applet-developers but need to upload37# If you aren't a member of ~indicator-applet-developers but need to upload
@@ -60,3 +67,49 @@
60Description: Autopilot tests for the network indicator for Ubuntu67Description: Autopilot tests for the network indicator for Ubuntu
61 The Indicator-network service is responsible for exporting the system settings68 The Indicator-network service is responsible for exporting the system settings
62 menu through dbus. This package contains its autopilot tests.69 menu through dbus. This package contains its autopilot tests.
70
71Package: libconnectivity-qt1
72Architecture: any
73Pre-Depends: ${misc:Pre-Depends}
74Multi-Arch: same
75Depends: ${misc:Depends},
76 ${shlibs:Depends},
77Description: Unity Action Qt API
78 Ubuntu Connectivity API - Qt bindings
79
80Package: libconnectivity-qt1-dev
81Section: libdevel
82Architecture: any
83Pre-Depends: ${misc:Pre-Depends}
84Multi-Arch: same
85Depends: ${misc:Depends},
86 ${shlibs:Depends},
87 libconnectivity-qt1 (= ${binary:Version}),
88 qtbase5-dev
89Suggests: unity-action-doc,
90Description: Unity Action Qt API - development files
91 Ubuntu Connectivity API - Qt bindings
92 .
93 This package contains development files to develop against the Qt library.
94
95Package: qtdeclarative5-connectivity-plugin
96Architecture: any
97Pre-Depends: ${misc:Pre-Depends}
98Multi-Arch: same
99Depends: ${misc:Depends},
100 ${shlibs:Depends},
101 libconnectivity-qt1 (= ${binary:Version}),
102Description: Unity Action QML Components
103 Ubuntu Connectivity API - QML bindings
104 .
105 This package contains the qtdeclarative bindings for Ubuntu connectivity API.
106
107#Package: connectivity-doc
108#Section: doc
109#Architecture: all
110#Depends: ${misc:Depends},
111# ${shlibs:Depends},
112#Description: Unity Action API - documentation
113# Ubuntu Connectivity API
114# .
115# This package contains developer documentation.
63116
=== added file 'debian/libconnectivity-qt1-dev.install'
--- debian/libconnectivity-qt1-dev.install 1970-01-01 00:00:00 +0000
+++ debian/libconnectivity-qt1-dev.install 2014-08-15 11:57:07 +0000
@@ -0,0 +1,3 @@
1usr/lib/*/libconnectivity-qt1.so
2usr/include/*
3usr/lib/*/pkgconfig/*
04
=== added file 'debian/libconnectivity-qt1.install'
--- debian/libconnectivity-qt1.install 1970-01-01 00:00:00 +0000
+++ debian/libconnectivity-qt1.install 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/libconnectivity-qt1.so.*
02
=== added file 'debian/qtdeclarative5-connectivity-plugin.install'
--- debian/qtdeclarative5-connectivity-plugin.install 1970-01-01 00:00:00 +0000
+++ debian/qtdeclarative5-connectivity-plugin.install 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1usr/lib/*/qt5/qml
02
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2014-08-15 11:57:07 +0000
+++ src/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -2,5 +2,6 @@
2add_subdirectory(indicator)2add_subdirectory(indicator)
3add_subdirectory(menumodel-cpp)3add_subdirectory(menumodel-cpp)
4add_subdirectory(notify-cpp)4add_subdirectory(notify-cpp)
5add_subdirectory(qt)
5add_subdirectory(secret-agent)6add_subdirectory(secret-agent)
6add_subdirectory(url-dispatcher-cpp)7add_subdirectory(url-dispatcher-cpp)
78
=== modified file 'src/dbus-cpp/services/ofono.h'
--- src/dbus-cpp/services/ofono.h 2014-08-05 17:02:58 +0000
+++ src/dbus-cpp/services/ofono.h 2014-08-15 11:57:07 +0000
@@ -198,7 +198,7 @@
198 }198 }
199199
200 typedef std::shared_ptr<NetworkRegistration> Ptr;200 typedef std::shared_ptr<NetworkRegistration> Ptr;
201 NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object)201 explicit NetworkRegistration(const std::shared_ptr<core::dbus::Object>& object)
202 : object(object),202 : object(object),
203 propertyChanged(object->get_signal<Signal::PropertyChanged>())203 propertyChanged(object->get_signal<Signal::PropertyChanged>())
204 {204 {
@@ -722,7 +722,7 @@
722 }722 }
723723
724 typedef std::shared_ptr<SimManager> Ptr;724 typedef std::shared_ptr<SimManager> Ptr;
725 SimManager(const std::shared_ptr<core::dbus::Object>& object)725 explicit SimManager(const std::shared_ptr<core::dbus::Object>& object)
726 : object(object),726 : object(object),
727 propertyChanged(object->get_signal<Signal::PropertyChanged>())727 propertyChanged(object->get_signal<Signal::PropertyChanged>())
728 {728 {
@@ -1296,7 +1296,7 @@
1296 }1296 }
12971297
12981298
1299 Service(const core::dbus::Bus::Ptr& bus)1299 explicit Service(const core::dbus::Bus::Ptr& bus)
1300 {1300 {
1301 auto service = core::dbus::Service::use_service<Service>(bus);1301 auto service = core::dbus::Service::use_service<Service>(bus);
1302 auto object = service->object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));1302 auto object = service->object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));
@@ -1307,7 +1307,7 @@
1307 {1307 {
1308 std::shared_ptr<Interface::Manager> manager;1308 std::shared_ptr<Interface::Manager> manager;
13091309
1310 Mock(const core::dbus::Bus::Ptr& bus)1310 explicit Mock(const core::dbus::Bus::Ptr& bus)
1311 {1311 {
1312 auto service = core::dbus::Service::add_service<Service>(bus);1312 auto service = core::dbus::Service::add_service<Service>(bus);
1313 auto object = service->add_object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));1313 auto object = service->add_object_for_path(core::dbus::types::ObjectPath(OFONO_MANAGER_PATH));
13141314
=== modified file 'src/indicator/connectivity-service/connectivity-service.cpp'
--- src/indicator/connectivity-service/connectivity-service.cpp 2014-08-15 11:57:07 +0000
+++ src/indicator/connectivity-service/connectivity-service.cpp 2014-08-15 11:57:07 +0000
@@ -32,7 +32,7 @@
32{32{
33 std::ostringstream output;33 std::ostringstream output;
3434
35 output << "<property ";35 output << " <property ";
36 output << "name=\"" << T::name() << "\" ";36 output << "name=\"" << T::name() << "\" ";
37 output << "type=\"" << core::dbus::helper::TypeMapper<typename T::ValueType>::signature() << "\" ";37 output << "type=\"" << core::dbus::helper::TypeMapper<typename T::ValueType>::signature() << "\" ";
3838
@@ -252,46 +252,48 @@
252 std::ostringstream output;252 std::ostringstream output;
253253
254 static const std::string header(254 static const std::string header(
255 "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\n"255 "<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\"\n"
256 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"256 "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
257 "<node>\n"257
258 static const std::string introspectable_interface(
258 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"259 " <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
259 " <method name=\"Introspect\">\n"260 " <method name=\"Introspect\">\n"
260 " <arg name=\"data\" direction=\"out\" type=\"s\"/>\n"261 " <arg name=\"xml_data\" direction=\"out\" type=\"s\"/>\n"
261 " </method>\n"262 " </method>\n"
262 " </interface>\n"263 " </interface>\n");
264
265 static const std::string dbus_properties_interface(
263 " <interface name=\"org.freedesktop.DBus.Properties\">\n"266 " <interface name=\"org.freedesktop.DBus.Properties\">\n"
264 " <method name=\"Get\">\n"267 " <method name=\"Get\">\n"
265 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"268 " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
266 " <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n"269 " <arg name=\"property_name\" direction=\"in\" type=\"s\"/>\n"
267 " <arg name=\"value\" direction=\"out\" type=\"v\"/>\n"270 " <arg name=\"value\" direction=\"out\" type=\"v\"/>\n"
268 " </method>\n"271 " </method>\n"
269 " <method name=\"Set\">\n"272 " <method name=\"Set\">\n"
270 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"273 " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
271 " <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n"274 " <arg name=\"property_name\" direction=\"in\" type=\"s\"/>\n"
272 " <arg name=\"value\" direction=\"in\" type=\"v\"/>\n"275 " <arg name=\"value\" direction=\"in\" type=\"v\"/>\n"
273 " </method>\n"276 " </method>\n"
274 " <method name=\"GetAll\">\n"277 " <method name=\"GetAll\">\n"
275 " <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n"278 " <arg name=\"interface_name\" direction=\"in\" type=\"s\"/>\n"
276 " <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n"279 " <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n"
277 " </method>\n"280 " </method>\n"
278 " <signal name=\"PropertiesChanged\"\n>"281 " <signal name=\"PropertiesChanged\">\n"
279 " <arg type=\"s\" name=\"interface_name\"/>\n"282 " <arg type=\"s\" name=\"interface_name\"/>\n"
280 " <arg type=\"a{sv}\" name=\"changed_properties\"/>\n"283 " <arg type=\"a{sv}\" name=\"changed_properties\"/>\n"
281 " <arg type=\"as\" name=\"invalidated_properties\"/>\n"284 " <arg type=\"as\" name=\"invalidated_properties\"/>\n"
282 " </signal>\n"285 " </signal>\n"
283 " </interface>\n");286 " </interface>\n");
284287
285 static const std::string footer("</node>\n");
286
287 output << header;288 output << header;
288289 output << "<node name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::path() << "\">\n";
289 output << "<interface name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::name() << "\">\n";290 output << introspectable_interface;
291 output << dbus_properties_interface;
292 output << " <interface name=\"" << com::ubuntu::connectivity::Interface::NetworkingStatus::name() << "\">\n";
290 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Limitations>() << std::endl;293 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Limitations>() << std::endl;
291 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Status>() << std::endl;294 output << generatePropertyIntrospectionXml<com::ubuntu::connectivity::Interface::NetworkingStatus::Property::Status>() << std::endl;
292 output << "</interface>\n";295 output << " </interface>\n";
293296 output << "</node>\n";
294 output << footer;
295297
296 return output.str();298 return output.str();
297}299}
298300
=== modified file 'src/indicator/indicator-menu.h'
--- src/indicator/indicator-menu.h 2014-06-05 14:12:19 +0000
+++ src/indicator/indicator-menu.h 2014-08-15 11:57:07 +0000
@@ -33,6 +33,8 @@
33 typedef std::shared_ptr<IndicatorMenu> Ptr;33 typedef std::shared_ptr<IndicatorMenu> Ptr;
3434
35 IndicatorMenu() = delete;35 IndicatorMenu() = delete;
36 virtual ~IndicatorMenu() = default;
37
36 IndicatorMenu(RootState::Ptr rootState, const std::string &prefix)38 IndicatorMenu(RootState::Ptr rootState, const std::string &prefix)
37 : m_rootState{rootState},39 : m_rootState{rootState},
38 m_prefix{prefix}40 m_prefix{prefix}
@@ -60,8 +62,6 @@
60 m_rootMenu->append(m_rootItem);62 m_rootMenu->append(m_rootItem);
61 }63 }
6264
63 virtual ~IndicatorMenu() {}
64
65 virtual void65 virtual void
66 addSection(Section::Ptr section)66 addSection(Section::Ptr section)
67 {67 {
6868
=== modified file 'src/indicator/indicator-network-service.cpp'
--- src/indicator/indicator-network-service.cpp 2014-08-15 11:57:07 +0000
+++ src/indicator/indicator-network-service.cpp 2014-08-15 11:57:07 +0000
@@ -35,7 +35,7 @@
35{35{
36 GMainLoop *ptr;36 GMainLoop *ptr;
37public:37public:
38 MainLoop() { ptr = g_main_loop_new(NULL, FALSE); }38 MainLoop() { ptr = g_main_loop_new(nullptr, FALSE); }
39 ~MainLoop() { g_main_loop_unref(ptr); }39 ~MainLoop() { g_main_loop_unref(ptr); }
4040
41 void run() { g_main_loop_run(ptr); }41 void run() { g_main_loop_run(ptr); }
@@ -89,12 +89,12 @@
89 connectivityService->unlockAllModems().connect([menu](){ menu->unlockAllModems(); });89 connectivityService->unlockAllModems().connect([menu](){ menu->unlockAllModems(); });
9090
91 if (getenv("VALGRIND") != 0) {91 if (getenv("VALGRIND") != 0) {
92 g_timeout_add(1000, (GSourceFunc)stop_main_loop, NULL);92 g_timeout_add(1000, (GSourceFunc)stop_main_loop, nullptr);
93 mainloop.run();93 mainloop.run();
9494
95 menu.reset();95 menu.reset();
96 // give gio time to do cleanup.96 // give gio time to do cleanup.
97 g_timeout_add(500, (GSourceFunc)stop_main_loop, NULL);97 g_timeout_add(500, (GSourceFunc)stop_main_loop, nullptr);
98 mainloop.run();98 mainloop.run();
99 } else {99 } else {
100 mainloop.run();100 mainloop.run();
101101
=== modified file 'src/indicator/menuitems/access-point-item.h'
--- src/indicator/menuitems/access-point-item.h 2014-05-12 18:25:45 +0000
+++ src/indicator/menuitems/access-point-item.h 2014-08-15 11:57:07 +0000
@@ -40,7 +40,7 @@
40 typedef std::shared_ptr<AccessPointItem> Ptr;40 typedef std::shared_ptr<AccessPointItem> Ptr;
4141
42 AccessPointItem() = delete;42 AccessPointItem() = delete;
43 AccessPointItem(networking::wifi::AccessPoint::Ptr accessPoint, bool isActive = false)43 explicit AccessPointItem(networking::wifi::AccessPoint::Ptr accessPoint, bool isActive = false)
44 : m_accessPoint{accessPoint},44 : m_accessPoint{accessPoint},
45 m_isActive{isActive}45 m_isActive{isActive}
46 {46 {
4747
=== modified file 'src/indicator/menuitems/switch-item.h'
--- src/indicator/menuitems/switch-item.h 2014-05-27 16:06:14 +0000
+++ src/indicator/menuitems/switch-item.h 2014-08-15 11:57:07 +0000
@@ -31,6 +31,7 @@
31 typedef std::shared_ptr<SwitchItem> Ptr;31 typedef std::shared_ptr<SwitchItem> Ptr;
3232
33 SwitchItem() = delete;33 SwitchItem() = delete;
34 virtual ~SwitchItem() = default;
34 SwitchItem(const std::string &label, const std::string &prefix, const std::string &name)35 SwitchItem(const std::string &label, const std::string &prefix, const std::string &name)
35 {36 {
36 m_state.changed().connect([this](bool value){37 m_state.changed().connect([this](bool value){
3738
=== modified file 'src/indicator/menuitems/text-item.h'
--- src/indicator/menuitems/text-item.h 2014-05-12 11:36:59 +0000
+++ src/indicator/menuitems/text-item.h 2014-08-15 11:57:07 +0000
@@ -33,6 +33,7 @@
33 typedef std::shared_ptr<TextItem> Ptr;33 typedef std::shared_ptr<TextItem> Ptr;
3434
35 TextItem() = delete;35 TextItem() = delete;
36 virtual ~TextItem() = default;
36 TextItem(const std::string &label, const std::string &prefix, const std::string &name)37 TextItem(const std::string &label, const std::string &prefix, const std::string &name)
37 {38 {
38 std::string action_name = prefix + "." + name;39 std::string action_name = prefix + "." + name;
3940
=== modified file 'src/indicator/modem.h'
--- src/indicator/modem.h 2014-08-15 11:57:07 +0000
+++ src/indicator/modem.h 2014-08-15 11:57:07 +0000
@@ -67,7 +67,7 @@
67 };67 };
6868
69 Modem() = delete;69 Modem() = delete;
70 Modem(org::ofono::Interface::Modem::Ptr ofonoModem);70 explicit Modem(org::ofono::Interface::Modem::Ptr ofonoModem);
71 virtual ~Modem();71 virtual ~Modem();
7272
73 org::ofono::Interface::Modem::Ptr ofonoModem() const;73 org::ofono::Interface::Modem::Ptr ofonoModem() const;
7474
=== modified file 'src/indicator/root-state.cpp'
--- src/indicator/root-state.cpp 2014-08-15 11:57:07 +0000
+++ src/indicator/root-state.cpp 2014-08-15 11:57:07 +0000
@@ -232,7 +232,7 @@
232Variant232Variant
233RootState::Private::createIcon(const std::string name)233RootState::Private::createIcon(const std::string name)
234{234{
235 GError *error = NULL;235 GError *error = nullptr;
236 auto gicon = g_icon_new_for_string(name.c_str(), &error);236 auto gicon = g_icon_new_for_string(name.c_str(), &error);
237 if (error) {237 if (error) {
238 g_error_free(error);238 g_error_free(error);
239239
=== modified file 'src/indicator/wifi-link-item.h'
--- src/indicator/wifi-link-item.h 2014-05-27 16:06:14 +0000
+++ src/indicator/wifi-link-item.h 2014-08-15 11:57:07 +0000
@@ -71,6 +71,7 @@
71 typedef std::shared_ptr<WifiLinkItem> Ptr;71 typedef std::shared_ptr<WifiLinkItem> Ptr;
7272
73 WifiLinkItem() = delete;73 WifiLinkItem() = delete;
74 virtual ~WifiLinkItem() = default;
74 WifiLinkItem(networking::wifi::Link::Ptr link)75 WifiLinkItem(networking::wifi::Link::Ptr link)
75 : m_link {link}76 : m_link {link}
76 {77 {
7778
=== modified file 'src/indicator/wifi-section.h'
--- src/indicator/wifi-section.h 2014-05-12 11:36:59 +0000
+++ src/indicator/wifi-section.h 2014-08-15 11:57:07 +0000
@@ -32,8 +32,8 @@
32public:32public:
33 typedef std::shared_ptr<WifiSection> Ptr;33 typedef std::shared_ptr<WifiSection> Ptr;
34 WifiSection() = delete;34 WifiSection() = delete;
35 WifiSection(std::shared_ptr<connectivity::networking::Manager> manager);35 explicit WifiSection(std::shared_ptr<connectivity::networking::Manager> manager);
36 ~WifiSection();36 virtual ~WifiSection();
3737
38 // from Section38 // from Section
39 virtual ActionGroup::Ptr actionGroup();39 virtual ActionGroup::Ptr actionGroup();
4040
=== modified file 'src/indicator/wwan-link-item.h'
--- src/indicator/wwan-link-item.h 2014-08-07 00:19:35 +0000
+++ src/indicator/wwan-link-item.h 2014-08-15 11:57:07 +0000
@@ -32,7 +32,7 @@
32 typedef std::shared_ptr<WwanLinkItem> Ptr;32 typedef std::shared_ptr<WwanLinkItem> Ptr;
33 WwanLinkItem() = delete;33 WwanLinkItem() = delete;
34 WwanLinkItem(Modem::Ptr, ModemManager::Ptr modemManager);34 WwanLinkItem(Modem::Ptr, ModemManager::Ptr modemManager);
35 ~WwanLinkItem();35 virtual ~WwanLinkItem();
3636
37 // from Section37 // from Section
38 virtual ActionGroup::Ptr actionGroup();38 virtual ActionGroup::Ptr actionGroup();
3939
=== modified file 'src/indicator/wwan-section.cpp'
--- src/indicator/wwan-section.cpp 2014-08-15 11:57:07 +0000
+++ src/indicator/wwan-section.cpp 2014-08-15 11:57:07 +0000
@@ -109,7 +109,7 @@
109 for (auto iter = m_items.begin(); iter != m_items.end(); ++iter) {109 for (auto iter = m_items.begin(); iter != m_items.end(); ++iter) {
110 m_linkMenuMerger->remove(*(*iter).second);110 m_linkMenuMerger->remove(*(*iter).second);
111 m_actionGroupMerger->remove(*(*iter).second);111 m_actionGroupMerger->remove(*(*iter).second);
112 m_items.erase(iter);112 iter = m_items.erase(iter);
113 --iter;113 --iter;
114 }114 }
115 }115 }
116116
=== modified file 'src/indicator/wwan-section.h'
--- src/indicator/wwan-section.h 2014-08-15 11:57:07 +0000
+++ src/indicator/wwan-section.h 2014-08-15 11:57:07 +0000
@@ -31,8 +31,8 @@
31public:31public:
32 typedef std::shared_ptr<WwanSection> Ptr;32 typedef std::shared_ptr<WwanSection> Ptr;
33 WwanSection() = delete;33 WwanSection() = delete;
34 WwanSection(ModemManager::Ptr modemManager);34 explicit WwanSection(ModemManager::Ptr modemManager);
35 ~WwanSection();35 virtual ~WwanSection();
3636
37 virtual ActionGroup::Ptr actionGroup();37 virtual ActionGroup::Ptr actionGroup();
38 virtual MenuModel::Ptr menuModel();38 virtual MenuModel::Ptr menuModel();
3939
=== modified file 'src/menumodel-cpp/action-group-merger.h'
--- src/menumodel-cpp/action-group-merger.h 2014-08-15 11:57:07 +0000
+++ src/menumodel-cpp/action-group-merger.h 2014-08-15 11:57:07 +0000
@@ -96,7 +96,7 @@
96public:96public:
97 typedef std::shared_ptr<ActionGroupMerger> Ptr;97 typedef std::shared_ptr<ActionGroupMerger> Ptr;
9898
99 ActionGroupMerger(const std::string &prefix = "")99 explicit ActionGroupMerger(const std::string &prefix = "")
100 : m_prefix {prefix}100 : m_prefix {prefix}
101 {101 {
102 m_actionGroup = std::make_shared<ActionGroup>(m_prefix);102 m_actionGroup = std::make_shared<ActionGroup>(m_prefix);
103103
=== modified file 'src/menumodel-cpp/gio-helpers/util.h'
--- src/menumodel-cpp/gio-helpers/util.h 2014-05-12 11:36:59 +0000
+++ src/menumodel-cpp/gio-helpers/util.h 2014-08-15 11:57:07 +0000
@@ -56,7 +56,7 @@
56 g_idle_add_full(G_PRIORITY_HIGH,56 g_idle_add_full(G_PRIORITY_HIGH,
57 GSourceFunc(GMainLoopSync::dispatch_cb),57 GSourceFunc(GMainLoopSync::dispatch_cb),
58 this,58 this,
59 NULL);59 nullptr);
60 if (m_cv.wait_for(lk, std::chrono::seconds(3)) == std::cv_status::timeout) {60 if (m_cv.wait_for(lk, std::chrono::seconds(3)) == std::cv_status::timeout) {
61 std::cerr << "Timeout when waiting for GMainLoop sync." << std::endl;61 std::cerr << "Timeout when waiting for GMainLoop sync." << std::endl;
62 }62 }
@@ -143,13 +143,13 @@
143143
144 SessionBus()144 SessionBus()
145 {145 {
146 GError *error = NULL;146 GError *error = nullptr;
147147
148 gchar *address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION,148 gchar *address = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION,
149 NULL, &error);149 nullptr, &error);
150 if (!address)150 if (!address)
151 {151 {
152 g_assert(error != NULL);152 g_assert(error != nullptr);
153 if (error->domain != G_IO_ERROR153 if (error->domain != G_IO_ERROR
154 || error->code != G_IO_ERROR_CANCELLED)154 || error->code != G_IO_ERROR_CANCELLED)
155 {155 {
@@ -160,20 +160,20 @@
160 return;160 return;
161 }161 }
162162
163 error = NULL;163 error = nullptr;
164 m_bus.reset(164 m_bus.reset(
165 g_dbus_connection_new_for_address_sync(165 g_dbus_connection_new_for_address_sync(
166 address,166 address,
167 (GDBusConnectionFlags) (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT167 (GDBusConnectionFlags) (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT
168 | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),168 | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION),
169 NULL,169 nullptr,
170 NULL,170 nullptr,
171 &error),171 &error),
172 GObjectDeleter());172 GObjectDeleter());
173 g_free(address);173 g_free(address);
174174
175 if (!m_bus) {175 if (!m_bus) {
176 g_assert(error != NULL);176 g_assert(error != nullptr);
177 if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_CANCELLED) {177 if (error->domain != G_IO_ERROR || error->code != G_IO_ERROR_CANCELLED) {
178 std::cerr << "Error getting the bus: " << error->message;178 std::cerr << "Error getting the bus: " << error->message;
179 }179 }
@@ -236,7 +236,7 @@
236 (GBusNameAcquiredCallback)nameAcquired,236 (GBusNameAcquiredCallback)nameAcquired,
237 (GBusNameLostCallback)nameLost,237 (GBusNameLostCallback)nameLost,
238 this,238 this,
239 NULL);239 nullptr);
240240
241 }241 }
242 ~BusName()242 ~BusName()
243243
=== modified file 'src/menumodel-cpp/gio-helpers/variant.h'
--- src/menumodel-cpp/gio-helpers/variant.h 2014-04-24 13:24:05 +0000
+++ src/menumodel-cpp/gio-helpers/variant.h 2014-08-15 11:57:07 +0000
@@ -140,7 +140,7 @@
140 {140 {
141 assert(variant);141 assert(variant);
142 assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING));142 assert(g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING));
143 value = g_variant_get_string(variant, NULL);143 value = g_variant_get_string(variant, nullptr);
144 }144 }
145};145};
146146
147147
=== modified file 'src/menumodel-cpp/menu-item.h'
--- src/menumodel-cpp/menu-item.h 2014-04-02 23:12:55 +0000
+++ src/menumodel-cpp/menu-item.h 2014-08-15 11:57:07 +0000
@@ -64,13 +64,13 @@
64 return menu;64 return menu;
65 }65 }
6666
67 MenuItem(const std::string &label = "",67 explicit MenuItem(const std::string &label = "",
68 const std::string &action = "")68 const std::string &action = "")
69 : m_label{label},69 : m_label{label},
70 m_action{action}70 m_action{action}
71 {71 {
72 /// @todo validate that action is valid72 /// @todo validate that action is valid
73 m_gmenuitem = make_gmenuitem_ptr(g_menu_item_new(NULL, NULL));73 m_gmenuitem = make_gmenuitem_ptr(g_menu_item_new(nullptr, nullptr));
74 if (!label.empty()) {74 if (!label.empty()) {
75 g_menu_item_set_label(m_gmenuitem.get(), label.c_str());75 g_menu_item_set_label(m_gmenuitem.get(), label.c_str());
76 }76 }
@@ -136,7 +136,7 @@
136 assert(!attribute.empty());136 assert(!attribute.empty());
137 std::lock_guard<std::recursive_mutex> lg(m_mutex);137 std::lock_guard<std::recursive_mutex> lg(m_mutex);
138 m_attributes.erase(attribute);138 m_attributes.erase(attribute);
139 g_menu_item_set_attribute(m_gmenuitem.get(), attribute.c_str(), NULL);139 g_menu_item_set_attribute(m_gmenuitem.get(), attribute.c_str(), nullptr);
140 m_changed();140 m_changed();
141 }141 }
142142
143143
=== modified file 'src/notify-cpp/notification.cpp'
--- src/notify-cpp/notification.cpp 2014-03-25 23:22:16 +0000
+++ src/notify-cpp/notification.cpp 2014-08-15 11:57:07 +0000
@@ -57,13 +57,13 @@
57 d->disconnectId = g_signal_connect(d->notification.get(), "closed", G_CALLBACK(Private::closed_cb), d.get());57 d->disconnectId = g_signal_connect(d->notification.get(), "closed", G_CALLBACK(Private::closed_cb), d.get());
5858
59 d->summary.changed().connect([this](const std::string &value){59 d->summary.changed().connect([this](const std::string &value){
60 g_object_set(d->notification.get(), "summary", value.c_str(), NULL);60 g_object_set(d->notification.get(), "summary", value.c_str(), nullptr);
61 });61 });
62 d->body.changed().connect([this](const std::string &value){62 d->body.changed().connect([this](const std::string &value){
63 g_object_set(d->notification.get(), "body", value.c_str(), NULL);63 g_object_set(d->notification.get(), "body", value.c_str(), nullptr);
64 });64 });
65 d->icon.changed().connect([this](const std::string &value){65 d->icon.changed().connect([this](const std::string &value){
66 g_object_set(d->notification.get(), "icon", value.c_str(), NULL);66 g_object_set(d->notification.get(), "icon", value.c_str(), nullptr);
67 });67 });
6868
69}69}
7070
=== modified file 'src/notify-cpp/snapdecision/sim-unlock.h'
--- src/notify-cpp/snapdecision/sim-unlock.h 2014-04-23 13:18:25 +0000
+++ src/notify-cpp/snapdecision/sim-unlock.h 2014-08-15 11:57:07 +0000
@@ -36,7 +36,7 @@
3636
37 typedef std::shared_ptr<SimUnlock> Ptr;37 typedef std::shared_ptr<SimUnlock> Ptr;
3838
39 SimUnlock(const std::string &title = "",39 explicit SimUnlock(const std::string &title = "",
40 const std::string &body = "",40 const std::string &body = "",
41 std::pair<std::uint8_t, std::uint8_t> pinMinMax = {0, -0});41 std::pair<std::uint8_t, std::uint8_t> pinMinMax = {0, -0});
42 ~SimUnlock();42 ~SimUnlock();
4343
=== added directory 'src/qt'
=== added file 'src/qt/CMakeLists.txt'
--- src/qt/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/qt/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,8 @@
1set(CMAKE_AUTOMOC ON)
2add_definitions(-DQT_NO_KEYWORDS)
3
4set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
5set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
6
7add_subdirectory(src)
8add_subdirectory(qml)
09
=== added directory 'src/qt/include'
=== added directory 'src/qt/include/ubuntu'
=== added directory 'src/qt/include/ubuntu/connectivity'
=== added file 'src/qt/include/ubuntu/connectivity/NetworkingStatus'
--- src/qt/include/ubuntu/connectivity/NetworkingStatus 1970-01-01 00:00:00 +0000
+++ src/qt/include/ubuntu/connectivity/NetworkingStatus 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1#include <ubuntu/connectivity/networking-status.h>
02
=== added file 'src/qt/include/ubuntu/connectivity/networking-status.h'
--- src/qt/include/ubuntu/connectivity/networking-status.h 1970-01-01 00:00:00 +0000
+++ src/qt/include/ubuntu/connectivity/networking-status.h 2014-08-15 11:57:07 +0000
@@ -0,0 +1,79 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#ifndef CONNECTIVITY_NETWORKING_STATUS_H
21#define CONNECTIVITY_NETWORKING_STATUS_H
22
23#include <QObject>
24#include <QScopedPointer>
25#include <QVector>
26
27namespace ubuntu {
28namespace connectivity {
29
30
31class Q_DECL_EXPORT NetworkingStatus : public QObject
32{
33 Q_OBJECT
34 Q_DISABLE_COPY(NetworkingStatus)
35
36 Q_ENUMS(Limitations)
37 Q_ENUMS(Status)
38
39 Q_PROPERTY(QVector<Limitations> limitations
40 READ limitations
41 NOTIFY limitationsChanged)
42 Q_PROPERTY(Status status
43 READ status
44 NOTIFY statusChanged)
45
46public:
47 explicit NetworkingStatus(QObject *parent = 0);
48 virtual ~NetworkingStatus();
49
50 enum Limitations {
51 Bandwith
52 };
53
54 enum Status {
55 Offline,
56 Connecting,
57 Online
58 };
59
60 QVector<Limitations> limitations() const;
61 Status status() const;
62
63Q_SIGNALS:
64 void limitationsChanged();
65 void statusChanged(Status value);
66
67private:
68 class Private;
69 QScopedPointer<Private> d;
70};
71
72}
73}
74
75Q_DECLARE_METATYPE(ubuntu::connectivity::NetworkingStatus::Limitations)
76Q_DECLARE_METATYPE(QVector<ubuntu::connectivity::NetworkingStatus::Limitations>)
77Q_DECLARE_METATYPE(ubuntu::connectivity::NetworkingStatus::Status)
78
79#endif // CONNECTIVITY_NETWORKING_STATUS_H
080
=== added directory 'src/qt/qml'
=== added file 'src/qt/qml/CMakeLists.txt'
--- src/qt/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/qt/qml/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1add_subdirectory(Ubuntu)
02
=== added directory 'src/qt/qml/Ubuntu'
=== added file 'src/qt/qml/Ubuntu/CMakeLists.txt'
--- src/qt/qml/Ubuntu/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,1 @@
1add_subdirectory(Connectivity)
02
=== added directory 'src/qt/qml/Ubuntu/Connectivity'
=== added file 'src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt'
--- src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,38 @@
1# Find includes in corresponding build directories
2set(CMAKE_INCLUDE_CURRENT_DIR ON)
3
4find_package(Qt5Quick REQUIRED)
5
6set(CORE_SRCS
7 networking-status.cpp
8 plugin.cpp
9)
10include_directories(${CMAKE_SOURCE_DIR}/src/qt/include)
11
12add_library(connectivity-qml SHARED
13 ${CORE_SRCS}
14)
15target_link_libraries(connectivity-qml ${CONNECTIVITY_QT_LIB_TARGET})
16
17qt5_use_modules(connectivity-qml Qml)
18
19get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
20exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" OUTPUT_VARIABLE QT_IMPORTS_DIR)
21file(TO_CMAKE_PATH "${QT_IMPORTS_DIR}" QT_IMPORTS_DIR)
22
23install(
24 TARGETS connectivity-qml
25 ARCHIVE DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
26 RUNTIME DESTINATION bin
27 LIBRARY DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
28)
29
30install(
31 FILES qmldir
32 DESTINATION ${QT_IMPORTS_DIR}/Ubuntu/Connectivity
33)
34
35# copy qmldir file into build directory for shadow builds
36file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
37 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
38 )
039
=== added file 'src/qt/qml/Ubuntu/Connectivity/networking-status.cpp'
--- src/qt/qml/Ubuntu/Connectivity/networking-status.cpp 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/networking-status.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include "networking-status.h"
21
22NetworkingStatus::NetworkingStatus(QObject *parent)
23 : ubuntu::connectivity::NetworkingStatus(parent)
24{
25 connect(this, &NetworkingStatus::statusChanged, [this](Status value){
26 value == Status::Online ? Q_EMIT onlineChanged(true) : Q_EMIT onlineChanged(false);
27 });
28}
29
30NetworkingStatus::~NetworkingStatus()
31{}
32
33bool
34NetworkingStatus::online() const
35{
36 return status() == Status::Online;
37}
38
39bool
40NetworkingStatus::limitedBandwith() const
41{
42 return limitations().contains(Limitations::Bandwith);
43}
044
=== added file 'src/qt/qml/Ubuntu/Connectivity/networking-status.h'
--- src/qt/qml/Ubuntu/Connectivity/networking-status.h 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/networking-status.h 2014-08-15 11:57:07 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#ifndef QML_CONNECTIVITY_NETWORKING_STATUS_H
21#define QML_CONNECTIVITY_NETWORKING_STATUS_H
22
23#include <QObject>
24#include <QThread>
25
26#include <ubuntu/connectivity/NetworkingStatus>
27
28class Q_DECL_EXPORT NetworkingStatus : public ubuntu::connectivity::NetworkingStatus
29{
30 Q_OBJECT
31
32 Q_PROPERTY(bool online
33 READ online
34 NOTIFY onlineChanged)
35
36 Q_PROPERTY(bool limitedBandwith
37 READ limitedBandwith
38 NOTIFY limitedBandwithChanged)
39
40public:
41 explicit NetworkingStatus(QObject *parent = 0);
42 virtual ~NetworkingStatus();
43
44 bool online() const;
45 bool limitedBandwith() const;
46
47Q_SIGNALS:
48 void onlineChanged(bool value);
49 void limitedBandwithChanged(bool value);
50};
51
52#endif // QML_CONNECTIVITY_NETWORKING_STATUS_H
053
=== added file 'src/qt/qml/Ubuntu/Connectivity/plugin.cpp'
--- src/qt/qml/Ubuntu/Connectivity/plugin.cpp 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/plugin.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,40 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include "plugin.h"
21
22#include <QtQml>
23
24#include "networking-status.h"
25
26void
27QmlConnectivityNetworkingPlugin::registerTypes(const char *uri)
28{
29 // @uri Ubuntu.Connectivity
30 qmlRegisterType<NetworkingStatus> (uri, 1, 0, "NetworkingStatus");
31}
32
33void
34QmlConnectivityNetworkingPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
35{
36 Q_UNUSED(uri);
37 Q_UNUSED(engine);
38}
39
40
041
=== added file 'src/qt/qml/Ubuntu/Connectivity/plugin.h'
--- src/qt/qml/Ubuntu/Connectivity/plugin.h 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/plugin.h 2014-08-15 11:57:07 +0000
@@ -0,0 +1,36 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#ifndef QML_CONNECTIVITY_PLUGIN_H
21#define QML_CONNECTIVITY_PLUGIN_H
22
23#include <QQmlExtensionPlugin>
24
25class QmlConnectivityNetworkingPlugin : public QQmlExtensionPlugin {
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28 Q_INTERFACES(QQmlExtensionInterface)
29
30public:
31 void registerTypes(const char *uri);
32 void initializeEngine(QQmlEngine *engine, const char *uri);
33};
34
35#endif // QML_CONNECTIVITY_PLUGIN_H
36
037
=== added file 'src/qt/qml/Ubuntu/Connectivity/qmldir'
--- src/qt/qml/Ubuntu/Connectivity/qmldir 1970-01-01 00:00:00 +0000
+++ src/qt/qml/Ubuntu/Connectivity/qmldir 2014-08-15 11:57:07 +0000
@@ -0,0 +1,2 @@
1module Ubuntu.Connectivity
2plugin connectivity-qml
03
=== added directory 'src/qt/src'
=== added file 'src/qt/src/CMakeLists.txt'
--- src/qt/src/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/qt/src/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,48 @@
1
2set(CONNECTIVITY_QT_INCLUDE_DIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}/connectivity-api/qt${CONNECTIVITY_QT_VERSION_MAJOR}")
3
4set(PUBLIC_HEADER_DIR "${CMAKE_SOURCE_DIR}/src/qt/include/ubuntu/connectivity")
5set(PUBLIC_HEADERS
6 ${PUBLIC_HEADER_DIR}/NetworkingStatus
7 ${PUBLIC_HEADER_DIR}/networking-status.h
8)
9
10#install the headers
11install(FILES ${PUBLIC_HEADERS}
12 DESTINATION "${CONNECTIVITY_QT_INCLUDE_DIR}/ubuntu/connectivity")
13
14include_directories(../include)
15set(CORE_SRCS
16 networking-status.cpp
17 dbus-properties-interface.cpp
18)
19
20add_library(${CONNECTIVITY_QT_LIB_TARGET} SHARED
21 ${CORE_SRCS}
22 ${PUBLIC_HEADERS} # public headers have to be included here for Q_DECL_EXPORT to work properly
23)
24
25qt5_use_modules(${CONNECTIVITY_QT_LIB_TARGET} Core DBus)
26
27install(
28 TARGETS ${CONNECTIVITY_QT_LIB_TARGET}
29 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
30 RUNTIME DESTINATION bin
31 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
32)
33
34set(SO_VERSION ${CONNECTIVITY_QT_VERSION_MAJOR})
35
36set_target_properties(${CONNECTIVITY_QT_LIB_TARGET} PROPERTIES
37 SOVERSION ${SO_VERSION}
38)
39
40set(PC_FILE_TARGET "${CMAKE_CURRENT_BINARY_DIR}/${CONNECTIVITY_QT_LIB_TARGET}.pc")
41set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}")
42set(includedir "${CCONNECTIVITY_QT_INCLUDE_DIR}")
43set(ABSOLUTE_SO_FILE "${CMAKE_INSTALL_FULL_LIBDIR}/${CONNECTIVITY_QT_LIB_TARGET}.so.${SO_VERSION}")
44configure_file("connectivity-qt.pc.in" ${PC_FILE_TARGET} @ONLY)
45install(
46 FILES ${PC_FILE_TARGET}
47 DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
48)
049
=== added file 'src/qt/src/connectivity-qt.pc.in'
--- src/qt/src/connectivity-qt.pc.in 1970-01-01 00:00:00 +0000
+++ src/qt/src/connectivity-qt.pc.in 2014-08-15 11:57:07 +0000
@@ -0,0 +1,10 @@
1libdir=@libdir@
2includedir=@includedir@
3
4Cflags: -I${includedir}/
5Requires: Qt5DBus
6Libs: @ABSOLUTE_SO_FILE@
7
8Name: connectivity-qt1
9Description: Ubuntu Connectivity API
10Version: @CONNECTIVITY_QT_VERSION_MAJOR@.@CONNECTIVITY_QT_VERSION_MINOR@
011
=== added file 'src/qt/src/dbus-properties-interface.cpp'
--- src/qt/src/dbus-properties-interface.cpp 1970-01-01 00:00:00 +0000
+++ src/qt/src/dbus-properties-interface.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,34 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include "dbus-properties-interface.h"
21
22DBusPropertiesInterface::DBusPropertiesInterface(const QString &service,
23 const QString &path,
24 const QDBusConnection &connection,
25 QObject *parent)
26 : QDBusAbstractInterface(service,
27 path,
28 staticInterfaceName(),
29 connection,
30 parent)
31{}
32
33DBusPropertiesInterface::~DBusPropertiesInterface()
34{}
035
=== added file 'src/qt/src/dbus-properties-interface.h'
--- src/qt/src/dbus-properties-interface.h 1970-01-01 00:00:00 +0000
+++ src/qt/src/dbus-properties-interface.h 2014-08-15 11:57:07 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#ifndef DBUSPROPERTIES_H
21#define DBUSPROPERTIES_H
22
23#include <QtCore/QObject>
24#include <QtCore/QByteArray>
25#include <QtCore/QList>
26#include <QtCore/QMap>
27#include <QtCore/QString>
28#include <QtCore/QStringList>
29#include <QtCore/QVariant>
30#include <QtDBus/QtDBus>
31
32class DBusPropertiesInterface: public QDBusAbstractInterface
33{
34 Q_OBJECT
35public:
36 static inline const char *staticInterfaceName()
37 { return "org.freedesktop.DBus.Properties"; }
38
39public:
40 DBusPropertiesInterface(const QString &service,
41 const QString &path,
42 const QDBusConnection &connection,
43 QObject *parent = 0);
44
45 ~DBusPropertiesInterface();
46
47Q_SIGNALS:
48 void PropertiesChanged(const QString interface_name,
49 const QVariantMap &changed_properties,
50 const QStringList &invalidated_properties);
51};
52
53#endif
054
=== added file 'src/qt/src/networking-status.cpp'
--- src/qt/src/networking-status.cpp 1970-01-01 00:00:00 +0000
+++ src/qt/src/networking-status.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,188 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <ubuntu/connectivity/NetworkingStatus>
21#include "dbus-properties-interface.h"
22
23#include <QDBusConnection>
24#include <QDBusConnectionInterface>
25#include <QDBusInterface>
26#include <QDBusServiceWatcher>
27#include <QDBusMetaType>
28
29#include <QDebug>
30
31using namespace ubuntu::connectivity;
32
33#define SERVICE_NAME "com.ubuntu.connectivity1"
34#define SERVICE_INTERFACE "com.ubuntu.connectivity1.NetworkingStatus"
35#define SERVICE_PATH "/com/ubuntu/connectivity1/NetworkingStatus"
36
37
38class Q_DECL_HIDDEN NetworkingStatus::Private : public QObject
39{
40 Q_OBJECT
41
42public:
43 // Yes, it's raw.
44 NetworkingStatus *q;
45
46 QDBusConnection m_bus;
47
48 QVector<NetworkingStatus::Limitations> m_limitations;
49 NetworkingStatus::Status m_status;
50
51 QScopedPointer<QDBusServiceWatcher> m_watch;
52 QScopedPointer<QDBusInterface> m_interface;
53 QScopedPointer<DBusPropertiesInterface> m_properties_interface;
54
55 Private() = delete;
56 Private(NetworkingStatus *q)
57 : q{q},
58 m_bus{QDBusConnection::sessionBus()}
59 {
60 m_limitations = {};
61 m_status = Status::Online;
62
63 m_interface.reset(new QDBusInterface(SERVICE_NAME,
64 SERVICE_PATH,
65 SERVICE_INTERFACE,
66 m_bus));
67 m_properties_interface.reset(new DBusPropertiesInterface(SERVICE_NAME,
68 SERVICE_PATH,
69 m_bus));
70 connect(m_properties_interface.data(),
71 SIGNAL(PropertiesChanged(QString,QVariantMap,QStringList)),
72 this,
73 SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
74
75 m_watch.reset(new QDBusServiceWatcher(SERVICE_NAME,
76 m_bus,
77 QDBusServiceWatcher::WatchForOwnerChange));
78 connect(m_watch.data(), &QDBusServiceWatcher::serviceOwnerChanged, this, &Private::serviceOwnerChanged);
79 if (m_bus.interface()->isServiceRegistered(SERVICE_NAME)) {
80 serviceOwnerChanged(SERVICE_NAME,
81 "",
82 m_bus.interface()->serviceOwner(SERVICE_NAME).value());
83 } else {
84 serviceOwnerChanged(SERVICE_NAME, "", "");
85 }
86 }
87
88 void updateLimitations(QStringList values)
89 {
90 QVector<NetworkingStatus::Limitations> tmp;
91 for (auto str : values) {
92 if (str == "bandwith")
93 tmp << NetworkingStatus::Limitations::Bandwith;
94 else
95 qWarning() << __PRETTY_FUNCTION__ << ": Invalid limitation: " << str;
96 }
97 if (m_limitations == tmp)
98 return;
99 m_limitations = tmp;
100 Q_EMIT q->limitationsChanged();
101 }
102
103 void updateStatus(QString value)
104 {
105 NetworkingStatus::Status tmp;
106 if (value == "offline")
107 tmp = NetworkingStatus::Status::Offline;
108 else if (value == "connecting")
109 tmp = NetworkingStatus::Status::Connecting;
110 else if (value == "online")
111 tmp = NetworkingStatus::Status::Online;
112 else {
113 qWarning() << __PRETTY_FUNCTION__ << ": Invalid status: " << value;
114 return;
115 }
116
117 if (m_status == tmp)
118 return;
119 m_status = tmp;
120 Q_EMIT q->statusChanged(m_status);
121 }
122
123 void reset()
124 {
125 updateLimitations({});
126 updateStatus("online");
127 }
128
129public Q_SLOTS:
130 void serviceOwnerChanged(const QString &serviceName,
131 const QString &oldOwner,
132 const QString &newOwner)
133 {
134 Q_UNUSED(serviceName);
135 Q_UNUSED(oldOwner);
136 if (newOwner.isEmpty()) {
137 // disappeared
138 reset();
139 } else {
140 // appeared
141 updateLimitations(m_interface->property("Limitations").toStringList());
142 updateStatus(m_interface->property("Status").toString());
143 }
144 }
145
146 void propertiesChanged(const QString &interface_name,
147 const QVariantMap &changed_properties,
148 const QStringList &invalidated_properties)
149 {
150 Q_UNUSED(interface_name);
151 Q_UNUSED(invalidated_properties);
152
153 if (changed_properties.contains("Limitations")) {
154 updateLimitations(changed_properties["Limitations"].toStringList());
155 }
156
157 if (changed_properties.contains("Status")) {
158 updateStatus(changed_properties["Status"].toString());
159 }
160 }
161};
162
163NetworkingStatus::NetworkingStatus(QObject *parent)
164 : QObject(parent),
165 d{new Private(this)}
166{
167
168 qRegisterMetaType<ubuntu::connectivity::NetworkingStatus::Limitations>();
169 qRegisterMetaType<QVector<ubuntu::connectivity::NetworkingStatus::Limitations>>();
170 qRegisterMetaType<ubuntu::connectivity::NetworkingStatus::Status>();
171}
172
173NetworkingStatus::~NetworkingStatus()
174{}
175
176QVector<NetworkingStatus::Limitations>
177NetworkingStatus::limitations() const
178{
179 return d->m_limitations;
180}
181
182NetworkingStatus::Status
183NetworkingStatus::status() const
184{
185 return d->m_status;
186}
187
188#include "networking-status.moc"
0189
=== modified file 'src/secret-agent/CMakeLists.txt'
--- src/secret-agent/CMakeLists.txt 2013-10-14 21:00:54 +0000
+++ src/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -1,3 +1,4 @@
1set(CMAKE_AUTOMOC ON)
12
2set(3set(
3 INDICATOR_SECRET_AGENT_SOURCES4 INDICATOR_SECRET_AGENT_SOURCES
45
=== modified file 'src/secret-agent/PasswordMenu.cpp'
--- src/secret-agent/PasswordMenu.cpp 2014-03-28 15:47:23 +0000
+++ src/secret-agent/PasswordMenu.cpp 2014-08-15 11:57:07 +0000
@@ -28,8 +28,8 @@
28class PasswordMenuPriv {28class PasswordMenuPriv {
29public:29public:
30 PasswordMenuPriv() :30 PasswordMenuPriv() :
31 m_connection(g_bus_get_sync(G_BUS_TYPE_SESSION, NULL,31 m_connection(g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr,
32 NULL)), m_exportedActionGroupId(0), m_exportedMenuModelId(0) {32 nullptr)), m_exportedActionGroupId(0), m_exportedMenuModelId(0) {
33 }33 }
3434
35 ~PasswordMenuPriv() {35 ~PasswordMenuPriv() {
@@ -104,7 +104,7 @@
104 exportrev++;104 exportrev++;
105 p->m_actionPath = PASSWORD_ACTION_PATH.arg(exportrev);105 p->m_actionPath = PASSWORD_ACTION_PATH.arg(exportrev);
106 p->m_exportedActionGroupId = g_dbus_connection_export_action_group(106 p->m_exportedActionGroupId = g_dbus_connection_export_action_group(
107 p->m_connection, p->m_actionPath.toUtf8().data(), actions, NULL);107 p->m_connection, p->m_actionPath.toUtf8().data(), actions, nullptr);
108 } while (p->m_exportedActionGroupId == 0 && exportrev < 128);108 } while (p->m_exportedActionGroupId == 0 && exportrev < 128);
109109
110 /* Export the menu. If we can't get a name, keep trying to110 /* Export the menu. If we can't get a name, keep trying to
@@ -116,7 +116,7 @@
116 p->m_menuPath = PASSWORD_MENU_PATH.arg(exportrev);116 p->m_menuPath = PASSWORD_MENU_PATH.arg(exportrev);
117 p->m_exportedMenuModelId = g_dbus_connection_export_menu_model(117 p->m_exportedMenuModelId = g_dbus_connection_export_menu_model(
118 p->m_connection, p->m_menuPath.toUtf8().data(),118 p->m_connection, p->m_menuPath.toUtf8().data(),
119 G_MENU_MODEL(menu), NULL);119 G_MENU_MODEL(menu), nullptr);
120 } while (p->m_exportedMenuModelId == 0 && exportrev < 128);120 } while (p->m_exportedMenuModelId == 0 && exportrev < 128);
121121
122 /* Unref the objects as a reference is maintained by the fact that they're122 /* Unref the objects as a reference is maintained by the fact that they're
123123
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2014-05-02 08:44:47 +0000
+++ tests/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -1,7 +1,5 @@
11
2set(CMAKE_AUTOMOC OFF)
3include(FindGMock)2include(FindGMock)
4set(CMAKE_AUTOMOC ON)
53
6find_package("Valgrind" REQUIRED)4find_package("Valgrind" REQUIRED)
75
86
=== modified file 'tests/integration/CMakeLists.txt'
--- tests/integration/CMakeLists.txt 2014-04-01 16:12:16 +0000
+++ tests/integration/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -1,3 +1,4 @@
1add_subdirectory(qt)
12
2add_definitions(-DNETWORK_SERVICE_BIN="${CMAKE_BINARY_DIR}/network/indicator-network-service")3add_definitions(-DNETWORK_SERVICE_BIN="${CMAKE_BINARY_DIR}/network/indicator-network-service")
34
45
=== added directory 'tests/integration/qt'
=== added file 'tests/integration/qt/CMakeLists.txt'
--- tests/integration/qt/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,4 @@
1set(CMAKE_AUTOMOC ON)
2
3add_subdirectory(cpp)
4add_subdirectory(qml)
05
=== added directory 'tests/integration/qt/cpp'
=== added file 'tests/integration/qt/cpp/CMakeLists.txt'
--- tests/integration/qt/cpp/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/cpp/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,16 @@
1
2include_directories(${CMAKE_SOURCE_DIR}/src/qt/include)
3set(TEST_SRCS
4 main.cpp
5 tst_networking.cpp
6)
7
8set(testCommand dbus-test-runner -t ${CMAKE_CURRENT_BINARY_DIR}/cpptest
9 -p -o -p ${CMAKE_BINARY_DIR}/cpptest.xml,xunitxml
10 -p -o -p -,txt)
11
12add_executable(cpptest ${TEST_SRCS})
13target_link_libraries(cpptest ${CONNECTIVITY_QT_LIB_TARGET})
14qt5_use_modules(cpptest Core Test)
15
16add_test(qtcpptests ${testCommand})
017
=== added file 'tests/integration/qt/cpp/main.cpp'
--- tests/integration/qt/cpp/main.cpp 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/cpp/main.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,33 @@
1/* This file is part of unity-action-api
2 * Copyright 2013 Canonical Ltd.
3 *
4 * unity-action-api is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * unity-action-api is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <QtTest/QtTest>
18#include <QCoreApplication>
19
20#include "tst_networking.h"
21
22int main(int argc, char *argv[])
23{
24 // needed for QTest::qWait
25 QCoreApplication app(argc, argv);
26
27 TestNetworking tst_networking;
28
29 if (QTest::qExec(&tst_networking, argc, argv) != 0)
30 return 1;
31
32 return 0;
33}
034
=== added file 'tests/integration/qt/cpp/tst_networking.cpp'
--- tests/integration/qt/cpp/tst_networking.cpp 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/cpp/tst_networking.cpp 2014-08-15 11:57:07 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include "tst_networking.h"
21
22#include <ubuntu/connectivity/NetworkingStatus>
23
24#include <QtTest/QtTest>
25
26void
27TestNetworking::initTestCase()
28{}
29
30void
31TestNetworking::cleanupTestCase()
32{}
33
34void
35TestNetworking::cleanup()
36{}
37
38
39void
40TestNetworking::testApi()
41{
42 using namespace ubuntu::connectivity;
43
44 auto ns = new NetworkingStatus();
45
46 QVERIFY(ns->metaObject()->indexOfProperty("limitations") != -1);
47 QVERIFY(ns->metaObject()->indexOfProperty("status") != -1);
48
49 QVERIFY(ns->limitations() == QVector<NetworkingStatus::Limitations>());
50 QVERIFY(ns->status() == NetworkingStatus::Online);
51}
052
=== added file 'tests/integration/qt/cpp/tst_networking.h'
--- tests/integration/qt/cpp/tst_networking.h 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/cpp/tst_networking.h 2014-08-15 11:57:07 +0000
@@ -0,0 +1,39 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#include <QObject>
21
22#include <ubuntu/connectivity/NetworkingStatus>
23
24
25class TestNetworking : public QObject
26{
27 Q_OBJECT
28
29private slots:
30 void initTestCase();
31 void cleanupTestCase();
32
33 void cleanup();
34
35 void testApi();
36
37private:
38};
39
040
=== added directory 'tests/integration/qt/qml'
=== added file 'tests/integration/qt/qml/CMakeLists.txt'
--- tests/integration/qt/qml/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/qml/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -0,0 +1,19 @@
1add_custom_target(qmltests)
2
3find_program(qmltestrunner_exe qmltestrunner)
4
5if(NOT qmltestrunner_exe)
6 msg(FATAL_ERROR "Could not locate qmltestrunner.")
7endif()
8
9set(qmltest_command
10 dbus-test-runner -t env -p "QT_QPA_PLATFORM=minimal"
11 -p ${qmltestrunner_exe} -p -input -p ${CMAKE_CURRENT_SOURCE_DIR}/tst_api.qml
12 -p -import -p ${CMAKE_BINARY_DIR}/src/qt/qml
13 -p -o -p ${CMAKE_BINARY_DIR}/testapi.xml,xunitxml
14 -p -o -p -,txt
15)
16
17add_custom_target(qmltest_api ${qmltest_command})
18add_dependencies(qmltests qmltest_api)
19add_test(qmltests ${qmltest_command})
020
=== added file 'tests/integration/qt/qml/tst_api.qml'
--- tests/integration/qt/qml/tst_api.qml 1970-01-01 00:00:00 +0000
+++ tests/integration/qt/qml/tst_api.qml 2014-08-15 11:57:07 +0000
@@ -0,0 +1,53 @@
1/*
2 * Copyright © 2014 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20import Ubuntu.Connectivity 1.0
21import QtQuick 2.0
22import QtTest 1.0
23
24/* This test will make sure there are no unintentional changes to the
25 * schemantics of the API (default properties work as expected, etc)
26 * so that any files written to the prior release of the library
27 * will not bail out when loaded resulting in client applications failing
28 * to start.
29 */
30Item {
31
32 NetworkingStatus {
33 id: networkingStatus
34 onStatusChanged: {}
35 onLimitationsChanged: {}
36 onOnlineChanged: {}
37 onLimitedBandwithChanged: {}
38 }
39
40 TestCase {
41 name: "API Test"
42 id: test_api
43
44 property int status : networkingStatus.status
45 property int online : networkingStatus.online
46 property int limitedBandwith : networkingStatus.limitedBandwith
47
48 function test_api() {
49 // just make sure this file can be loaded properly by the QmlEngine.
50 verify(1)
51 }
52 }
53}
054
=== modified file 'tests/unit/secret-agent/CMakeLists.txt'
--- tests/unit/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
+++ tests/unit/secret-agent/CMakeLists.txt 2014-08-15 11:57:07 +0000
@@ -1,3 +1,4 @@
1set(CMAKE_AUTOMOC ON)
12
2include_directories("${CMAKE_SOURCE_DIR}/src/secret-agent")3include_directories("${CMAKE_SOURCE_DIR}/src/secret-agent")
3include_directories("${CMAKE_BINARY_DIR}/src/secret-agent")4include_directories("${CMAKE_BINARY_DIR}/src/secret-agent")

Subscribers

People subscribed via source and target branches