IntentServer QML Type

The System UI side singleton representing the Intents sub-system. More...

Import Statement: import QtApplicationManager.SystemUI 2.0

Signals

Methods

Detailed Description

This singleton serves two purposes: for one, it gives the System UI access to the database of all the available intents via its item model API, plus it exposes the API to deal with ambigous intent requests. Intent requests can be ambigous if the requesting party only specified the intentId, but not the targeted applicationId in its call to IntentClient::sendIntentRequest(). In these cases, it is the responsibility of the System UI to disambiguate these requests by reacting on the disambiguationRequest() signal.

The type is derived from QAbstractListModel, so it can be used directly as a model in app-grid views.

The following roles are available in this model:

Role nameTypeDescription
intentIdstringThe id of the intent.
packageIdstringThe unique id of the package that the handling application of this intent is part of.
applicationIdstringThe id of the application responsible for handling this intent.
namestringThe name of the intent. If possible, already translated to the current locale. If no name was defined for the intent, the name of the corresponding package will be returned.
iconstringThe URL of the intent's icon. If no icon was defined for the intent, the icon of the corresponding package will be returned.
categorieslist<string>The categories this intent is registered for via its meta-data file.
intentIntentThe underlying Intent object for quick access to the properties outside of a model delegate.

Signal Documentation

disambiguationRequest(uuid requestId, list<Intent> potentialIntents, var parameters)

This signal is emitted when the IntentServer receives an intent request that could potentially be handled by more than one application.

Note: This signal is only emitted, if there is a receiver connected at all. If the signal is not connected, an arbitrary application from the list of potential matches will be chosen to handle this request.

The receiver of this signal gets the requested requestId and its parameters. It can then either call acknowledgeDisambiguationRequest() to choose from one of the supplied potentialIntents or call rejectDisambiguationRequest() to reject the intent request completely. In both cases the unique requestId needs to be sent along to identify the intent request.

Not calling one of these two functions will result in memory leaks.

Note: The corresponding handler is onDisambiguationRequest.

See also IntentClient::sendIntentRequest.


intentAboutToBeRemoved(Intent intent)

Emitted when an existing intent is going to be removed from the intentList (e.g. on application deinstallation).

Note: The corresponding handler is onIntentAboutToBeRemoved.


intentAdded(Intent intent)

Emitted when a new intent gets added to the intentList (e.g. on application installation).

Note: The corresponding handler is onIntentAdded.


Method Documentation

acknowledgeDisambiguationRequest(uuid requestId, Intent selectedIntent)

Tells the IntentServer to go ahead with the sender's intent request identified by requestId. The chosen selectedIntent needs to be one of the potentialIntents supplied to the receiver of the disambiguationRequest signal.

See also IntentClient::sendIntentRequest.


IntentObject applicationIntent(string intentId, string applicationId, var parameters)

Returns the intent corresponding to the given intentId, applicationId and parameters or null if the id does not exist.

This method exposes the same functionality that is used internally to match incoming Intent requests for the intent identified by intentId and targeted for the application identified by applicationId. Although you could iterate over the intentList yourself in JavaScript, this function has the added benefit of also checking the optionally provided parameters against any given parameter matches.

Note: The object ownership of the returned Intent object stays with the application manager. If you want to store this pointer, you can use the IntentServer's QAbstractListModel signals or the intentAboutToBeRemoved signal to get notified if the object is about to be deleted on the C++ side.


object get(int index)

Retrieves the model data at index as a JavaScript object. See the role names for the expected object fields.

Returns an empty object if the specified index is invalid.

Note: This is very inefficient if you only want to access a single property from QML; use intent() instead to access the Intent object's properties directly.


int indexOfIntent(IntentObject intent)

Maps the intent to its position within this model. Returns -1 if the specified intent is invalid.

See also intent().


int indexOfIntent(string intentId, string applicationId, var parameters)

Maps the intent corresponding to the given intentId, applicationId and parameters to its position within this model. Returns -1 if the specified intent is invalid.

See also intent().


IntentObject intent(int index)

Returns the intent corresponding to the given index in the model, or null if the index is invalid.

Note: The object ownership of the returned Intent object stays with the application manager. If you want to store this pointer, you can use the IntentServer's QAbstractListModel signals or the intentAboutToBeRemoved signal to get notified if the object is about to be deleted on the C++ side.


IntentObject packageIntent(string intentId, string packageId, string applicationId, var parameters)

Returns the intent corresponding to the given intentId, packageId, applicationId and parameters or null if the id does not exist.

See also applicationIntent.


IntentObject packageIntent(string intentId, string packageId, var parameters)

Returns the intent corresponding to the given intentId, packageId and parameters or null if the id does not exist.

See also applicationIntent.


rejectDisambiguationRequest(uuid requestId)

Tells the IntentServer to ignore the sender's intent request identified by requestId. The original sender will get an error reply back in this case.

See also IntentClient::sendIntentRequest.


© 2019 Luxoft Sweden AB. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.