Qt for HarmonyOS/qtohosextras doc/QOhosOnContinueContext Class
< Qt for HarmonyOS / qtohosextras doc
QOhosOnContinueContext Class
class QtOhosExtras::QOhosOnContinueContext
The QOhosOnContinueContext class manages onContinue context. It provides system data, like source application version code and set the onContinue result that is requested by the system. See UIAbility onContinue. More...
| Header: | #include <QOhosOnContinueContext> |
| qmake: | QT += ohosextras |
| Since: | Qt 5.12.12 |
This class was introduced in Qt 5.12.12.
Public Functions
| virtual void | setAgreeResponse(const QByteArray &responseData) = 0 |
| virtual void | setExitAppOnSourceDeviceAfterMigration(bool exitAfterMigration) = 0 |
| virtual void | setMismatchResponse() = 0 |
| virtual void | setRejectResponse() = 0 |
| virtual void | setResponseOnDistributedDataObjectsSaveResults(const QList<QSharedPointer<QOhosDistributedDataObject>> &dataObjects, QObject *saveResultsHandlerContext, std::function<void (QList<bool>)> saveResultsHandler) = 0 |
| virtual int | sourceApplicationVersionCode() const = 0 |
| virtual QString | targetDeviceId() const = 0 |
Detailed Description
Member Function Documentation
[pure virtual] void QOhosOnContinueContext::setAgreeResponse(const QByteArray &responseData)
Sets On Continue action as agreed with a given responseData. Agreed response means that on continuation process is accepted. See OnContinueResult
[pure virtual] void QOhosOnContinueContext::setExitAppOnSourceDeviceAfterMigration(bool exitAfterMigration)
Decides whether the application should automatically exit on the source device after successful migration to the target device, as per the exitAfterMigration parameter.
The default setting is determined by the platform. As of API17 it's set to "true" by default.
[pure virtual] void QOhosOnContinueContext::setMismatchResponse()
Sets On Continue action as mismatched. Mismatched responses means that on continuation process should not be continued - most probably due to source and target application version code difference. See OnContinueResult
See also sourceApplicationVersionCode().
[pure virtual] void QOhosOnContinueContext::setRejectResponse()
Sets On Continue action as rejected. Rejected responses means that on continuation process should not be continued. This is typically used when the target application cannot handle the continuation request for any reason. See OnContinueResult
Saves dataObjects to the target device as part of the onContinue response and defers delivery of the response until every save has settled. Any file assets attached to the objects are copied into the distributed files directory first, so they are migrated together with the objects. Each object is given a fresh session id, and the session id and field names of every object that was saved successfully are encoded into the response, so the target device can recreate those objects with tryRestoreOnContinueDistributedDataObjects().
When all saves have finished, saveResultsHandler, if set, is invoked with one boolean per object, in the same order as dataObjects, telling whether that object was saved successfully. The handler is bound to saveResultsHandlerContext: if that object is destroyed while the saves are still in flight, the handler is not invoked and the response is delivered without it.
A request that cannot be started rejects the continuation and leaves saveResultsHandler uninvoked. This happens when more than 16 objects are requested, or when the continuation has no target device id.
Only one such request can be made per continuation. A further call is ignored together with its saveResultsHandler, which is then never invoked.
See also tryRestoreOnContinueDistributedDataObjects(), setAgreeResponse(), and setRejectResponse().
[pure virtual] int QOhosOnContinueContext::sourceApplicationVersionCode() const
Returns source application version code. Source application is the one which has started the continuation process. This version code is devlivered as "version" property in onContinue wantParam.
[pure virtual] QString QOhosOnContinueContext::targetDeviceId() const
Returns target device id. Target device is the one the continuation is migrating to. This device id is delivered as "targetDevice" property in onContinue wantParam.