2022-11-07 14:26:12 +00:00
|
|
|
# Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
Long live QPermissions!
Many features of today's devices and operating systems can have
significant privacy, security, and performance implications if
misused. It's therefore increasingly common for platforms to
require explicit consent from the user before accessing these
features.
The Qt permission APIs allow the application to check or request
permission for such features in a cross platform manner.
The check is always synchronous, and can be used in both
library and application code, from any thread.
The request is asynchronous, and should be initiated from
application code on the main thread. The result of the request
can be delivered to lambdas, standalone functions, or
regular member functions such as slots, with an optional
context parameter to manage the lifetime of the request.
Individual permissions are distinct types, not enum values,
and can be added and extended at a later point.
Task-number: QTBUG-90498
Done-with: Timur Pocheptsov <timur.pocheptsov@qt.io>
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I821380bbe56bbc0178cb43e6cabbc99fdbd1235e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-05-03 10:25:50 +00:00
|
|
|
|
2023-01-11 13:48:14 +00:00
|
|
|
qt_internal_add_test(tst_manual_qpermissions
|
Long live QPermissions!
Many features of today's devices and operating systems can have
significant privacy, security, and performance implications if
misused. It's therefore increasingly common for platforms to
require explicit consent from the user before accessing these
features.
The Qt permission APIs allow the application to check or request
permission for such features in a cross platform manner.
The check is always synchronous, and can be used in both
library and application code, from any thread.
The request is asynchronous, and should be initiated from
application code on the main thread. The result of the request
can be delivered to lambdas, standalone functions, or
regular member functions such as slots, with an optional
context parameter to manage the lifetime of the request.
Individual permissions are distinct types, not enum values,
and can be added and extended at a later point.
Task-number: QTBUG-90498
Done-with: Timur Pocheptsov <timur.pocheptsov@qt.io>
Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I821380bbe56bbc0178cb43e6cabbc99fdbd1235e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-05-03 10:25:50 +00:00
|
|
|
SOURCES
|
|
|
|
tst_qpermissions.cpp
|
|
|
|
LIBRARIES
|
|
|
|
Qt::CorePrivate
|
|
|
|
)
|
2022-05-10 13:02:43 +00:00
|
|
|
|
2022-05-06 15:00:51 +00:00
|
|
|
if(ANDROID)
|
2023-01-11 13:48:14 +00:00
|
|
|
set_property(TARGET tst_manual_qpermissions
|
2022-05-06 15:00:51 +00:00
|
|
|
PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
|
|
|
elseif(APPLE)
|
2022-05-10 13:02:43 +00:00
|
|
|
# Test an app bundle, but without any usage descriptions
|
|
|
|
|
|
|
|
qt_internal_add_test(tst_qpermissions_app
|
|
|
|
SOURCES
|
|
|
|
tst_qpermissions.cpp
|
|
|
|
DEFINES
|
|
|
|
tst_QPermissions=tst_QPermissionsApp
|
|
|
|
LIBRARIES
|
|
|
|
Qt::CorePrivate
|
|
|
|
)
|
|
|
|
|
|
|
|
set_property(TARGET tst_qpermissions_app
|
|
|
|
PROPERTY MACOSX_BUNDLE TRUE)
|
|
|
|
set_property(TARGET tst_qpermissions_app
|
|
|
|
PROPERTY MACOSX_BUNDLE_GUI_IDENTIFIER "io.qt.dev.tst_permissions_app")
|
|
|
|
|
|
|
|
# Test an app bundle with all the required usage descriptions
|
|
|
|
|
|
|
|
qt_internal_add_test(tst_qpermissions_app_with_usage_descriptions
|
|
|
|
SOURCES
|
|
|
|
tst_qpermissions.cpp
|
|
|
|
DEFINES
|
|
|
|
tst_QPermissions=tst_QPermissionsAppWithUsageDescriptions
|
|
|
|
HAVE_USAGE_DESCRIPTION=1
|
|
|
|
LIBRARIES
|
|
|
|
Qt::CorePrivate
|
|
|
|
Qt::Gui
|
|
|
|
)
|
|
|
|
|
|
|
|
set_property(TARGET tst_qpermissions_app_with_usage_descriptions
|
|
|
|
PROPERTY MACOSX_BUNDLE TRUE)
|
|
|
|
set_property(TARGET tst_qpermissions_app_with_usage_descriptions
|
|
|
|
PROPERTY MACOSX_BUNDLE_GUI_IDENTIFIER "io.qt.dev.tst_qpermissions_app_with_usage_descriptions")
|
|
|
|
set_property(TARGET tst_qpermissions_app_with_usage_descriptions
|
|
|
|
PROPERTY MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist")
|
|
|
|
|
|
|
|
foreach(permission_plugin IN LISTS QT_ALL_PLUGINS_FOUND_BY_FIND_PACKAGE_permissions)
|
|
|
|
set(permission_plugin "${QT_CMAKE_EXPORT_NAMESPACE}::${permission_plugin}")
|
|
|
|
qt6_import_plugins(tst_qpermissions_app INCLUDE ${permission_plugin})
|
|
|
|
qt6_import_plugins(tst_qpermissions_app_with_usage_descriptions INCLUDE ${permission_plugin})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(NOT CMAKE_GENERATOR STREQUAL "Xcode")
|
|
|
|
add_custom_command(TARGET tst_qpermissions_app_with_usage_descriptions
|
|
|
|
POST_BUILD COMMAND codesign -s - tst_qpermissions_app_with_usage_descriptions.app)
|
|
|
|
endif()
|
|
|
|
endif()
|