IntentClient QML Type

Singleton that provides functions to create Intent requests. More...

Import Statement: import QtApplicationManager 2.0

Methods

Detailed Description

This type can be used both in applications as well as within the System UI to create intent requests. This type is only the factory, returning instances of the type IntentRequest. See the IntentRequest documentation for details on how to actually handle these asynchronous calls.

Here is a fairly standard way to send an intent request and react on its result (or error message):

MouseArea {
    onClicked: {
        var request = IntentClient.sendIntentRequest("show-image", { url: "file://x.png" })
        request.onReplyReceived.connect(function() {
            if (request.succeeded)
                var result = request.result
            else
                console.log("Intent request failed: " + request.errorMessage)
        })
    }
}

Method Documentation

IntentRequest sendIntentRequest(string intentId, string applicationId, var parameters)

This is an overloaded function.

Instead of letting the System UI (or the user) choose which application should handle your request, you can use this overload to hardcode the applicationId that is required to handle it. The request will fail, if this specified application doesn't exist or can't handle this specific request, even though other applications would be able to do it.

See also sendIntentRequest.


IntentRequest sendIntentRequest(string intentId, var parameters)

Sends a request for an intent with the given intentId to the system. The additional parameters are specific to the requested intentId, but the format is always the same: a standard JavaScript object, which can also be just empty if the requested intent doesn't require any parameters.

Returns an IntentRequest object that can be used to track this asynchronous request.

Note: The returned object has JavaScript ownership, which means that you do not have to worry about freeing resources. Even just ignoring the return value is fine, if you are not interested in the result (or error condition) of your request.


© 2021 The Qt Company Ltd. 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.