ApplicationRequestHandler QML Type

An object used to perform actions. More...

Since: Qt 5.11
Inherits:

QtObject

Properties

Methods

Detailed Description

The ApplicationRequestHandler is not meant to be used as is in the system, instead it is acting as the receiver of the requests coming from the applications using the Qt.openUrlExternally function as shown in the example below.

Example Usage

Button {
    id: openTunerApp
    onClicked: {
        Qt.openUrlExternally("x-tuner://");
    }
}

Button {
    id: openPhoneAppBluetoothMenu
    onClicked: {
        Qt.openUrlExternally("x-phone://settings/bluetooth");
    }
}

The interface to act on application requests. A request is used to instruct an application to just open or open in a certain state. That said, the action should be possible to be performed from wherever in the system. An application could call the Qt.openUrlExternally() function passing as parameter the mime-type of the application that is intended to be opened, followed by the desired url indicating what the application should do when opening. For this to be successful, the respective mime-Types should be added accordingly to the applications' info.yaml files (example: mimeTypes: [ 'x-scheme-handler/x-tuner' ]) The ApplicationManager will then consult its internal database of applications looking for a match with x-scheme-handler/x-mimeType. If there is a successful match, then the openUrlRequested signal will be emitted and its receiver (ApplicationRequestHandler) can then either acknowledge the request by calling acknowledgeOpenUrlRequest function or reject (rejectOpenUrlRequest). If then the application is started, the url is supplied to the application as a document through the signal openDocument(string documentUrl, string mimeType) via its ApplicationInterface.

Property Documentation

ApplicationRequestHandler : string

This property holds the active application id. It is used to store the active application id before an application request is submitted in order to be able to navigate back to it accordingly.


activeAppId : string

This property holds the active application id. It is used to store the active application id before an application request is submitted in order to be able to navigate back to it accordingly.


[read-only] appManConns : var

This property is used to listen to the ApplicationManager and get the request from other applications.


history : var

This property holds the history of activities started and it's used for a sequential navigation back to the initial state


Method Documentation

goBack()

The goBack function returns to the previous state from a requested action based on the history. It also takes care of updating the history accordingly.


sendRequest(id, params)

Requests the action to be taken in the UI. It uses the Application Managers' acknowledgeOpenUrlRequest function to open the requested application passing the given url to it. It also keeps and updates the history with all the steps performed each time the function is called.


© 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.