summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2020-01-24 16:20:40 +0100
committerRobert Griebl <robert.griebl@qt.io>2020-01-24 16:57:56 +0100
commit4f7b3e720f3c65d4243865ed5734d3271583177e (patch)
tree159963e6074e404628bccea3a94ca0f06493b736
parent55880cb0cc0e32db7a8102594d1aedb4d913f729 (diff)
More documentation - especially regarding the new PackageManager
Also had to fix a few things in the PackageManager<->ApplicationInstaller compatibility layer, because it became obvious that things didn't work as expected while writing the documentation. Change-Id: I92de9a7142e9713fed0b60fd0b69c1a24ff8eb5e Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r--doc/applicationmanager-project.qdocconf39
-rw-r--r--doc/configuration.qdoc4
-rw-r--r--doc/doc.pro2
-rw-r--r--doc/installer.qdoc17
-rw-r--r--doc/manifest-old.qdoc395
-rw-r--r--doc/manifest.qdoc275
-rw-r--r--doc/package-format.qdoc60
-rw-r--r--doc/systemui.qdoc6
-rw-r--r--src/application-lib/applicationinfo.cpp25
-rw-r--r--src/application-lib/applicationinfo.h2
-rw-r--r--src/application-lib/applicationinterface.cpp4
-rw-r--r--src/application-lib/intentinfo.cpp12
-rw-r--r--src/application-lib/packageinfo.cpp38
-rw-r--r--src/application-lib/packageinfo.h2
-rw-r--r--src/application-lib/yamlpackagescanner.cpp28
-rw-r--r--src/dbus-lib/packagemanagerdbuscontextadaptor.cpp24
-rw-r--r--src/intent-server-lib/intent.cpp15
-rw-r--r--src/main-lib/applicationinstaller.cpp372
-rw-r--r--src/main-lib/applicationinstaller.h8
-rw-r--r--src/manager-lib/application.cpp162
-rw-r--r--src/manager-lib/application.h20
-rw-r--r--src/manager-lib/applicationipcinterface.cpp2
-rw-r--r--src/manager-lib/installationtask.cpp22
-rw-r--r--src/manager-lib/package.cpp118
-rw-r--r--src/manager-lib/packagemanager.cpp232
-rw-r--r--src/manager-lib/packagemanager.h5
-rw-r--r--src/manager-lib/processstatus.cpp7
-rw-r--r--tests/main/tst_main.cpp3
28 files changed, 1285 insertions, 614 deletions
diff --git a/doc/applicationmanager-project.qdocconf b/doc/applicationmanager-project.qdocconf
index 0e70d0d8..f5a2ffa9 100644
--- a/doc/applicationmanager-project.qdocconf
+++ b/doc/applicationmanager-project.qdocconf
@@ -4,8 +4,11 @@ url = https://doc.qt.io/QtApplicationManager
version = $QT_VERSION
# needed for the new clang based qdoc parser in Qt 5.11
-moduleheader = QtApplicationManagerDoc
-includepaths = -I .
+moduleheader = QtApplicationManagerDoc
+includepaths = -I .
+
+# \obsolete generates broken links and/or missing docs when used for QML
+macro.qmlobsolete = "This method is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code."
sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
@@ -15,46 +18,46 @@ examples.imageextensions = "*.png *.jpg *.gif"
include(config/exampleurl-qtapplicationmanager.qdocconf)
headerdirs += \
- ../src/common-lib \
- ../src/shared-main-lib \
- ../src/main-lib \
- ../src/manager-lib \
../src/application-lib \
- ../src/package-lib \
+ ../src/common-lib \
../src/intent-client-lib \
../src/intent-server-lib \
- ../src/notification-lib \
- ../src/window-lib \
../src/launcher-lib \
+ ../src/main-lib \
+ ../src/manager-lib \
../src/monitor-lib \
+ ../src/notification-lib \
+ ../src/package-lib \
+ ../src/shared-main-lib \
+ ../src/window-lib \
../src/plugin-interfaces \
../src/tools/launcher-qml \
sourcedirs += \
. \
- ../src/common-lib \
- ../src/shared-main-lib \
- ../src/main-lib \
- ../src/manager-lib \
../src/application-lib \
- ../src/package-lib \
+ ../src/common-lib \
../src/intent-client-lib \
../src/intent-server-lib \
- ../src/notification-lib \
- ../src/window-lib \
../src/launcher-lib \
+ ../src/main-lib \
+ ../src/manager-lib \
../src/monitor-lib \
+ ../src/notification-lib \
+ ../src/package-lib \
+ ../src/shared-main-lib \
+ ../src/window-lib \
../src/plugin-interfaces \
- ../src/tools/packager \
../src/tools/controller \
../src/tools/launcher-qml \
+ ../src/tools/packager \
$$BUILDDIR \
imagedirs += ../doc/images
exampledirs = ../examples
-depends += qtcore qtquick qtqml qtdoc qtwaylandcompositor
+depends += qtcore qtquick qtqml qtdoc qtwaylandcompositor qtwidgets qtgeniviextras
qhp.projects = ApplicationManager
qhp.ApplicationManager.file = applicationmanager.qhp
diff --git a/doc/configuration.qdoc b/doc/configuration.qdoc
index 15ea0acc..b8206c2c 100644
--- a/doc/configuration.qdoc
+++ b/doc/configuration.qdoc
@@ -278,7 +278,7 @@ or across multiple config files, the final value is resolved based on these rule
\row
\li \b --verbose
\li bool
-     \li Enables verbose output. All logging categories and message types are enabled with the
+ \li Enables verbose output. All logging categories and message types are enabled with the
exception of some Qt internal debug messages; \c logging-rules is ignored.
\note Logging rules provided via the QT_LOGGING_RULES environment variable still
@@ -554,7 +554,7 @@ an additional column specifying which runtime a configuration option applies to:
calls the function hooks on application startup.
\endlist
\row
- \li [\c resources]
+ \li \c resources
\li qml
\li array<string>
\li Takes a list of \l{The Qt Resource System}{Qt resource} files (.rcc) or libraries that
diff --git a/doc/doc.pro b/doc/doc.pro
index e7a91a4c..7d340a26 100644
--- a/doc/doc.pro
+++ b/doc/doc.pro
@@ -5,6 +5,8 @@ CONFIG += force_qt
QT = core network
qtHaveModule(quick):QT *= quick
qtHaveModule(dbus): QT *= dbus
+qtHaveModule(widgets): QT *= widgets
+qtHaveModule(geniviextras):QT *= geniviextras
# needed for the new clang based qdoc parser in Qt 5.11
!prefix_build:INCLUDEPATH *= $$[QT_INSTALL_HEADERS]
diff --git a/doc/installer.qdoc b/doc/installer.qdoc
index 54989990..1d954555 100644
--- a/doc/installer.qdoc
+++ b/doc/installer.qdoc
@@ -29,24 +29,24 @@
/*!
\page installer.html
-\title Application Installer
+\title Package Installer
\keyword Installer
-\section1 Dynamically Installing, Updating, and Removing Applications
+\section1 Dynamically Installing, Updating, and Removing Packages
-After applications have been packaged by the \c application-packager, they can be installed by the
-application manager at runtime. There are two interfaces for this functionality:
+After applications have been packaged by the \l {Packager}{\c appman-packager} tool, they can be
+installed by the application manager at runtime. There are two interfaces for this functionality:
\list
\li a QML interface for use within the application manager process
\li a D-Bus interface for use by any process that is allowed to talk to the application
- manager's \c ApplicationInstaller interface.
+ manager's \c PackageManager interface.
\endlist
-Both interfaces are very similar and are described in the ApplicationInstaller.
+Both interfaces are very similar and are described in the PackageManager.
\note A prerequisite for dynamically installed application packages is a valid
-\l {Installation Locations}{installation location} configuration for the application manager.
+\l {Configuration}{\c installationDir configuration} for the application manager.
\section1 Packages
@@ -109,7 +109,6 @@ signed packages.
\list
\li \l {Package Format}
\li \l {Packager}
- \li \l {Installation Locations}
- \li \l {ApplicationInstaller}{ApplicationInstaller API}
+ \li \l {PackageManager}{PackageManager API}
\endlist
*/
diff --git a/doc/manifest-old.qdoc b/doc/manifest-old.qdoc
new file mode 100644
index 00000000..84c07f01
--- /dev/null
+++ b/doc/manifest-old.qdoc
@@ -0,0 +1,395 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Luxoft Sweden AB
+** Copyright (C) 2018 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Application Manager.
+**
+** $QT_BEGIN_LICENSE:FDL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+
+\page manifest-old.html
+\keyword info.yaml metadata manifest format
+\title Manifest Definition (pre 5.14)
+
+\note This page describes the old metadata format (\c am-application, version \c 1) that was used
+ up until 5.14. For the current format, please see \l{Manifest Definition}{here}. The 5.14
+ application manager is still able to parse the old format, but \l{Alias Manifests} are not
+ supported anymore.
+
+\section1 Overview
+
+The package manifest or metadata file, \c info.yaml, is a \l {YAML syntax}
+{YAML file following the same rules} as all the other YAML files used in the application manager.
+
+While the application manager can support other file formats, such as XML, currently the only
+metadata loader implemented is based on YAML.
+
+Dynamically installed applications are described by a single \c info.yaml file, in their root
+directory. Built-in applications, that are shipped as part of the System UI can optionally have
+multiple aliases. This behavior is similar to a Microsoft Windows shortcut, where you can start
+the same program using a different icon, name, and commandline arguments. These files have to be
+in the same folder as the application's basic \c info.yaml file and need to be named
+\c info-<descriptive name>.yaml. See \l{Alias Manifests}{below} for a description of these alias
+manifests.
+
+\section1 Basic Manifest
+
+This is an example of a full-featured \c info.yaml file, that also shows how you can mix and match
+classic YAML and JSON style in YAML 1.1 documents:
+
+\badcode
+%YAML 1.1
+---
+formatVersion: 1
+formatType: am-application
+---
+id: 'com.pelagicore.radio'
+icon: 'FM-Radio.png'
+name:
+ en: "FM Radio"
+ de: "UKW-Rundfunk"
+code: "radio.qml"
+
+runtime: qml
+runtimeParameters: { loadDummyData: true }
+documentUrl: "fm"
+
+mimeTypes: [ "x-scheme-handler/x-radio" ]
+
+capabilities:
+- cameraAccess
+- locationAccess
+
+version: '1.2.1-alpha3'
+
+\endcode
+
+The fields within the \c info.yaml file header (first YAML document) are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c formatVersion
+ \li int
+ \li \e Required. Currently always \c 1.
+\row
+ \li \c formatType
+ \li string
+ \li \e Required. Always \c am-application.
+\endtable
+
+The fields within the \c info.yaml manifest data (second YAML document) are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c id
+ \li string
+ \li The unique ID of an application represented as a string with a maximum length of 150
+ characters. This ID can be used to look up information about the application in the
+ \l{ApplicationModel}{ApplicationModel QML Type}. Since this ID is used in the file system, only a subset of
+ the printable ASCII characters are allowed: \c{0-9}, \c{a-z}, \c{A-Z} as well as any of
+ \c{!#$%&'`^~_+-=.,;()[]{}}. If you are building a larger system with third party
+ applications, it is good practice to use reverse DNS notation for the application IDs to
+ help keep track of your IDs in the long run. The helper function
+ \l{ApplicationInstaller::validateDnsName} can help you to enforce this policy from the
+ System UI.
+\row
+ \li \c icon
+ \li string
+ \li \e Required. The icon's file name. The file must be located in the same directory as
+ \c info.yaml and can be in any image format that Qt supports.
+\row
+ \li \c name
+ \target application-name-map
+ \li object
+ \li \e Required. An object containing language (\c string) to display name (\c string)
+ mappings. The language identifiers need to adhere to the standard POSIX locale definition.
+ For more information, see \l{QLocale}. At least one mapping needs to be present. However,
+ it is good practice to supply the English (\c en) mapping, at least, as a fallback.
+\row
+ \li \c code
+ \li string
+ \li \e Required. The main executable - interpreted by the \c runtime.
+\row
+ \li \c categories
+ \li array<string>
+ \li The list of category names the application should be associated with. This is mainly for
+ the automated app-store uploads as well as displaying the application within a fixed set
+ of categories in the System UI.
+\row
+ \li \c runtime
+ \li string
+ \li \e Required. A runtime ID, referencing a runtime plugin. Currently, \c qml,
+ \c qml-inprocess, and \c native are supported.
+
+ For the QML runtimes, the \c code field needs to point to the main QML file, which should
+ have an ApplicationManagerWindow as a root item.
+
+ For the native runtime, the \c code field can point to an arbitrary executable, which is
+ executed via QProcess::start(). The application manager will run the application with the
+ environment variable \c QT_QPA_PLATFORM set to \c wayland.
+
+ \note The application is expected to be a valid Wayland client.
+\row
+ \li \c runtimeParameters
+ \li object
+ \li This object can contain \c runtime specific parameters - those are directly handed down to
+ the runtime plugin by the application manager.
+
+ See \l{runtime-parameters-details}{runtime parameters} for a full list.
+\row
+ \li \c environmentVariables
+ \li object
+ \li \e Deprecated; moved to \l{runtime-parameters-details}{runtime parameters}.
+\row
+ \li \c documentUrl
+ \li string
+ \li An optional default document URL to use if the application is started without
+ specifying a document URL (see \l{ApplicationManager::startApplication}).
+\row
+ \li \c supportsApplicationInterface
+ \li bool
+ \li If set to \c true the application must implement the \l ApplicationInterface API.
+ In this case the application manager will wait until the application is connected to the
+ ApplicationInterface on the P2P D-Bus until it marks it as 'running'. For runtimes that
+ support quick launching (like the \c qml runtime) this is not required as it defaults to
+ \c true. Otherwise the default is \c false.
+\row
+ \li \c mimeTypes
+ \target mimeTypes field
+ \li array<string>
+ \li An optional array of MIME types the application can handle. The application manager
+ supports the classic file name or content to MIME type matching, as well as URL scheme
+ matching. For more information, see \l{ApplicationManager::openUrl}.
+\row
+ \li \c capabilities
+ \li array<string>
+ \li An optional, platform specific list of special access rights for the application. Later,
+ the middleware can query these capabilities and verify them, via the application manager.
+
+ \note The application manager itself does not attach any meaning to this list of strings.
+ Instead, the application manager acts as a trustee between the (digitally signed)
+ application manifest and the (customer specific) middleware; this middleware may
+ require more information about the application it's communicating with and the
+ application manager can act as a trusted source of application \e capabilities.
+\row
+ \li \c version
+ \li string
+ \li The version of the application as a string.
+\row
+ \li \c opengl
+ \li object
+ \li Gives you the possibility to specify the required OpenGL version and/or profile. For more
+ information, see \l{OpenGL Specification}.
+ \note Specifying an OpenGL configuration that is different from the default OpenGL
+ configuration in the main application manager configuration, disables the use of
+ the quick-launch mechanism for this application.
+\row
+ \li \c applicationProperties
+ \li object
+ \li Exports user-defined properties (key/value pairs) to the application and the System UI. The
+ actual properties must be listed under the \c private and \c protected access control
+ tag; other properties are ignored. These properties are exposed as
+ ApplicationManager::application() to the System UI and as
+ ApplicationInterface::applicationProperties to the QML application:
+ \list
+ \li The application has access to private and protected properties. Private keys overwrite
+ identical protected ones.
+ \li The System UI has access to protected properties only.
+ \endlist
+ While the properties are converted to QVariantMaps, the application manager won't interpret
+ them in any way.
+\row
+ \li \c logging/dlt/id
+ \li string
+ \li If provided, this value is used as the automotive DLT application ID. The ID is limited to
+ four characters, additional characters are discarded. If an ID is not provided, it defaults
+ to 'A' followed by a three digit application number.
+
+ \note For QML runtimes, the ID is "PCLQ" from the very start of the application process,
+ until you change it as described.
+\row
+ \li \c logging/dlt/description
+ \li string
+ \li If provided, it is used as the automotive DLT application description, which allows to
+ augment the short DLT application ID with a more verbose description. If not explicitly
+ provided, a default description is used.
+\row
+ \li \c importance
+ \li real
+ \li \e Deprecated. Use \c applicationProperties instead.
+\row
+ \li \c backgroundMode
+ \li string
+ \li \e Deprecated. Use \c applicationProperties instead.
+\endtable
+
+
+\target runtime-parameters-details
+The \c runtimeParameters are specific to the runtimes, so the table below has an additional column
+that specifies which runtime a configuration option applies to:
+
+\table
+\header
+ \li Name
+ \li Runtimes
+ \li Type
+ \li Description
+\row
+ \li \c loadDummyData
+ \li qml, qml-in-process
+ \li bool
+ \li Automatically load dummy data for the application, using the same algorithm as Qt's
+ \c qmlscene and \c qml tools. By default no dummy data is loaded.
+\row
+ \li \c importPaths
+ \li qml, qml-in-process
+ \li array<string>
+ \li A list of paths to add to the QML-engine's import paths. Use of this parameter is
+ equivalent to setting \c QML2_IMPORT_PATH for a program started from the command line.
+\row
+ \li \c resources
+ \li qml, qml-in-process
+ \li array<string>
+ \li Takes a list of \l{The Qt Resource System}{Qt resource} files (.rcc) or libraries that have
+ resources \l{Compiled-In Resources}{compiled-in} and registers them within the application
+ process. Resources can be accessed with the ":" or "qrc://" file path prefix.
+\row
+ \li \c pluginPaths
+ \li qml, qml-in-process
+ \li array<string>
+ \li A list of paths to add to Qt's library paths, which are used to find plugins. Use of this
+ parameter is equivalent to setting \c QT_PLUGIN_PATH for a program started from the command
+ line.
+\row
+ \li \c arguments
+ \li native
+ \li array<string>
+ \li A list of command line parameters to use when starting the application's executable.
+\row
+ \li \c environmentVariables
+ \li native, qml
+ \li object
+ \li A simple string-to-string map, describing the environment variables that should be set when
+ spawning the runtime process. You can remove a variable from the default environment by
+ setting it to \c null.
+
+ \note This feature is meant for development and demos only, as it has the following
+ limitations and side-effects:
+ \list
+ \li These variables are completely ignored, if you are running the application manager
+ with security checks enabled.
+ \li Setting these variables disables the use of the quick launch mechanism for this
+ application.
+ \endlist
+\endtable
+
+\section1 Alias Manifests
+
+\note This page describes the old metadata format (\c am-application, version \c 1) that was used
+ up until 5.14. For the current format, please see \l{Manifest Definition}{here}. The 5.14
+ application manager is still able to parse the old format, but \l{Alias Manifests} are not
+ supported anymore.
+
+This is an example of an alias manifest, \c info-am.yaml, for the \c info.yaml file in the
+\l{Basic Manifest}. This way, you can have one single tuner application \c radio.qml running,
+that can be started using two different entries, both with different text and icons, in the
+application launcher.
+
+\badcode
+%YAML 1.1
+---
+formatVersion: 1
+formatType: am-application-alias
+---
+aliasId: 'com.pelagicore.radio@am'
+icon: 'AM-Radio.png'
+name:
+ en: "AM Radio"
+ de: "Langwellenrundfunk"
+
+documentUrl: "x-radio://am"
+
+\endcode
+
+If you start an alias while the application is already running, it does not start another instance.
+Only if a \c documentUrl is set, then does the instance currently running receive the
+\l{ApplicationInterface::openDocument} signal, that contains the respective strings that
+were set via the \c documentUrl parameter. Then, the application can change its UI accordingly.
+The alias manifests have to be in the same folder as the application's \c info.yaml file and
+must be named \c info-<descriptive name>.yaml.
+
+The meaning of the fields within the \c info-am.yaml file header (first YAML document) is as
+follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c formatVersion
+ \li int
+ \li \e Required. Currently always \c 1.
+\row
+ \li \c formatType
+ \li string
+ \li \e Required. Always \c am-application-alias.
+\endtable
+
+The meaning of the fields within the alias manifest data (second YAML document) is as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c aliasId
+ \li string
+ \li \e Required. The unique ID for the base application, followed by the \c{@} sign and a
+ unique tag for this alias. This tag has the same character restrictions as the main
+ application ID. See the \c id field in \l{Basic Manifest}.
+\row
+ \li \c icon
+ \li string
+ \li \e Required. See the \c icon field in \l{Basic Manifest}.
+\row
+ \li \c name
+ \li object
+ \li \e Required. See the \c name field in \l{Basic Manifest}.
+\row
+ \li \c documentUrl
+ \li string
+ \li See the \c documentUrl in \l{Basic Manifest}.
+\endtable
+
+*/
diff --git a/doc/manifest.qdoc b/doc/manifest.qdoc
index b73310fa..0679943d 100644
--- a/doc/manifest.qdoc
+++ b/doc/manifest.qdoc
@@ -32,6 +32,10 @@
\keyword info.yaml metadata manifest format
\title Manifest Definition
+\note This page describes the current metadata format (\c am-package, version \c 1) that was
+ introduced with the 5.14 release. For the old format - that is still supported - please see
+ \l{Manifest Definition (pre 5.14)}{here}.
+
\section1 Overview
The package manifest or metadata file, \c info.yaml, is a \l {YAML syntax}
@@ -40,15 +44,10 @@ The package manifest or metadata file, \c info.yaml, is a \l {YAML syntax}
While the application manager can support other file formats, such as XML, currently the only
metadata loader implemented is based on YAML.
-Dynamically installed applications are described by a single \c info.yaml file, in their root
-directory. Built-in applications, that are shipped as part of the System UI can optionally have
-multiple aliases. This behavior is similar to a Microsoft Windows shortcut, where you can start
-the same program using a different icon, name, and commandline arguments. These files have to be
-in the same folder as the application's basic \c info.yaml file and need to be named
-\c info-<descriptive name>.yaml. See \l{Alias Manifests}{below} for a description of these alias
-manifests.
+All packages and their contained applications are described by a single \c info.yaml file, in the
+root directory of the package.
-\section1 Basic Manifest
+\section1 Package Manifest
This is an example of a full-featured \c info.yaml file, that also shows how you can mix and match
classic YAML and JSON style in YAML 1.1 documents:
@@ -57,27 +56,26 @@ classic YAML and JSON style in YAML 1.1 documents:
%YAML 1.1
---
formatVersion: 1
-formatType: am-application
+formatType: am-package
---
id: 'com.pelagicore.radio'
icon: 'FM-Radio.png'
name:
en: "FM Radio"
de: "UKW-Rundfunk"
-code: "radio.qml"
-
-runtime: qml
-runtimeParameters: { loadDummyData: true }
-documentUrl: "fm"
-mimeTypes: [ "x-scheme-handler/x-radio" ]
+version: '1.2.1-alpha3'
-capabilities:
-- cameraAccess
-- locationAccess
+applications:
+- id: com.pelagicore.radio.app
+ code: "radio.qml"
-version: '1.2.1-alpha3'
+ runtime: qml
+ runtimeParameters: { loadDummyData: true }
+ capabilities:
+ - cameraAccess
+ - locationAccess
\endcode
The fields within the \c info.yaml file header (first YAML document) are as follows:
@@ -94,7 +92,7 @@ The fields within the \c info.yaml file header (first YAML document) are as foll
\row
\li \c formatType
\li string
- \li \e Required. Always \c am-application.
+ \li \e Required. Always \c am-package.
\endtable
The fields within the \c info.yaml manifest data (second YAML document) are as follows:
@@ -107,14 +105,14 @@ The fields within the \c info.yaml manifest data (second YAML document) are as f
\row
\li \c id
\li string
- \li The unique ID of an application represented as a string with a maximum length of 150
- characters. This ID can be used to look up information about the application in the
- \l{ApplicationModel}{ApplicationModel QML Type}. Since this ID is used in the file system, only a subset of
- the printable ASCII characters are allowed: \c{0-9}, \c{a-z}, \c{A-Z} as well as any of
- \c{!#$%&'`^~_+-=.,;()[]{}}. If you are building a larger system with third party
- applications, it is good practice to use reverse DNS notation for the application IDs to
+ \li The unique ID of the package represented as a string with a maximum length of 150
+ characters. This ID can be used to look up information about the package in the
+ \l{PackageManager}{PackageManager QML Type}. Since this ID is used in the file system, only
+ a subset of the printable ASCII characters are allowed: \c{0-9}, \c{a-z}, \c{A-Z} as well as
+ any of \c{!#$%&'`^~_+-=.,;()[]{}}. If you are building a larger system with third party
+ applications, it is good practice to use reverse DNS notation for the package IDs to
help keep track of your IDs in the long run. The helper function
- \l{ApplicationInstaller::validateDnsName} can help you to enforce this policy from the
+ \l{PackageManager::validateDnsName} can help you to enforce this policy from the
System UI.
\row
\li \c icon
@@ -123,23 +121,62 @@ The fields within the \c info.yaml manifest data (second YAML document) are as f
\c info.yaml and can be in any image format that Qt supports.
\row
\li \c name
- \target application-name-map
+ \target package-name-map
\li object
\li \e Required. An object containing language (\c string) to display name (\c string)
mappings. The language identifiers need to adhere to the standard POSIX locale definition.
For more information, see \l{QLocale}. At least one mapping needs to be present. However,
it is good practice to supply the English (\c en) mapping, at least, as a fallback.
\row
+ \li \c description
+ \li object
+ \li \e An optional object containing language (\c string) to descriptive name (\c string)
+ mappings. This field uses the same syntax as the \c name field.
+\row
+ \li \c categories
+ \li list<string>
+ \li The list of category names the package should be associated with. This is mainly for
+ the automated app-store uploads as well as displaying the packages's applications or
+ intents within a fixed set of categories in the System UI.
+\row
+ \li \c version
+ \li string
+ \li The version of the package as a string.
+\row
+ \li \c applications
+ \li list
+ \li \e Required. The list of applications contained in this package. At least one application
+ has to be defined.
+\row
+ \li \c intents
+ \li list
+ \li \e The list of intents provided by applications in this package.
+\endtable
+
+The fields used for each item within the \c applications list are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c id
+ \li string
+ \li The unique ID of an application represented as a string with a maximum length of 150
+ characters. This ID can be used to look up information about the application in the
+ \l{ApplicationModel}{ApplicationModel QML Type}. Since this ID is used in the file system, only a subset of
+ the printable ASCII characters are allowed: \c{0-9}, \c{a-z}, \c{A-Z} as well as any of
+ \c{!#$%&'`^~_+-=.,;()[]{}}. If you are building a larger system with third party
+ applications, it is good practice to use reverse DNS notation for the application IDs to
+ help keep track of your IDs in the long run. The helper function
+ \l{ApplicationInstaller::validateDnsName} can help you to enforce this policy from the
+ System UI.
+\row
\li \c code
\li string
\li \e Required. The main executable - interpreted by the \c runtime.
\row
- \li \c categories
- \li array<string>
- \li The list of category names the application should be associated with. This is mainly for
- the automated app-store uploads as well as displaying the application within a fixed set
- of categories in the System UI.
-\row
\li \c runtime
\li string
\li \e Required. A runtime ID, referencing a runtime plugin. Currently, \c qml,
@@ -161,32 +198,16 @@ The fields within the \c info.yaml manifest data (second YAML document) are as f
See \l{runtime-parameters-details}{runtime parameters} for a full list.
\row
- \li \c environmentVariables
- \li object
- \li \e Deprecated; moved to \l{runtime-parameters-details}{runtime parameters}.
-\row
- \li \c documentUrl
- \li string
- \li An optional default document URL to use if the application is started without
- specifying a document URL (see \l{ApplicationManager::startApplication}).
-\row
\li \c supportsApplicationInterface
\li bool
\li If set to \c true the application must implement the \l ApplicationInterface API.
- In this case the ApplicationManager will wait until the application is connected to the
+ In this case the application manager will wait until the application is connected to the
ApplicationInterface on the P2P D-Bus until it marks it as 'running'. For runtimes that
support quick launching (like the \c qml runtime) this is not required as it defaults to
\c true. Otherwise the default is \c false.
\row
- \li \c mimeTypes
- \target mimeTypes field
- \li array<string>
- \li An optional array of MIME types the application can handle. The application manager
- supports the classic file name or content to MIME type matching, as well as URL scheme
- matching. For more information, see \l{ApplicationManager::openUrl}.
-\row
\li \c capabilities
- \li array<string>
+ \li list<string>
\li An optional, platform specific list of special access rights for the application. Later,
the middleware can query these capabilities and verify them, via the application manager.
@@ -196,10 +217,6 @@ The fields within the \c info.yaml manifest data (second YAML document) are as f
require more information about the application it's communicating with and the
application manager can act as a trusted source of application \e capabilities.
\row
- \li \c version
- \li string
- \li The version of the application as a string.
-\row
\li \c opengl
\li object
\li Gives you the possibility to specify the required OpenGL version and/or profile. For more
@@ -237,14 +254,67 @@ The fields within the \c info.yaml manifest data (second YAML document) are as f
\li If provided, it is used as the automotive DLT application description, which allows to
augment the short DLT application ID with a more verbose description. If not explicitly
provided, a default description is used.
+\endtable
+
+The fields used for each item within the \c intents list are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
\row
- \li \c importance
- \li real
- \li \e Deprecated. Use \c applicationProperties instead.
+ \li \c id
+ \li string
+ \li Required. The id of the intent. Make sure to only specify intent IDs that the applications
+ in this package are actually handling.
\row
- \li \c backgroundMode
+ \li \c visibility
\li string
- \li \e Deprecated. Use \c applicationProperties instead.
+ \li The visibility of this intent outside of this package: Can be either \c private or \c public
+ (which is the default, if this field is not specified at all). Private intents can only be
+ requested by applications from this package, while public intents can also be requested by
+ other applications in the system.
+\row
+ \li \c handlingApplicationId
+ \li string
+ \li If this package contains more than one application, then it is mandatory to specify which
+ application is handling this intent; if there is only one application defined, then this
+ application will be used as the default handler for all intents.
+ The given application id has to be from within this package.
+\row
+ \li \c requiredCapabilities
+ \li list<string>
+ \li Limit the client applications that are able to call this intent to applications having at
+ least one of the capabilities given in this list. An empty list or by simply not specifying
+ this field at all will lead to no capability restrictions.
+\row
+ \li \c parameterMatch
+ \li object
+ \li Filter the intent based on the incoming parameters. This can be used to have multiple
+ applications being able to handle the same intent, dependent on the actual parameters in
+ the intent request. See the IntentObject::parameterMatch documentation for a detailed
+ explanation for this field.
+\row
+ \li \c name
+ \li object
+ \li The name of the intent. It will default to the \c name field in the global section, but it
+ can be overridden for each intent by specifying this field.
+\row
+ \li \c icon
+ \li string
+ \li The icon of the intent. It will default to the \c icon field in the global section, but it
+ can be overridden for each intent by specifying this field.
+\row
+ \li \c description
+ \li object
+ \li The description of the intent. It will default to the \c description field in the global
+ section, but it can be overridden for each intent by specifying this field.
+\row
+ \li \c categories
+ \li object
+ \li The list of categories for this intent. It will default to the \c categories field in the
+ global section, but it can be overridden for each intent by specifying this field.
\endtable
@@ -267,27 +337,27 @@ that specifies which runtime a configuration option applies to:
\row
\li \c importPaths
\li qml, qml-in-process
- \li array<string>
+ \li list<string>
\li A list of paths to add to the QML-engine's import paths. Use of this parameter is
equivalent to setting \c QML2_IMPORT_PATH for a program started from the command line.
\row
\li \c resources
\li qml, qml-in-process
- \li array<string>
+ \li list<string>
\li Takes a list of \l{The Qt Resource System}{Qt resource} files (.rcc) or libraries that have
resources \l{Compiled-In Resources}{compiled-in} and registers them within the application
process. Resources can be accessed with the ":" or "qrc://" file path prefix.
\row
\li \c pluginPaths
\li qml, qml-in-process
- \li array<string>
+ \li list<string>
\li A list of paths to add to Qt's library paths, which are used to find plugins. Use of this
parameter is equivalent to setting \c QT_PLUGIN_PATH for a program started from the command
line.
\row
\li \c arguments
\li native
- \li array<string>
+ \li list<string>
\li A list of command line parameters to use when starting the application's executable.
\row
\li \c environmentVariables
@@ -307,79 +377,4 @@ that specifies which runtime a configuration option applies to:
\endlist
\endtable
-\section1 Alias Manifests
-
-This is an example of an alias manifest, \c info-am.yaml, for the \c info.yaml file in the
-\l{Basic Manifest}. This way, you can have one single tuner application \c radio.qml running,
-that can be started using two different entries, both with different text and icons, in the
-application launcher.
-
-\badcode
-%YAML 1.1
----
-formatVersion: 1
-formatType: am-application-alias
----
-aliasId: 'com.pelagicore.radio@am'
-icon: 'AM-Radio.png'
-name:
- en: "AM Radio"
- de: "Langwellenrundfunk"
-
-documentUrl: "x-radio://am"
-
-\endcode
-
-If you start an alias while the application is already running, it does not start another instance.
-Only if a \c documentUrl is set, then does the instance currently running receive the
-\l{ApplicationInterface::openDocument} signal, that contains the respective strings that
-were set via the \c documentUrl parameter. Then, the application can change its UI accordingly.
-The alias manifests have to be in the same folder as the application's \c info.yaml file and
-must be named \c info-<descriptive name>.yaml.
-
-The meaning of the fields within the \c info-am.yaml file header (first YAML document) is as
-follows:
-
-\table
-\header
- \li Field Name
- \li Type
- \li Description
-\row
- \li \c formatVersion
- \li int
- \li \e Required. Currently always \c 1.
-\row
- \li \c formatType
- \li string
- \li \e Required. Always \c am-application-alias.
-\endtable
-
-The meaning of the fields within the alias manifest data (second YAML document) is as follows:
-
-\table
-\header
- \li Field Name
- \li Type
- \li Description
-\row
- \li \c aliasId
- \li string
- \li \e Required. The unique ID for the base application, followed by the \c{@} sign and a
- unique tag for this alias. This tag has the same character restrictions as the main
- application ID. See the \c id field in \l{Basic Manifest}.
-\row
- \li \c icon
- \li string
- \li \e Required. See the \c icon field in \l{Basic Manifest}.
-\row
- \li \c name
- \li object
- \li \e Required. See the \c name field in \l{Basic Manifest}.
-\row
- \li \c documentUrl
- \li string
- \li See the \c documentUrl in \l{Basic Manifest}.
-\endtable
-
*/
diff --git a/doc/package-format.qdoc b/doc/package-format.qdoc
index 8e49492d..e7966d7a 100644
--- a/doc/package-format.qdoc
+++ b/doc/package-format.qdoc
@@ -60,7 +60,8 @@ These are the important files in a package:
\row
\li \c info.yaml
\li The manifest of the application. The packaging tool needs to make sure that this file is
- within the first 10 entries of the tar archive.
+ within the first 10 entries of the tar archive. See \l{Manifest Definition} for the
+ documentation of the file format.
\row
\li \c icon.png
\li The icon of the application that is used in the app-store. Can also be used as the app's icon
@@ -124,6 +125,48 @@ existing implementations:
\li Python m2crypt based in the appstore-server reference implementation.
\endlist
+\section1 The Header and Footer file format
+
+The fields within the \c{--PACKAGE-FOOTER--} and \c{--PACKAGE-HEADER--} file headers (first YAML
+document) are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c formatVersion
+ \li int
+ \li \e Required. Currently always \c 2.
+\row
+ \li \c formatType
+ \li string
+ \li \e Required. Always \c am-package-header for headers or \c am-package-footer for footers.
+\endtable
+
+The fields within the \c{--PACKAGE-FOOTER--} and \c{--PACKAGE-HEADER--} data (second YAML document)
+are as follows:
+
+\table
+\header
+ \li Field Name
+ \li Type
+ \li Description
+\row
+ \li \c id
+ \li string
+ \li The unique ID of the package. This has to match the ID of the package as described by the
+ encompaning \c info.yaml manifest file.
+\row
+ \li \c icon
+ \li string
+ \li \e Required. The icon's file name. The file must be located in the same directory as
+ \c info.yaml and can be in any image format that Qt supports.
+\endtable
+
+\note The old format (pre 5.14) had the formatVersion header field set to \c 1 and used the field
+ name \c applicationId instead of \c packageId.
\section1 Example Package
@@ -143,9 +186,9 @@ tar cvzf qmlapp.appkg ./--PACKAGE-HEADER-- info.yaml icon.png main.qml ./--PACKA
%YAML 1.1
---
formatType: am-package-header
-formatVersion: 1
+formatVersion: 2
---
-applicationId: com.pelagicore.minimal
+packageId: com.pelagicore.minimal
diskSpaceUsed: 1000
\endcode
\row
@@ -153,16 +196,17 @@ diskSpaceUsed: 1000
\li \badcode
%YAML 1.1
---
-formatType: am-application
+formatType: am-package
formatVersion: 1
---
id: 'com.pelagicore.minimal'
icon: 'icon.png'
name:
en: 'Minimal App'
-code: 'main.qml'
-
-runtime: 'qml'
+applications:
+- id: com.pelagicore.minimalapp
+ code: 'main.qml'
+ runtime: 'qml'
\endcode
\row
\li \c icon.png
@@ -178,7 +222,7 @@ runtime: 'qml'
%YAML 1.1
---
formatType: am-package-footer
-formatVersion: 1
+formatVersion: 2
---
# SHA256 digest in 32 char hex representation
digest: '9df5635bb50e93846954c6377468c07835119e2835475ec90b3e9a9f7261cf27'
diff --git a/doc/systemui.qdoc b/doc/systemui.qdoc
index 44a2a3a6..4ebefab3 100644
--- a/doc/systemui.qdoc
+++ b/doc/systemui.qdoc
@@ -109,7 +109,7 @@ One example of a simple System UI is the one written for the "Hello World!" Syst
\section2 Notifications
In cases where you'd like to display notificiations or pop-ups, applications or clients can
-create these with \l{ApplicationInterface.createNotification()}. They are then made available
+create these with \l{ApplicationInterface::createNotification()}. They are then made available
on the System UI via the \l{NotificationManager}.
The code snippet below is part of the \l{Desktop System UI Example} that illustrates how to
@@ -122,7 +122,7 @@ display pop-ups.
\section2 Intents
The System UI and other applications can send and receive intents. This is exposed via the
-\l{Intent} and \l{IntentServer} QML types. The Intent represents a single intent definition on
+\l{IntentObject} and \l{IntentServer} QML types. The Intent represents a single intent definition on
the System UI; the IntentServer is the singleton on the System UI-side that represents the
intents sub-system.
@@ -137,7 +137,7 @@ Optionally, you can also pass a \c documentUrl in the \l{ApplicationObject::star
function. Then, when you call \c{start()} several times, with a different \c documentUrl()
each time, you won't be restarting the application; but only triggering the
\l{ApplicationInterface::openDocument()} on the application or client side.
-\l{ApplicationInterface::stop()} triggers \l{ApplicationInterface::quit()} on the application
+\l{ApplicationObject::stop()} triggers \l{ApplicationInterface::quit()} on the application
side. The application should do all the necessary clean-ups and then confirm that it can be
terminates with \l{ApplicationInterface::acknowledgeQuit()}.
diff --git a/src/application-lib/applicationinfo.cpp b/src/application-lib/applicationinfo.cpp
index 661ffa3c..4e4f1fac 100644
--- a/src/application-lib/applicationinfo.cpp
+++ b/src/application-lib/applicationinfo.cpp
@@ -51,6 +51,7 @@
QT_BEGIN_NAMESPACE_AM
+static constexpr quint32 ApplicationInfoDataStreamVersion = 1;
//TODO Make this really unique
static int uniqueCounter = 0;
@@ -62,6 +63,7 @@ static int nextUniqueNumber() {
return uniqueCounter;
}
+
ApplicationInfo::ApplicationInfo(PackageInfo *packageInfo)
: m_packageInfo(packageInfo)
, m_uniqueNumber(nextUniqueNumber())
@@ -94,7 +96,8 @@ QVariantMap ApplicationInfo::allAppProperties() const
void ApplicationInfo::writeToDataStream(QDataStream &ds) const
{
- ds << m_id
+ ds << ApplicationInfoDataStreamVersion
+ << m_id
<< m_uniqueNumber
<< m_sysAppProperties
<< m_allAppProperties
@@ -103,14 +106,17 @@ void ApplicationInfo::writeToDataStream(QDataStream &ds) const
<< m_runtimeParameters
<< m_supportsApplicationInterface
<< m_capabilities
- << m_openGLConfiguration;
+ << m_openGLConfiguration
+ << m_dltConfiguration;
}
ApplicationInfo *ApplicationInfo::readFromDataStream(PackageInfo *pkg, QDataStream &ds)
{
QScopedPointer<ApplicationInfo> app(new ApplicationInfo(pkg));
+ auto dataStreamVersion = ApplicationInfoDataStreamVersion;
- ds >> app->m_id
+ ds >> dataStreamVersion
+ >> app->m_id
>> app->m_uniqueNumber
>> app->m_sysAppProperties
>> app->m_allAppProperties
@@ -119,7 +125,11 @@ ApplicationInfo *ApplicationInfo::readFromDataStream(PackageInfo *pkg, QDataStre
>> app->m_runtimeParameters
>> app->m_supportsApplicationInterface
>> app->m_capabilities
- >> app->m_openGLConfiguration;
+ >> app->m_openGLConfiguration
+ >> app->m_dltConfiguration;
+
+ if (dataStreamVersion != ApplicationInfoDataStreamVersion)
+ return nullptr;
uniqueCounter = qMax(uniqueCounter, app->m_uniqueNumber);
app->m_capabilities.sort();
@@ -161,7 +171,7 @@ QVariantMap ApplicationInfo::toVariantMap() const
map[qSL("manifestDir")] = map[qSL("baseDir")]; // 5.12 backward compatibility
map[qSL("installationLocationId")] = packageInfo()->installationReport() ? qSL("internal-0") : QString();
map[qSL("supportsApplicationInterface")] = m_supportsApplicationInterface;
- map[qSL("dlt")] = packageInfo()->dltConfiguration();
+ map[qSL("dlt")] = m_dltConfiguration;
return map;
}
@@ -206,4 +216,9 @@ bool ApplicationInfo::supportsApplicationInterface() const
return m_supportsApplicationInterface;
}
+QVariantMap ApplicationInfo::dltConfiguration() const
+{
+ return m_dltConfiguration;
+}
+
QT_END_NAMESPACE_AM
diff --git a/src/application-lib/applicationinfo.h b/src/application-lib/applicationinfo.h
index 6dd9afa5..58451145 100644
--- a/src/application-lib/applicationinfo.h
+++ b/src/application-lib/applicationinfo.h
@@ -77,6 +77,7 @@ public:
QStringList supportedMimeTypes() const;
QVariantMap openGLConfiguration() const;
bool supportsApplicationInterface() const;
+ QVariantMap dltConfiguration() const;
void writeToDataStream(QDataStream &ds) const;
static ApplicationInfo *readFromDataStream(PackageInfo *pkg, QDataStream &ds);
@@ -100,6 +101,7 @@ private:
QStringList m_capabilities;
QVariantMap m_openGLConfiguration;
QStringList m_supportedMimeTypes; // deprecated
+ QVariantMap m_dltConfiguration;
friend class ApplicationManager; // needed to update installation status
friend class PackageDatabase; // needed to create ApplicationInfo objects
diff --git a/src/application-lib/applicationinterface.cpp b/src/application-lib/applicationinterface.cpp
index 1ba0ea75..74343c60 100644
--- a/src/application-lib/applicationinterface.cpp
+++ b/src/application-lib/applicationinterface.cpp
@@ -44,7 +44,7 @@
\qmltype ApplicationInterface
\inqmlmodule QtApplicationManager.Application
\ingroup app-singletons
- \brief The main interface between apps and the application-manager.
+ \brief The main interface between apps and the application manager.
This item is available for QML applications using the root context property
\c ApplicationInterface. For other native applications, the same interface
@@ -194,5 +194,5 @@
ApplicationManager::startApplication without a \c documentUrl argument or
the \c target argument of Qt::openUrlExternally, when your application matches
a MIME-type request. In the latter case \a mimeType contains the MIME-type detected
- by the ApplicationManager.
+ by the application manager.
*/
diff --git a/src/application-lib/intentinfo.cpp b/src/application-lib/intentinfo.cpp
index 43892939..1097f526 100644
--- a/src/application-lib/intentinfo.cpp
+++ b/src/application-lib/intentinfo.cpp
@@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE_AM
+static constexpr quint32 IntentInfoDataStreamVersion = 1;
+
IntentInfo::IntentInfo(PackageInfo *packageInfo)
: m_packageInfo(packageInfo)
@@ -112,7 +114,8 @@ QString IntentInfo::icon() const
void IntentInfo::writeToDataStream(QDataStream &ds) const
{
- ds << m_id
+ ds << IntentInfoDataStreamVersion
+ << m_id
<< (m_visibility == Public ? qSL("public") : qSL("private"))
<< m_requiredCapabilities
<< m_parameterMatch
@@ -127,8 +130,10 @@ IntentInfo *IntentInfo::readFromDataStream(PackageInfo *pkg, QDataStream &ds)
{
QScopedPointer<IntentInfo> intent(new IntentInfo(pkg));
QString visibilityStr;
+ auto dataStreamVersion = IntentInfoDataStreamVersion;
- ds >> intent->m_id
+ ds >> dataStreamVersion
+ >> intent->m_id
>> visibilityStr
>> intent->m_requiredCapabilities
>> intent->m_parameterMatch
@@ -138,6 +143,9 @@ IntentInfo *IntentInfo::readFromDataStream(PackageInfo *pkg, QDataStream &ds)
>> intent->m_descriptions
>> intent->m_icon;
+ if (dataStreamVersion != IntentInfoDataStreamVersion)
+ return nullptr;
+
intent->m_visibility = (visibilityStr == qSL("public")) ? Public : Private;
intent->m_categories.sort();
diff --git a/src/application-lib/packageinfo.cpp b/src/application-lib/packageinfo.cpp
index dc6813d2..fddf268d 100644
--- a/src/application-lib/packageinfo.cpp
+++ b/src/application-lib/packageinfo.cpp
@@ -53,6 +53,9 @@
QT_BEGIN_NAMESPACE_AM
+static constexpr quint32 PackageInfoDataStreamVersion = 1;
+
+
PackageInfo::PackageInfo()
{ }
@@ -133,11 +136,6 @@ QString PackageInfo::version() const
return m_version;
}
-QVariantMap PackageInfo::dltConfiguration() const
-{
- return m_dltConfiguration;
-}
-
const QDir &PackageInfo::baseDir() const
{
@@ -179,7 +177,8 @@ void PackageInfo::writeToDataStream(QDataStream &ds) const
report->serialize(&buffer);
}
- ds << m_id
+ ds << PackageInfoDataStreamVersion
+ << m_id
<< m_names
<< m_icon
<< m_descriptions
@@ -187,7 +186,6 @@ void PackageInfo::writeToDataStream(QDataStream &ds) const
<< m_version
<< m_builtIn
<< m_uid
- << m_dltConfiguration
<< m_baseDir.absolutePath()
<< serializedReport;
@@ -206,8 +204,10 @@ PackageInfo *PackageInfo::readFromDataStream(QDataStream &ds)
QString baseDir;
QByteArray serializedReport;
+ auto dataStreamVersion = PackageInfoDataStreamVersion;
- ds >> pkg->m_id
+ ds >> dataStreamVersion
+ >> pkg->m_id
>> pkg->m_names
>> pkg->m_icon
>> pkg->m_descriptions
@@ -215,10 +215,12 @@ PackageInfo *PackageInfo::readFromDataStream(QDataStream &ds)
>> pkg->m_version
>> pkg->m_builtIn
>> pkg->m_uid
- >> pkg->m_dltConfiguration
>> baseDir
>> serializedReport;
+ if (dataStreamVersion != PackageInfoDataStreamVersion)
+ return nullptr;
+
pkg->m_baseDir.setPath(baseDir);
if (!serializedReport.isEmpty()) {
@@ -228,19 +230,27 @@ PackageInfo *PackageInfo::readFromDataStream(QDataStream &ds)
try {
pkg->m_installationReport->deserialize(&buffer);
} catch (...) {
- pkg->m_installationReport.reset();
+ return nullptr;
}
}
int applicationsSize;
ds >> applicationsSize;
- while (--applicationsSize >= 0)
- pkg->m_applications << ApplicationInfo::readFromDataStream(pkg.data(), ds);
+ while (--applicationsSize >= 0) {
+ if (auto app = ApplicationInfo::readFromDataStream(pkg.data(), ds))
+ pkg->m_applications << app;
+ else
+ return nullptr;
+ }
int intentsSize;
ds >> intentsSize;
- while (--intentsSize >= 0)
- pkg->m_intents << IntentInfo::readFromDataStream(pkg.data(), ds);
+ while (--intentsSize >= 0) {
+ if (auto intent = IntentInfo::readFromDataStream(pkg.data(), ds))
+ pkg->m_intents << intent;
+ else
+ return nullptr;
+ }
return pkg.take();
}
diff --git a/src/application-lib/packageinfo.h b/src/application-lib/packageinfo.h
index dc1708e1..1c59f64e 100644
--- a/src/application-lib/packageinfo.h
+++ b/src/application-lib/packageinfo.h
@@ -81,7 +81,6 @@ public:
bool isBuiltIn() const;
void setBuiltIn(bool builtIn);
QString version() const;
- QVariantMap dltConfiguration() const;
uint uid() const { return m_uid; }
const QDir &baseDir() const;
@@ -115,7 +114,6 @@ private:
QString m_version;
bool m_builtIn = false; // system package - not removable
uint m_uid = uint(-1); // unix user id - move to installationReport
- QVariantMap m_dltConfiguration;
QVector<ApplicationInfo *> m_applications;
QVector<IntentInfo *> m_intents;
diff --git a/src/application-lib/yamlpackagescanner.cpp b/src/application-lib/yamlpackagescanner.cpp
index f6a569fe..8b0282d1 100644
--- a/src/application-lib/yamlpackagescanner.cpp
+++ b/src/application-lib/yamlpackagescanner.cpp
@@ -135,20 +135,6 @@ PackageInfo *YamlPackageScanner::scan(QIODevice *source, const QString &fileName
fields.emplace_back("version", false, YamlParser::Scalar, [&pkgInfo](YamlParser *p) {
pkgInfo->m_version = p->parseString();
});
- fields.emplace_back("logging", false, YamlParser::Map, [&pkgInfo](YamlParser *p) {
- const QVariantMap logging = p->parseMap();
- if (!logging.isEmpty()) {
- if (logging.size() > 1 || logging.firstKey() != qSL("dlt"))
- throw YamlParserException(p, "'logging' only supports the 'dlt' key");
- pkgInfo->m_dltConfiguration = logging.value(qSL("dlt")).toMap();
-
- // sanity check
- for (auto it = pkgInfo->m_dltConfiguration.cbegin(); it != pkgInfo->m_dltConfiguration.cend(); ++it) {
- if (it.key() != qSL("id") && it.key() != qSL("description"))
- throw YamlParserException(p, "unsupported key in 'logging/dlt'");
- }
- }
- });
if (legacy) {
fields.emplace_back("code", true, YamlParser::Scalar, [&legacyAppInfo](YamlParser *p) {
legacyAppInfo->m_codeFilePath = p->parseString();
@@ -258,6 +244,20 @@ PackageInfo *YamlPackageScanner::scan(QIODevice *source, const QString &fileName
for (auto it = pri.cbegin(); it != pri.cend(); ++it)
appInfo->m_allAppProperties.insert(it.key(), it.value());
});
+ appFields.emplace_back("logging", false, YamlParser::Map, [&appInfo](YamlParser *p) {
+ const QVariantMap logging = p->parseMap();
+ if (!logging.isEmpty()) {
+ if (logging.size() > 1 || logging.firstKey() != qSL("dlt"))
+ throw YamlParserException(p, "'logging' only supports the 'dlt' key");
+ appInfo->m_dltConfiguration = logging.value(qSL("dlt")).toMap();
+
+ // sanity check
+ for (auto it = appInfo->m_dltConfiguration.cbegin(); it != appInfo->m_dltConfiguration.cend(); ++it) {
+ if (it.key() != qSL("id") && it.key() != qSL("description"))
+ throw YamlParserException(p, "unsupported key in 'logging/dlt'");
+ }
+ }
+ });
p->parseFields(appFields);
appIds << appInfo->id();
diff --git a/src/dbus-lib/packagemanagerdbuscontextadaptor.cpp b/src/dbus-lib/packagemanagerdbuscontextadaptor.cpp
index b423389c..ae4ba835 100644
--- a/src/dbus-lib/packagemanagerdbuscontextadaptor.cpp
+++ b/src/dbus-lib/packagemanagerdbuscontextadaptor.cpp
@@ -41,6 +41,7 @@
****************************************************************************/
#include "packagemanagerdbuscontextadaptor.h"
+#include "package.h"
#include "packagemanager.h"
#include "io.qt.packagemanager_adaptor.h"
#include "dbuspolicy.h"
@@ -71,21 +72,26 @@ QT_USE_NAMESPACE_AM
PackageManagerAdaptor::PackageManagerAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
- auto ai = PackageManager::instance();
+ auto pm = PackageManager::instance();
- connect(ai, &PackageManager::taskBlockingUntilInstallationAcknowledge,
+ connect(pm, &PackageManager::taskBlockingUntilInstallationAcknowledge,
this, &PackageManagerAdaptor::taskBlockingUntilInstallationAcknowledge);
- connect(ai, &PackageManager::taskFailed,
+ connect(pm, &PackageManager::taskFailed,
this, &PackageManagerAdaptor::taskFailed);
- connect(ai, &PackageManager::taskFinished,
+ connect(pm, &PackageManager::taskFinished,
this, &PackageManagerAdaptor::taskFinished);
- connect(ai, &PackageManager::taskProgressChanged,
+ connect(pm, &PackageManager::taskProgressChanged,
this, &PackageManagerAdaptor::taskProgressChanged);
- connect(ai, &PackageManager::taskRequestingInstallationAcknowledge,
- this, &PackageManagerAdaptor::taskRequestingInstallationAcknowledge);
- connect(ai, &PackageManager::taskStarted,
+ connect(pm, &PackageManager::taskRequestingInstallationAcknowledge,
+ this, [this](const QString &taskId, Package *package,
+ const QVariantMap &packageExtraMetaData,
+ const QVariantMap &packageExtraSignedMetaData) {
+ taskRequestingInstallationAcknowledge(taskId, get(package->id()), packageExtraMetaData,
+ packageExtraSignedMetaData);
+ });
+ connect(pm, &PackageManager::taskStarted,
this, &PackageManagerAdaptor::taskStarted);
- connect(ai, &PackageManager::taskStateChanged,
+ connect(pm, &PackageManager::taskStateChanged,
[this](const QString &taskId, AsynchronousTask::TaskState newState) {
emit taskStateChanged(taskId, taskStateToString(newState));
});
diff --git a/src/intent-server-lib/intent.cpp b/src/intent-server-lib/intent.cpp
index 72eff40b..6c3b8a14 100644
--- a/src/intent-server-lib/intent.cpp
+++ b/src/intent-server-lib/intent.cpp
@@ -56,9 +56,18 @@ QT_BEGIN_NAMESPACE_AM
\ingroup system-ui-non-instantiable
\brief This type represents an Intent definition on the System-UI side.
- This is a QML object class representing a single Intent definition for a specific application.
- It is not creatable from QML code and all properties are read-only. Only functions and
- properties of IntentServer will return pointers to this class.
+ Each instance of this class represents a single Intent definition for a specific application.
+
+ Most of the read-only properties map directly to values read from the package's
+ \c info.yaml file - these are documented in the \l{Manifest Definition}.
+
+ Items of this type are not creatable from QML code. Only functions and properties of
+ IntentServer and IntentModel will return pointers to this class.
+
+ Make sure to \b not save references to an IntentObject across function calls: packages (and
+ with that, the intents contained within) can be deinstalled at any time, invalidating your
+ reference. In case you do need a persistent handle, use the intentId together with the
+ applicationId string.
*/
/*! \qmlproperty string IntentObject::intentId
diff --git a/src/main-lib/applicationinstaller.cpp b/src/main-lib/applicationinstaller.cpp
index f9d66641..0947046c 100644
--- a/src/main-lib/applicationinstaller.cpp
+++ b/src/main-lib/applicationinstaller.cpp
@@ -51,137 +51,82 @@
\qmltype ApplicationInstaller
\inqmlmodule QtApplicationManager.SystemUI
\ingroup system-ui-singletons
- \brief The package installation/removal/update part of the application-manager.
-
- The ApplicationInstaller singleton type handles the package installation
- part of the application manager. It provides both a DBus and QML APIs for
- all of its functionality.
-
- \note The ApplicationInstaller singleton and its corresponding DBus API are only available if you
- specify a base directory for installed application manifests. See \l{Configuration} for details.
-
- \target TaskStates
-
- The following table describes all possible states that a background task could be in:
-
- \table
- \header
- \li Task State
- \li Description
- \row
- \li \c Queued
- \li The task was created and is now queued up for execution.
- \row
- \li \c Executing
- \li The task is being executed.
- \row
- \li \c Finished
- \li The task was executed successfully.
- \row
- \li \c Failed
- \li The task failed to execute successfully.
- \row
- \li \c AwaitingAcknowledge
- \li \e{Installation tasks only!} The task is currently halted, waiting for either
- acknowledgePackageInstallation() or cancelTask() to continue. See startPackageInstallation()
- for more information on the installation workflow.
- \row
- \li \c Installing
- \li \e{Installation tasks only!} The installation was acknowledged via acknowledgePackageInstallation()
- and the final installation phase is now running.
- \row
- \li \c CleaningUp
- \li \e{Installation tasks only!} The installation has finished, and previous installations as
- well as temporary files are being cleaned up.
- \endtable
-
- The normal workflow for tasks is: \c Queued \unicode{0x2192} \c Executing \unicode{0x2192} \c
- Finished. The task can enter the \c Failed state at any point though - either by being canceled via
- cancelTask() or simply by failing due to an error.
-
- Installation tasks are a bit more complex due to the acknowledgment: \c Queued \unicode{0x2192}
- \c Executing \unicode{0x2192} \c AwaitingAcknowledge (this state may be skipped if
- acknowledgePackageInstallation() was called already) \unicode{0x2192} \c Installing
- \unicode{0x2192} \c Cleanup \unicode{0x2192} \c Finished. Again, the task can fail at any point.
-*/
+ \brief (obsolete) The package installation/removal/update part of the application manager.
+
+ \b{This class is obsolete since 5.14. It is provided to keep old source code working. We
+ strongly advise against using it in new code. Use the new PackageManager instead.}
+
+ Please be aware that the new PackageManager API expects package-IDs instead of application-IDs
+ as is the case with this class. Since the new package format adds support for more than one
+ application per package, this legacy API here has its limits in supporting the new features.
+ It is strongly advised to only use the PackageManager API when dealing with new-style packages.
+
+ The background tasks handling the (de)installation process are the same between the old and
+ new API, so the documentation for the \l{Task States}{task states in PackageManager}
+ holds true for this class as well.
-// THIS IS MISSING AN EXAMPLE!
+ If possible, all function calls and signals are forwarded to and from the PackageManager API.
+ Exceptions are documented below in the detailed function and signal descriptions.
+
+ \note The ApplicationInstaller singleton and its corresponding DBus API are only available if
+ you specify a base directory for installed application manifests. See \l{Configuration}
+ for details.
+*/
/*!
\qmlsignal ApplicationInstaller::taskStateChanged(string taskId, string newState)
+ \qmlobsolete
- This signal is emitted when the state of the task identified by \a taskId changes. The
- new state is supplied in the parameter \a newState.
-
- \sa taskState()
+ Use PackageManager::taskStateChanged(\a taskId, \a newState).
*/
/*!
\qmlsignal ApplicationInstaller::taskStarted(string taskId)
+ \qmlobsolete
- This signal is emitted when the task identified by \a taskId enters the \c Executing state.
-
- \sa taskStateChanged()
+ Use PackageManager::taskStarted(\a taskId).
*/
/*!
\qmlsignal ApplicationInstaller::taskFinished(string taskId)
+ \qmlobsolete
- This signal is emitted when the task identified by \a taskId enters the \c Finished state.
-
- \sa taskStateChanged()
+ Use PackageManager::taskFinished(\a taskId).
*/
/*!
\qmlsignal ApplicationInstaller::taskFailed(string taskId)
+ \qmlobsolete
- This signal is emitted when the task identified by \a taskId enters the \c Failed state.
-
- \sa taskStateChanged()
+ Use PackageManager::taskFailed(\a taskId).
*/
/*!
\qmlsignal ApplicationInstaller::taskRequestingInstallationAcknowledge(string taskId, object application, object packageExtraMetaData, object packageExtraSignedMetaData)
+ \qmlobsolete
- This signal is emitted when the installation task identified by \a taskId has received enough
- meta-data to be able to emit this signal. The task may be in either \c Executing or \c
- AwaitingAcknowledge state.
-
- The contents of the package's manifest file are supplied via \a application as a JavaScript object.
- Please see the \l {ApplicationManager Roles}{role names} for the expected object fields.
-
- In addition, the package's extra meta-data (signed and unsinged) is also supplied via \a
- packageExtraMetaData and \a packageExtraSignedMetaData respectively as JavaScript objects.
- Both these objects are optional and need to be explicitly either populated during an
- application's packaging step or added by an intermediary app-store server.
- By default, both will just be empty.
+ Use PackageManager::taskRequestingInstallationAcknowledge(\a taskId, \c package, \a
+ packageExtraMetaData, \a packageExtraSignedMetaData).
- Following this signal, either cancelTask() or acknowledgePackageInstallation() has to be called
- for this \a taskId, to either cancel the installation or try to complete it.
-
- The ApplicationInstaller has two convenience functions to help the System-UI with verifying the
- meta-data: compareVersions() and, in case you are using reverse-DNS notation for application-ids,
- validateDnsName().
-
- \sa taskStateChanged(), startPackageInstallation()
+ A subset of the contents of the package's manifest file is supplied via \a application as a
+ JavaScript object. This object is constructed from the replacement function's Package object
+ parameter. Since the manifest files changed in 5.14, only the following legacy keys are reported
+ through this object: \c id, \c version, \c icon, \c displayIcon, \c name, \c displayName,
+ \c baseDir, \c codeDir, \c manifestDir and \c installationLocationId.
*/
/*!
\qmlsignal ApplicationInstaller::taskBlockingUntilInstallationAcknowledge(string taskId)
+ \qmlobsolete
- This signal is emitted when the installation task identified by \a taskId cannot continue
- due to a missing acknowledgePackageInstallation() call for the task.
-
- \sa taskStateChanged(), acknowledgePackageInstallation()
+ Use PackageManager::taskBlockingUntilInstallationAcknowledge(\a taskId).
*/
/*!
\qmlsignal ApplicationInstaller::taskProgressChanged(string taskId, qreal progress)
+ \qmlobsolete
- This signal is emitted whenever the task identified by \a taskId makes progress towards its
- completion. The \a progress is reported as a floating-point number ranging from \c 0.0 to \c 1.0.
-
- \sa taskStateChanged()
+ Use PackageManager::taskProgressChanged(\a taskId, \a progress).
*/
QT_BEGIN_NAMESPACE_AM
@@ -204,7 +149,32 @@ ApplicationInstaller::ApplicationInstaller(PackageManager *pm, QObject *parent)
QObject::connect(pm, &PackageManager::taskStateChanged,
this, &ApplicationInstaller::taskStateChanged);
QObject::connect(pm, &PackageManager::taskRequestingInstallationAcknowledge,
- this, &ApplicationInstaller::taskRequestingInstallationAcknowledge);
+ this, [this](const QString &taskId, Package *package,
+ const QVariantMap &packageExtraMetaData,
+ const QVariantMap &packageExtraSignedMetaData) {
+ QVariantMap nameMap;
+ auto names = package->names();
+ for (auto it = names.constBegin(); it != names.constEnd(); ++it)
+ nameMap.insert(it.key(), it.value());
+
+ QString baseDir = package->info()->baseDir().absolutePath();
+
+ QVariantMap applicationData {
+ { qSL("id"), package->id() },
+ { qSL("version"), package->version() },
+ { qSL("icon"), package->icon() },
+ { qSL("displayIcon"), package->icon() }, // 1.0 compatibility
+ { qSL("name"), nameMap },
+ { qSL("displayName"), nameMap }, // 1.0 compatibility
+ { qSL("baseDir"), baseDir },
+ { qSL("codeDir"), baseDir }, // 5.12 compatibility
+ { qSL("manifestDir"), baseDir }, // 5.12 compatibility
+ { qSL("installationLocationId"), qSL("internal-0") } // 5.13 compatibility
+ };
+
+ emit taskRequestingInstallationAcknowledge(taskId, applicationData, packageExtraMetaData,
+ packageExtraSignedMetaData);
+ });
QObject::connect(pm, &PackageManager::taskBlockingUntilInstallationAcknowledge,
this, &ApplicationInstaller::taskBlockingUntilInstallationAcknowledge);
}
@@ -240,238 +210,134 @@ QObject *ApplicationInstaller::instanceForQml(QQmlEngine *, QJSEngine *)
}
/*!
- \qmlmethod list<string> ApplicationInstaller::installationLocationIds()
+ \qmlmethod list<string> ApplicationInstaller::installationLocationIds()
+ \qmlobsolete
- Retuns a list of all known installation location ids. Calling getInstallationLocation() on one of
- the returned identifiers will yield specific information about the individual installation locations.
+ This function became obsolete, because the new architecture only supports one single
+ installation location: it now always returns \c internal-0.
*/
/*!
- \qmlmethod string ApplicationInstaller::installationLocationIdFromApplication(string id)
-
- Returns the installation location id for the application identified by \a id. Returns
- an empty string in case the application is not installed.
+ \qmlmethod string ApplicationInstaller::installationLocationIdFromApplication(string id)
+ \qmlobsolete
- \sa installationLocationIds()
+ This function became obsolete, because the new architecture only supports one single
+ installation location: it now always returns \c internal-0 if the application identified by
+ \a id is installed or an empty string otherwise.
*/
/*!
\qmlmethod object ApplicationInstaller::getInstallationLocation(string installationLocationId)
+ \qmlobsolete
- Returns an object describing the installation location identified by \a installationLocationId in detail.
-
- The returned object has the following members:
-
- \table
- \header
- \li \c Name
- \li \c Type
- \li Description
- \row
- \li \c id
- \li \c string
- \li The installation location id that is used as the handle for all other ApplicationInstaller
- function calls. The \c id consists of the \c type and \c index field, concatenated by
- a single dash (for example, \c internal-0).
- \row
- \li \c type
- \li \c string
- \li The type of device this installation location is connected to. Valid values are \c
- internal (for any kind of built-in storage, e.g. flash), \c removable (for any kind of
- storage that is removable by the user, e.g. an SD card) and \c invalid.
- \row
- \li \c index
- \li \c int
- \li In case there is more than one installation location for the same type of device, this
- \c zero-based index is used for disambiguation. For example, two SD card slots will
- result in the ids \c removable-0 and \c removable-1. Otherwise, the index is always \c 0.
- \row
- \li \c isDefault
- \li \c bool
-
- \li Exactly one installation location is the default location which must be mounted and
- accessible at all times. This can be used by an UI application to get a sensible
- default for the installation location that it needs to pass to startPackageInstallation().
- \row
- \li \c isRemovable
- \li \c bool
- \li Indicates whether this installation location is on a removable media (for example, an SD
- card).
- \row
- \li \c isMounted
- \li \c bool
- \li The current mount status of this installation location: should always be \c true for
- non-removable media.
- \row
- \li \c installationPath
- \li \c string
- \li The absolute file-system path to the base directory under which applications are installed.
- \row
- \li \c installationDeviceSize
- \li \c int
- \li The size of the device holding \c installationPath in bytes. This field is only present if
- \c isMounted is \c true.
- \row
- \li \c installationDeviceFree
- \li \c int
- \li The amount of bytes available on the device holding \c installationPath. This field is only
- present if \c isMounted is \c true.
- \row
- \li \c documentPath
- \li \c string
- \li The absolute file-system path to the base directory under which per-user document
- directories are created.
- \row
- \li \c documentDeviceSize
- \li \c int
- \li The size of the device holding \c documentPath in bytes. This field is only present if
- \c isMounted is \c true.
- \row
- \li \c documentDeviceFree
- \li \c int
- \li The amount of bytes available on the device holding \c documentPath. This field is only
- present if \c isMounted is \c true.
- \endtable
+ This function became obsolete, because the new architecture only supports one single
+ installation location (\c internal-0).
Returns an empty object in case the \a installationLocationId is not valid.
*/
/*!
- \qmlmethod int ApplicationInstaller::installedApplicationSize(string id)
+ \qmlmethod int ApplicationInstaller::installedApplicationSize(string id)
+ \qmlobsolete
- Returns the size in bytes that the application identified by \a id is occupying on the storage
- device.
+ Use PackageManager::installedPackageSize(), same return value.
- Returns \c -1 in case the application \a id is not valid, or the application is not installed.
+ \note The replacement function PackageManager::installedPackageSize expects a
+ \b package-ID as parameter, while this function wants an \b application-ID as \a id.
*/
/*!
- \qmlmethod var ApplicationInstaller::installedApplicationExtraMetaData(string id)
+ \qmlmethod var ApplicationInstaller::installedApplicationExtraMetaData(string id)
+ \qmlobsolete
- Returns a map of all extra metadata in the package header of the application identified by \a id.
+ Use PackageManager::installedPackageExtraMetaData(), same return value.
- Returns an empty map in case the application \a id is not valid, or the application is not installed.
+ \note The replacement function PackageManager::installedPackageExtraMetaData expects a
+ \b package-ID as parameter, while this function wants an \b application-ID as \a id.
*/
/*!
- \qmlmethod var ApplicationInstaller::installedApplicationExtraSignedMetaData(string id)
+ \qmlmethod var ApplicationInstaller::installedApplicationExtraSignedMetaData(string id)
+ \qmlobsolete
- Returns a map of all signed extra metadata in the package header of the application identified
- by \a id.
-
- Returns an empty map in case the application \a id is not valid, or the application is not installed.
-*/
+ Use PackageManager::installedPackageExtraSignedMetaData(), same return value.
-/*! \internal
- Type safe convenience function, since DBus does not like QUrl
+ \note The replacement function PackageManager::installedPackageExtraSignedMetaData expects a
+ \b package-ID as parameter, while this function wants an \b application-ID as \a id.
*/
/*!
\qmlmethod string ApplicationInstaller::startPackageInstallation(string installationLocationId, string sourceUrl)
+ \qmlobsolete
- Downloads an application package from \a sourceUrl and installs it to the installation location
- described by \a installationLocationId.
+ Use PackageManager::startPackageInstallation(\a sourceUrl), same return value.
- The actual download and installation will happen asynchronously in the background. The
- ApplicationInstaller emits the signals \l taskStarted, \l taskProgressChanged, \l
- taskRequestingInstallationAcknowledge, \l taskFinished, \l taskFailed, and \l taskStateChanged
- for the returned taskId when applicable.
-
- \note Simply calling this function is not enough to complete a package installation: The
- taskRequestingInstallationAcknowledge() signal needs to be connected to a slot where the
- supplied application meta-data can be validated (either programmatically or by asking the user).
- If the validation is successful, the installation can be completed by calling
- acknowledgePackageInstallation() or, if the validation was unsuccessful, the installation should
- be canceled by calling cancelTask().
- Failing to do one or the other will leave an unfinished "zombie" installation.
-
- Returns a unique \c taskId. This can also be an empty string, if the task could not be
- created (in this case, no signals will be emitted).
+ \note The replacement function PackageManager::startPackageInstallation is missing the first
+ parameter (\a installationLocationId). This became obsolete, because the new architecture
+ only supports one single installation location.
*/
/*!
\qmlmethod void ApplicationInstaller::acknowledgePackageInstallation(string taskId)
+ \qmlobsolete
- Calling this function enables the installer to complete the installation task identified by \a
- taskId. Normally, this function is called after receiving the taskRequestingInstallationAcknowledge()
- signal, and the user and/or the program logic decided to proceed with the installation.
-
- \sa startPackageInstallation()
- */
+ Use PackageManager::acknowledgePackageInstallation(\a taskId).
+*/
/*!
\qmlmethod string ApplicationInstaller::removePackage(string id, bool keepDocuments, bool force)
+ \qmlobsolete
- Uninstalls the application identified by \a id. Normally, the documents directory of the
- application is deleted on removal, but this can be prevented by setting \a keepDocuments to \c true.
-
- The actual removal will happen asynchronously in the background. The ApplicationInstaller will
- emit the signals \l taskStarted, \l taskProgressChanged, \l taskFinished, \l taskFailed and \l
- taskStateChanged for the returned \c taskId when applicable.
+ Use PackageManager::removePackage(\c packageId, \a keepDocuments, \a force), same return value.
- Normally, \a force should only be set to \c true if a previous call to removePackage() failed.
- This may be necessary if the installation process was interrupted, or if an SD card got lost
- or has file-system issues.
-
- Returns a unique \c taskId. This can also be an empty string, if the task could not be created
- (in this case, no signals will be emitted).
+ \note The replacement function PackageManager::removePackage expects a \b package-ID as
+ parameter, while this function wants an \b application-ID as \a id.
*/
/*!
\qmlmethod enumeration ApplicationInstaller::taskState(string taskId)
+ \qmlobsolete
- Returns the current state of the installation task identified by \a taskId.
- \l {TaskStates}{See here} for a list of valid task states.
-
- Returns \c ApplicationInstaller.Invalid if the \a taskId is invalid.
+ Use PackageManager::taskState(\a taskId), same return value.
*/
/*!
\qmlmethod string ApplicationInstaller::taskApplicationId(string taskId)
+ \qmlobsolete
- Returns the application id associated with the task identified by \a taskId. The task may not
- have a valid application id at all times though and in this case the function will return an
- empty string (this will be the case for installations before the taskRequestingInstallationAcknowledge
- signal has been emitted).
+ Use PackageManager::taskPackageId(\a taskId).
- Returns an empty string if the \a taskId is invalid.
+ \note The replacement function PackageManager::taskPackageId returns an \b package-ID,
+ while this function returns an \b application-ID.
*/
/*!
\qmlmethod list<string> ApplicationInstaller::activeTaskIds()
+ \qmlobsolete
- Retuns a list of all currently active (as in not yet finished or failed) installation task ids.
+ Use PackageManager::activeTaskIds(), same return value.
*/
/*!
\qmlmethod bool ApplicationInstaller::cancelTask(string taskId)
+ \qmlobsolete
- Tries to cancel the installation task identified by \a taskId.
-
- Returns \c true if the task was canceled, \c false otherwise.
+ Use PackageManager::cancelTask(\a taskId), same return value.
*/
/*!
\qmlmethod int ApplicationInstaller::compareVersions(string version1, string version2)
+ \qmlobsolete
- Convenience method for app-store implementations or taskRequestingInstallationAcknowledge()
- callbacks for comparing version numbers, as the actual version comparison algorithm is not
- trivial.
-
- Returns \c -1, \c 0 or \c 1 if \a version1 is smaller than, equal to, or greater than \a
- version2 (similar to how \c strcmp() works).
+ Use PackageManager::compareVersions(\a version1, \a version2), same return value.
*/
/*!
\qmlmethod int ApplicationInstaller::validateDnsName(string name, int minimalPartCount)
+ \qmlobsolete
- Convenience method for app-store implementations or taskRequestingInstallationAcknowledge()
- callbacks for checking if the given \a name is a valid DNS (or reverse-DNS) name according to
- RFC 1035/1123. If the optional parameter \a minimalPartCount is specified, this function will
- also check if \a name contains at least this amount of parts/sub-domains.
-
- Returns \c true if the name is a valid DNS name or \c false otherwise.
+ Use PackageManager::validateDnsName(\a name, \a minimalPartCount), same return value.
*/
QT_END_NAMESPACE_AM
diff --git a/src/main-lib/applicationinstaller.h b/src/main-lib/applicationinstaller.h
index f83ddadb..0ac1096a 100644
--- a/src/main-lib/applicationinstaller.h
+++ b/src/main-lib/applicationinstaller.h
@@ -136,9 +136,11 @@ public:
Q_SCRIPTABLE void acknowledgePackageInstallation(const QString &taskId)
{ return m_pm->acknowledgePackageInstallation(taskId); }
- Q_SCRIPTABLE QString removePackage(const QString &packageId, bool keepDocuments, bool force = false)
- { return m_pm->removePackage(packageId, keepDocuments, force); }
-
+ Q_SCRIPTABLE QString removePackage(const QString &applicationId, bool keepDocuments, bool force = false)
+ {
+ auto app = ApplicationManager::instance()->fromId(applicationId);
+ return m_pm->removePackage(app ? app->packageInfo()->id() : QString(), keepDocuments, force);
+ }
Q_SCRIPTABLE AsynchronousTask::TaskState taskState(const QString &taskId) const
{ return m_pm->taskState(taskId); }
Q_SCRIPTABLE QString taskApplicationId(const QString &taskId) const
diff --git a/src/manager-lib/application.cpp b/src/manager-lib/application.cpp
index f1a83d10..0d512815 100644
--- a/src/manager-lib/application.cpp
+++ b/src/manager-lib/application.cpp
@@ -55,12 +55,20 @@
\qmltype ApplicationObject
\inqmlmodule QtApplicationManager.SystemUI
\ingroup system-ui-non-instantiable
- \brief The handle for an application known to the ApplicationManager.
+ \brief The handle for an application known to the application manager.
- Most of the read-only properties map directly to values read from the application's
+ Each instance of this class represents a single application known to the application manager.
+
+ Most of the read-only properties map directly to values read from the application package's
\c info.yaml file - these are documented in the \l{Manifest Definition}.
-*/
+ Items of this type are not creatable from QML code. Only functions and properties of
+ ApplicationManager and ApplicationModel will return pointers to this class.
+
+ Make sure to \b not save references to an ApplicationObject across function calls: packages (and
+ with that, the applications contained within) can be deinstalled at any time, invalidating your
+ reference. In case you do need a persistent handle, use the id string.
+*/
/*!
\qmlproperty string ApplicationObject::id
\readonly
@@ -81,15 +89,15 @@
runtime.
*/
/*!
- \qmlproperty url ApplicationObject::icon
+ \qmlproperty list<string> ApplicationObject::capabilities
\readonly
- The URL of the application's icon - can be used as the source property of an \l Image.
+ A list of special access rights for the application - these capabilities can later be queried
+ and verified by the middleware via the application-manager.
*/
/*!
\qmlproperty string ApplicationObject::documentUrl
\readonly
- \obsolete
This was used to distinguish between application aliases, which have been replaced by the
intents mechanism.
@@ -97,54 +105,12 @@
Always returns an empty string.
*/
/*!
- \qmlproperty bool ApplicationObject::builtIn
- \readonly
-
- This property describes, if this application is part of the built-in set of applications of the
- current System-UI.
-*/
-/*!
- \qmlproperty bool ApplicationObject::alias
- \readonly
- \obsolete
-
- This was used to distinguish between application aliases, which have been replaced by the
- intents mechanism.
-
- Always returns \c false.
-*/
-/*!
- \qmlproperty ApplicationObject ApplicationObject::nonAliased
- \readonly
- \obsolete
-
- This was used to distinguish between application aliases, which have been replaced by the
- intents mechanism.
-
- Always returns the object itself.
-*/
-/*!
- \qmlproperty list<string> ApplicationObject::capabilities
- \readonly
-
- A list of special access rights for the application - these capabilities can later be queried
- and verified by the middleware via the application-manager.
-*/
-/*!
\qmlproperty list<string> ApplicationObject::supportedMimeTypes
\readonly
An array of MIME types the application can handle.
*/
/*!
- \qmlproperty list<string> ApplicationObject::categories
- \readonly
-
- A list of category names the application should be associated with. This is mainly for the
- automated app-store uploads as well as displaying the application within a fixed set of
- categories in the System-UI.
-*/
-/*!
\qmlproperty object ApplicationObject::applicationProperties
\readonly
@@ -183,35 +149,12 @@
\sa ApplicationInterface::quit, ApplicationInterface::acknowledgeQuit
*/
/*!
- \qmlproperty string ApplicationObject::version
- \readonly
-
- Holds the version of the application as a string.
-*/
-/*!
\qmlproperty string ApplicationObject::codeDir
\readonly
The absolute path to the application's installation directory.
*/
/*!
- \qmlproperty enumeration ApplicationObject::state
- \readonly
-
- This property holds the current installation state of the application. It can be one of:
-
- \list
- \li ApplicationObject.Installed - The application is completely installed and ready to be used.
- \li ApplicationObject.BeingInstalled - The application is currently in the process of being installed.
- \li ApplicationObject.BeingUpdated - The application is currently in the process of being updated.
- \li ApplicationObject.BeingDowngraded - The application is currently in the process of being downgraded.
- That can only happen for a built-in application that was previously
- upgraded. It will then be brought back to its original, built-in,
- version and its state will go back to ApplicationObject.Installed.
- \li ApplicationObject.BeingRemoved - The application is currently in the process of being removed.
- \endlist
-*/
-/*!
\qmlproperty enumeration ApplicationObject::runState
\readonly
@@ -232,12 +175,6 @@
been requested to be brought to foreground or raised.
*/
/*!
- \qmlmethod string ApplicationObject::name(string language)
-
- Returns the name of the application in the given \a language, as provided in the the info.yaml
- file.
-*/
-/*!
\qmlmethod bool ApplicationObject::start(string document)
Starts the application. The optional argument \a document will be supplied to the application as
@@ -269,6 +206,77 @@
\sa ApplicationManager::stopApplication
*/
+/*!
+ \qmlproperty url ApplicationObject::icon
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::icon
+*/
+/*!
+ \qmlproperty bool ApplicationObject::builtIn
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::builtIn
+*/
+/*!
+ \qmlproperty bool ApplicationObject::alias
+ \readonly
+ \qmlobsolete
+
+ This was used to distinguish between application aliases, which have been replaced by the
+ intents mechanism.
+
+ Always returns \c false.
+*/
+/*!
+ \qmlproperty ApplicationObject ApplicationObject::nonAliased
+ \readonly
+ \qmlobsolete
+
+ This was used to distinguish between application aliases, which have been replaced by the
+ intents mechanism.
+
+ Always returns the ApplicationObject itself.
+*/
+/*!
+ \qmlproperty list<string> ApplicationObject::categories
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::categories.
+*/
+/*!
+ \qmlproperty string ApplicationObject::version
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::version.
+*/
+/*!
+ \qmlproperty enumeration ApplicationObject::state
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::state.
+*/
+/*!
+ \qmlproperty bool ApplicationObject::blocked
+ \readonly
+ \qmlobsolete
+
+ Use PackageObject::version.
+*/
+/*!
+ \qmlmethod string ApplicationObject::name(string language)
+ \qmlobsolete
+
+ Use the PackageObject::names property.
+
+ Returns the name of the application in the given \a language.
+*/
+
QT_BEGIN_NAMESPACE_AM
diff --git a/src/manager-lib/application.h b/src/manager-lib/application.h
index 46616b1e..6edb33cf 100644
--- a/src/manager-lib/application.h
+++ b/src/manager-lib/application.h
@@ -76,27 +76,29 @@ class Application : public QObject
Q_PROPERTY(QString id READ id CONSTANT)
Q_PROPERTY(QString runtimeName READ runtimeName CONSTANT)
Q_PROPERTY(QVariantMap runtimeParameters READ runtimeParameters CONSTANT)
- Q_PROPERTY(QUrl icon READ icon NOTIFY bulkChange)
- Q_PROPERTY(QString documentUrl READ documentUrl CONSTANT) // REMOVE
- Q_PROPERTY(bool builtIn READ isBuiltIn CONSTANT)
- Q_PROPERTY(bool alias READ isAlias CONSTANT) // REMOVE
- Q_PROPERTY(Application *nonAliased READ nonAliased CONSTANT) // REMOVE
Q_PROPERTY(QStringList capabilities READ capabilities CONSTANT)
- Q_PROPERTY(QStringList supportedMimeTypes READ supportedMimeTypes CONSTANT) // REMOVE
- Q_PROPERTY(QStringList categories READ categories CONSTANT)
+ Q_PROPERTY(QString documentUrl READ documentUrl CONSTANT)
+ Q_PROPERTY(QStringList supportedMimeTypes READ supportedMimeTypes CONSTANT)
Q_PROPERTY(QVariantMap applicationProperties READ applicationProperties CONSTANT)
Q_PROPERTY(AbstractRuntime *runtime READ currentRuntime NOTIFY runtimeChanged)
Q_PROPERTY(int lastExitCode READ lastExitCode NOTIFY lastExitCodeChanged)
Q_PROPERTY(QT_PREPEND_NAMESPACE_AM(Am::ExitStatus) lastExitStatus READ lastExitStatus NOTIFY lastExitStatusChanged)
- Q_PROPERTY(QString version READ version CONSTANT)
- Q_PROPERTY(bool supportsApplicationInterface READ supportsApplicationInterface CONSTANT)
Q_PROPERTY(QString codeDir READ codeDir NOTIFY bulkChange)
Q_PROPERTY(QT_PREPEND_NAMESPACE_AM(Am::RunState) runState READ runState NOTIFY runStateChanged)
// legacy, forwarded to Package
+ Q_PROPERTY(QUrl icon READ icon NOTIFY bulkChange)
+ Q_PROPERTY(bool builtIn READ isBuiltIn CONSTANT)
+ Q_PROPERTY(bool alias READ isAlias CONSTANT)
+ Q_PROPERTY(Application *nonAliased READ nonAliased CONSTANT)
+ Q_PROPERTY(QStringList categories READ categories CONSTANT)
+ Q_PROPERTY(QString version READ version CONSTANT)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_PROPERTY(bool blocked READ isBlocked NOTIFY blockedChanged)
+ // internal
+ Q_PROPERTY(bool supportsApplicationInterface READ supportsApplicationInterface CONSTANT)
+
public:
enum State { // kept for compatibility ... in reality moved to class Package
Installed,
diff --git a/src/manager-lib/applicationipcinterface.cpp b/src/manager-lib/applicationipcinterface.cpp
index aa08991d..a7083461 100644
--- a/src/manager-lib/applicationipcinterface.cpp
+++ b/src/manager-lib/applicationipcinterface.cpp
@@ -66,7 +66,7 @@
\qmltype ApplicationIPCInterface
\ingroup system-ui
\inqmlmodule QtApplicationManager.SystemUI
- \brief The definition of an IPC interface between the ApplicationManager and applications.
+ \brief The definition of an IPC interface between the application manager and applications.
Using ApplicationIPCInterface items, you can define an IPC interface between the System UI and
your applications. The actual interface consists of all the properties, signals, and functions
diff --git a/src/manager-lib/installationtask.cpp b/src/manager-lib/installationtask.cpp
index ef907eb5..2784e922 100644
--- a/src/manager-lib/installationtask.cpp
+++ b/src/manager-lib/installationtask.cpp
@@ -46,6 +46,7 @@
#include "logging.h"
#include "packagemanager_p.h"
+#include "package.h"
#include "packageinfo.h"
#include "packageextractor.h"
#include "exception.h"
@@ -321,24 +322,9 @@ void InstallationTask::checkExtractedFile(const QString &file) Q_DECL_NOEXCEPT_E
if (m_foundIcon && m_foundInfo) {
qCDebug(LogInstaller) << "emit taskRequestingInstallationAcknowledge" << id() << "for package" << m_package->id();
- QVariantMap nameMap;
- auto names = m_package->names();
- for (auto it = names.constBegin(); it != names.constEnd(); ++it)
- nameMap.insert(it.key(), it.value());
-
- QVariantMap applicationData {
- { qSL("id"), m_package->id() },
- { qSL("version"), m_package->version() },
- { qSL("icon"), m_package->icon() },
- { qSL("displayIcon"), m_package->icon() }, // legacy
- { qSL("name"), nameMap },
- { qSL("displayName"), nameMap }, // legacy
- { qSL("baseDir"), m_package->baseDir().absolutePath() },
- { qSL("codeDir"), m_package->baseDir().absolutePath() }, // 5.12 backward compatibility
- { qSL("manifestDir"), m_package->baseDir().absolutePath() }, // 5.12 backward compatibility
- { qSL("installationLocationId"), qSL("internal-0") } // 5.13 backward compatibility
- };
- emit m_pm->taskRequestingInstallationAcknowledge(id(), applicationData,
+ auto package = new Package(m_package.data(), Package::BeingInstalled);
+
+ emit m_pm->taskRequestingInstallationAcknowledge(id(), package,
m_extractor->installationReport().extraMetaData(),
m_extractor->installationReport().extraSignedMetaData());
diff --git a/src/manager-lib/package.cpp b/src/manager-lib/package.cpp
index e180fc7b..4835e378 100644
--- a/src/manager-lib/package.cpp
+++ b/src/manager-lib/package.cpp
@@ -47,6 +47,124 @@
#include "packageinfo.h"
#include "applicationinfo.h"
+/*!
+ \qmltype PackageObject
+ \inqmlmodule QtApplicationManager.SystemUI
+ \ingroup system-ui-non-instantiable
+ \brief The handle for a package known to the application manager.
+
+ Each instance of this class represents a single package known to the application manager.
+
+ Most of the read-only properties map directly to values read from the package's
+ \c info.yaml file - these are documented in the \l{Manifest Definition}.
+
+ Items of this type are not creatable from QML code. Only functions and properties of
+ PackageManager will return pointers to this class.
+
+ Make sure to \b not save references to a PackageObject across function calls: packages can
+ be deinstalled at any time, invalidating your reference. In case you do need a persistent
+ handle, use the id string.
+*/
+
+/*!
+ \qmlproperty string PackageObject::id
+ \readonly
+
+ This property returns the unique id of the package.
+*/
+/*!
+ \qmlproperty bool PackageObject::builtIn
+ \readonly
+
+ This property describes, if this package is part of the built-in set of packages of the
+ current System-UI.
+*/
+/*!
+ \qmlproperty bool PackageObject::builtInHasRemovableUpdate
+ \readonly
+
+ This property describes, if this package is part of the built-in set of packages of the
+ current System-UI \b and if there is currently an update installed that shadows the original
+ built-in package contents.
+
+ \sa builtIn
+*/
+/*!
+ \qmlproperty url PackageObject::icon
+ \readonly
+
+ The URL of the package's icon - can be used as the source property of an \l Image.
+*/
+/*!
+ \qmlproperty string PackageObject::version
+ \readonly
+
+ Holds the version of the package as a string.
+*/
+/*!
+ \qmlproperty string PackageObject::name
+ \readonly
+
+ Returns the localized name of the package - as provided in the info.yaml file - in the currently
+ active locale.
+
+*/
+/*!
+ \qmlproperty var PackageObject::names
+ \readonly
+
+ Returns an object with all the language code to localized name mappings as provided in the
+ package's info.yaml file.
+*/
+/*!
+ \qmlproperty string PackageObject::description
+ \readonly
+
+ Returns the localized description of the package - as provided in the info.yaml file - in the
+ currently active locale.
+
+*/
+/*!
+ \qmlproperty var PackageObject::descriptions
+ \readonly
+
+ Returns an object with all the language code to localized description mappings as provided in
+ the package's info.yaml file.
+*/
+/*!
+ \qmlproperty list<string> PackageObject::categories
+ \readonly
+
+ A list of category names the package should be associated with. This is mainly for the
+ automated app-store uploads as well as displaying the package within a fixed set of
+ categories in the System-UI.
+*/
+/*!
+ \qmlproperty enumeration PackageObject::state
+ \readonly
+
+ This property holds the current installation state of the package. It can be one of:
+
+ \list
+ \li PackageObject.Installed - The package is completely installed and ready to be used.
+ \li PackageObject.BeingInstalled - The package is currently in the process of being installed.
+ \li PackageObject.BeingUpdated - The package is currently in the process of being updated.
+ \li PackageObject.BeingDowngraded - The package is currently in the process of being downgraded.
+ That can only happen for a built-in package that was previously
+ upgraded. It will then be brought back to its original, built-in,
+ version and its state will go back to PackageObject.Installed.
+ \li PackageObject.BeingRemoved - The package is currently in the process of being removed.
+ \endlist
+*/
+/*!
+ \qmlproperty bool PackageObject::blocked
+ \readonly
+
+ Describes if this package is currently blocked: being blocked means that all applications in
+ the package are stopped and are prevented from being started while in this state.
+ This is normally only the case while an update is being applied.
+*/
+
QT_BEGIN_NAMESPACE_AM
Package::Package(PackageInfo *packageInfo, State initialState)
diff --git a/src/manager-lib/packagemanager.cpp b/src/manager-lib/packagemanager.cpp
index 6ccfd199..8130f66f 100644
--- a/src/manager-lib/packagemanager.cpp
+++ b/src/manager-lib/packagemanager.cpp
@@ -70,6 +70,208 @@
#endif
+/*!
+ \qmltype PackageManager
+ \inqmlmodule QtApplicationManager.SystemUI
+ \ingroup system-ui-singletons
+ \brief The package installation/removal/update part of the application manager.
+
+ The PackageManager singleton type handles the package installation
+ part of the application manager. It provides both a DBus and QML APIs for
+ all of its functionality.
+
+ \note Unlike the deprecated ApplicationInstaller class, the PackageManager singleton and its
+ corresponding DBus API are always available. Disabling the installer functionality via the
+ application-manager's \l{Configuration} will just lead to package (de-) installations
+ failing instantly.
+
+ The type is derived from \c QAbstractListModel, so it can be used directly as a model from QML.
+
+ \target PackageManager Roles
+
+ The following roles are available in this model:
+
+ \table
+ \header
+ \li Role name
+ \li Type
+ \li Description
+ \row
+ \li \c packageId
+ \li string
+ \li The unique ID of a package, represented as a string (e.g. \c Browser or
+ \c com.pelagicore.music)
+ \row
+ \li \c name
+ \li string
+ \li The name of the package. If possible, already translated to the current locale.
+ \row
+ \li \c icon
+ \li string
+ \li The URL of the package's icon.
+ \row
+ \li \c isBlocked
+ \li bool
+ \li A boolean value that gets set when the application-manager needs to block any
+ application within this package from running: this is normally only the case while an
+ update is being applied.
+ \row
+ \li \c isUpdating
+ \li bool
+ \li A boolean value indicating whether the package is currently being installed or updated.
+ If \c true, the \c updateProgress can be used to track the actual progress.
+ \row
+ \li \c isRemovable
+ \li bool
+ \li A boolean value indicating whether this package is user-removable; \c true for all
+ dynamically installed third party packages and \c false for all system packages.
+ \row
+ \li \c updateProgress
+ \li real
+ \li While \c isUpdating is \c true, querying this role returns the actual progress as a
+ floating-point value in the \c 0.0 to \c 1.0 range.
+ \row
+ \li \c categories
+ \li list<string>
+ \li The categories this package is registered for via its meta-data file.
+ \row
+ \li \c version
+ \li string
+ \li The currently installed version of this package.
+ \row
+ \li \c package
+ \li Package
+ \li The underlying package object for quick access to the properties outside of a
+ model delegate.
+ \endtable
+
+ \target TaskStates
+
+ The following table describes all possible states that a background task could be in:
+
+ \table
+ \header
+ \li Task State
+ \li Description
+ \row
+ \li \c Queued
+ \li The task was created and is now queued up for execution.
+ \row
+ \li \c Executing
+ \li The task is being executed.
+ \row
+ \li \c Finished
+ \li The task was executed successfully.
+ \row
+ \li \c Failed
+ \li The task failed to execute successfully.
+ \row
+ \li \c AwaitingAcknowledge
+ \li \e{Installation tasks only!} The task is currently halted, waiting for either
+ acknowledgePackageInstallation() or cancelTask() to continue. See startPackageInstallation()
+ for more information on the installation workflow.
+ \row
+ \li \c Installing
+ \li \e{Installation tasks only!} The installation was acknowledged via acknowledgePackageInstallation()
+ and the final installation phase is now running.
+ \row
+ \li \c CleaningUp
+ \li \e{Installation tasks only!} The installation has finished, and previous installations as
+ well as temporary files are being cleaned up.
+ \endtable
+
+ The normal workflow for tasks is: \c Queued \unicode{0x2192} \c Executing \unicode{0x2192} \c
+ Finished. The task can enter the \c Failed state at any point though - either by being canceled via
+ cancelTask() or simply by failing due to an error.
+
+ Installation tasks are a bit more complex due to the acknowledgment: \c Queued \unicode{0x2192}
+ \c Executing \unicode{0x2192} \c AwaitingAcknowledge (this state may be skipped if
+ acknowledgePackageInstallation() was called already) \unicode{0x2192} \c Installing
+ \unicode{0x2192} \c Cleanup \unicode{0x2192} \c Finished. Again, the task can fail at any point.
+*/
+
+//TODO: THIS IS MISSING AN EXAMPLE!
+
+/*!
+ \qmlsignal PackageManager::taskStateChanged(string taskId, string newState)
+
+ This signal is emitted when the state of the task identified by \a taskId changes. The
+ new state is supplied in the parameter \a newState.
+
+ \sa taskState()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskStarted(string taskId)
+
+ This signal is emitted when the task identified by \a taskId enters the \c Executing state.
+
+ \sa taskStateChanged()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskFinished(string taskId)
+
+ This signal is emitted when the task identified by \a taskId enters the \c Finished state.
+
+ \sa taskStateChanged()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskFailed(string taskId)
+
+ This signal is emitted when the task identified by \a taskId enters the \c Failed state.
+
+ \sa taskStateChanged()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskRequestingInstallationAcknowledge(string taskId, PackageObject package, object packageExtraMetaData, object packageExtraSignedMetaData)
+
+ This signal is emitted when the installation task identified by \a taskId has received enough
+ meta-data to be able to emit this signal. The task may be in either \c Executing or \c
+ AwaitingAcknowledge state.
+
+ A temporary PackageObject is supplied via \a package. Please note, that this object is just
+ constructed on the fly for this signal emission and is not part of the PackageManager model.
+ The package object is destroyed again after the signal callback returns. Another permanent
+ PackageObject that is also part of the model will be constructed later in the installation
+ process.
+
+ In addition, the package's extra meta-data (signed and unsinged) is also supplied via \a
+ packageExtraMetaData and \a packageExtraSignedMetaData respectively as JavaScript objects.
+ Both these objects are optional and need to be explicitly either populated during an
+ application's packaging step or added by an intermediary app-store server.
+ By default, both will just be empty.
+
+ Following this signal, either cancelTask() or acknowledgePackageInstallation() has to be called
+ for this \a taskId, to either cancel the installation or try to complete it.
+
+ The PackageManager has two convenience functions to help the System-UI with verifying the
+ meta-data: compareVersions() and, in case you are using reverse-DNS notation for application-ids,
+ validateDnsName().
+
+ \sa taskStateChanged(), startPackageInstallation()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskBlockingUntilInstallationAcknowledge(string taskId)
+
+ This signal is emitted when the installation task identified by \a taskId cannot continue
+ due to a missing acknowledgePackageInstallation() call for the task.
+
+ \sa taskStateChanged(), acknowledgePackageInstallation()
+*/
+
+/*!
+ \qmlsignal PackageManager::taskProgressChanged(string taskId, qreal progress)
+
+ This signal is emitted whenever the task identified by \a taskId makes progress towards its
+ completion. The \a progress is reported as a floating-point number ranging from \c 0.0 to \c 1.0.
+
+ \sa taskStateChanged()
+*/
+
QT_BEGIN_NAMESPACE_AM
enum Roles
@@ -375,7 +577,7 @@ int PackageManager::count() const
Returns an empty object if the specified \a index is invalid.
\note This is very inefficient if you only want to access a single property from QML; use
- package() instead to access the Package object's properties directly.
+ package() instead to access the PackageObject's properties directly.
*/
QVariantMap PackageManager::get(int index) const
{
@@ -394,10 +596,10 @@ QVariantMap PackageManager::get(int index) const
/*!
\qmlmethod PackageObject PackageManager::package(int index)
- Returns the \l{PackageObject}{package} corresponding to the given \a index in the
- model, or \c null if the index is invalid.
+ Returns the PackageObject corresponding to the given \a index in the model, or \c null if the
+ index is invalid.
- \note The object ownership of the returned Package object stays with the application-manager.
+ \note The object ownership of the returned PackageObject stays with the application-manager.
If you want to store this pointer, you can use the PackageManager's QAbstractListModel
signals or the packageAboutToBeRemoved signal to get notified if the object is about
to be deleted on the C++ side.
@@ -414,10 +616,10 @@ Package *PackageManager::package(int index) const
/*!
\qmlmethod PackageObject PackageManager::package(string id)
- Returns the \l{PackageObject}{package} corresponding to the given package \a id,
- or \c null if the id does not exist.
+ Returns the PackageObject corresponding to the given package \a id, or \c null if the id does
+ not exist.
- \note The object ownership of the returned Package object stays with the application-manager.
+ \note The object ownership of the returned PackageObject stays with the application-manager.
If you want to store this pointer, you can use the PackageManager's QAbstractListModel
signals or the packageAboutToBeRemoved signal to get notified if the object is about
to be deleted on the C++ side.
@@ -562,7 +764,7 @@ static QVariantMap locationMap(const QString &path)
/*!
\qmlproperty object PackageManager::installationLocation
- Returns an object describing the location under which applications are installed in detail.
+ Returns an object describing the location under which packages are installed in detail.
The returned object has the following members:
@@ -713,16 +915,16 @@ QStringList PackageManager::packageIds() const
}
/*!
- \qmlmethod object PackageManager::get(string id)
+ \qmlmethod object PackageManager::get(string packageId)
- Retrieves the model data for the package identified by \a id as a JavaScript object.
+ Retrieves the model data for the package identified by \a packageId as a JavaScript object.
See the \l {PackageManager Roles}{role names} for the expected object fields.
- Returns an empty object if the specified \a id is invalid.
+ Returns an empty object if the specified \a packageId is invalid.
*/
-QVariantMap PackageManager::get(const QString &id) const
+QVariantMap PackageManager::get(const QString &packageId) const
{
- int index = indexOfPackage(id);
+ int index = indexOfPackage(packageId);
return (index < 0) ? QVariantMap{} : get(index);
}
@@ -781,7 +983,7 @@ QVariantMap PackageManager::installedPackageExtraSignedMetaData(const QString &p
*/
QString PackageManager::startPackageInstallation(const QUrl &sourceUrl)
{
- AM_TRACE(LogInstaller, sourceUrl);
+ AM_TRACE(LogInstaller, sourceUrl)
return enqueueTask(new InstallationTask(d->installationPath, d->documentPath, sourceUrl));
}
@@ -841,7 +1043,7 @@ void PackageManager::acknowledgePackageInstallation(const QString &taskId)
/*!
\qmlmethod string PackageManager::removePackage(string packageId, bool keepDocuments, bool force)
- Uninstalls the package identified by \a id. Normally, the documents directory of the
+ Uninstalls the package identified by \a packageId. Normally, the documents directory of the
package is deleted on removal, but this can be prevented by setting \a keepDocuments to \c true.
The actual removal will happen asynchronously in the background. The PackageManager will
diff --git a/src/manager-lib/packagemanager.h b/src/manager-lib/packagemanager.h
index 082fc5e3..59426f2d 100644
--- a/src/manager-lib/packagemanager.h
+++ b/src/manager-lib/packagemanager.h
@@ -149,7 +149,7 @@ public:
// Q_SCRIPTABLEs are available via both QML and D-Bus
Q_SCRIPTABLE QStringList packageIds() const;
- Q_SCRIPTABLE QVariantMap get(const QString &id) const;
+ Q_SCRIPTABLE QVariantMap get(const QString &packageId) const;
Q_SCRIPTABLE qint64 installedPackageSize(const QString &packageId) const;
Q_SCRIPTABLE QVariantMap installedPackageExtraMetaData(const QString &packageId) const;
@@ -187,8 +187,7 @@ signals:
QT_PREPEND_NAMESPACE_AM(AsynchronousTask::TaskState) newState);
// installation only
- Q_SCRIPTABLE void taskRequestingInstallationAcknowledge(const QString &taskId,
- const QVariantMap &packageAsVariantMap,
+ Q_SCRIPTABLE void taskRequestingInstallationAcknowledge(const QString &taskId, Package *package,
const QVariantMap &packageExtraMetaData,
const QVariantMap &packageExtraSignedMetaData);
Q_SCRIPTABLE void taskBlockingUntilInstallationAcknowledge(const QString &taskId);
diff --git a/src/manager-lib/processstatus.cpp b/src/manager-lib/processstatus.cpp
index 4d1e8116..c49f3d6e 100644
--- a/src/manager-lib/processstatus.cpp
+++ b/src/manager-lib/processstatus.cpp
@@ -127,11 +127,12 @@
*/
/*!
- \qmlsignal ProcessStatus::memoryReportingChanged(memoryVirtual, memoryRss, memoryPss)
+ \qmlsignal ProcessStatus::memoryReportingChanged(var memoryVirtual, var memoryRss, var memoryPss)
This signal is emitted after \l{ProcessStatus::update()}{update()} has been called and the
- memory usage values have been refreshed. The arguments are key-value pairs with the keys listed
- in the table \l{supported-keys}{above}.
+ memory usage values have been refreshed. Each of the arguments \a memoryVirtual, \a memoryRss
+ and \a memoryPss is an JavaScript object with the available properties listed in the table
+ \l{supported-keys}{above}.
*/
diff --git a/tests/main/tst_main.cpp b/tests/main/tst_main.cpp
index d87f1b88..effad02e 100644
--- a/tests/main/tst_main.cpp
+++ b/tests/main/tst_main.cpp
@@ -35,6 +35,7 @@
#include <QStringList>
#include "packagemanager.h"
+#include "package.h"
#include "applicationmanager.h"
#include "logging.h"
#include "main.h"
@@ -179,7 +180,7 @@ void tst_Main::installPackage(const QString &pkgPath)
bool installationFinished = false;
connect(packageManager, &PackageManager::taskRequestingInstallationAcknowledge,
- this, [packageManager](const QString &taskId, const QVariantMap &,
+ this, [packageManager](const QString &taskId, Package *,
const QVariantMap &, const QVariantMap &) {
packageManager->acknowledgePackageInstallation(taskId);
});