Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohoswant.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qohoswant_p.h"
5
7
8namespace QtOhosAppKit {
9
10/*!
11 \enum QtOhosAppKit::WantFlag
12 \since 5.12.12
13
14 WantFlag specifies how the Want will be handled.
15 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-ability-wantconstant-V5#flags}
16 {Flags}.
17
18 \value AuthReadUriPermission Grants the permission to read the URI.
19 \value AuthWriteUriPermission Grants the permission to write data to the URI.
20 \value InstallOnDemand Ability will be installed if it has not been installed.
21*/
22
23/*!
24 \class QtOhosAppKit::Want
25 \inmodule QtOhosAppKit
26 \since 5.12.12
27 \brief Want wraps Ohos \l {https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/want-V5}
28 {Want} class.
29
30 It keeps information that can be transmitted between applications. One of the usage scenarios of
31 Want is a parameter of starting an ability or starting application process.
32
33 \sa startAbility()
34 \sa startAppProcess()
35*/
36
37/*!
38 \variable QtOhosAppKit::Want::deviceId
39 \brief Represents the device Id on which Ability is to be performed.
40 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
41 {Device Id}.
42*/
43
44/*!
45 \variable QtOhosAppKit::Want::bundleName
46 \brief Represents an application bundle name.
47 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
48 {Bundle Name}.
49*/
50
51/*!
52 \variable QtOhosAppKit::Want::moduleName
53 \brief Represents the module name.
54 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
55 {Module Name}.
56*/
57
58/*!
59 \variable QtOhosAppKit::Want::abilityName
60 \brief Represents the name of Ability to be started.
61 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
62 {Ability Name}.
63*/
64
65/*!
66 \variable QtOhosAppKit::Want::uri
67 \brief Represents the type of pending data.
68 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
69 {Uri}.
70*/
71
72/*!
73 \variable QtOhosAppKit::Want::type
74 \brief Represents the MIME type of the file to open for example 'text/xml', 'image/ * ', etc.
75 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
76 {Type}.
77*/
78
79/*!
80 \variable QtOhosAppKit::Want::action
81 \brief Represents the general operations to be performed, for example: viewing, sharing,
82 application details.
83 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
84 {Action}.
85*/
86
87/*!
88 \variable QtOhosAppKit::Want::entities
89 \brief Represents the additional category information of the target Ability for example:
90 browser, video player.
91 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
92 {Entities}.
93*/
94
95/*!
96 \variable QtOhosAppKit::Want::flags
97 \brief Represents the way to deal with Want.
98 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
99 {Flags}.
100
101 \sa WantFlag
102*/
103
104/*!
105 \variable QtOhosAppKit::Want::parameters
106 \brief Represents the list of parameters in the Want object.
107 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/js-apis-app-ability-want-V5}
108 {Parameters}.
109*/
110
111/*!
112 \variable QtOhosAppKit::Want::fds
113 \brief Represents the file descriptor map in the Want object.
114 When serialized for startAbility(), each entry is passed to the platform
115 using the fixed HarmonyOS file descriptor parameter format:
116 \code
117 parameters[key] = { "type": "FD", "value": fd }
118 \endcode
119 Use application-specific keys, for example a reverse-DNS prefix, and avoid
120 using the same key in both fds and parameters.
121 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-app-ability-want}
122 {Fds}.
123*/
124
125/*!
126 \class QtOhosAppKit::WantInfo
127 \inmodule QtOhosAppKit
128 \since 5.12.12
129
130 \brief The WantInfo class is to represent Ohos want type.
131*/
132
133/*!
134 \class QtOhosAppKit::WantInfo::ContactInfo
135 \brief The ContactInfo struct represents contact information extracted from a Want.
136
137 This struct is used to hold the contact type and contact ID when the application
138 is launched to handle a contact-related action.
139*/
140
141/*!
142 \fn QtOhosAppKit::Want QtOhosAppKit::WantInfo::want() const = 0;
143
144 Return associated with this instance Want object.
145*/
146
147/*!
148 \fn virtual std::optional<QList<std::shared_ptr<QtOhosAppKit::ShareKit::SharedRecord>>> QtOhosAppKit::WantInfo::tryGetSharedRecordsFromShareKit() const = 0
149
150 Tries to get shared records from assosiated want. The shared data is expected to be stored in the want parameters.
151 Shared records are delivered on an application start or while the application is already running. Returns an empty optional if no such data found.
152 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section661613319216}
153 {systemShare.getSharedData}.
154
155 \sa QtOhosAppKit::AbilityContext::newWantInfoReceived(std::shared_ptr<QtOhosAppKit::WantInfo> wantInfo)
156 \sa std::shared_ptr<QtOhosAppKit::WantInfo> QtOhosAppKit::AppContext::appLaunchWantInfo()
157*/
158
159/*!
160 \fn virtual std::optional<QtOhosAppKit::WantInfo::ContactInfo> QtOhosAppKit::WantInfo::tryGetContactInfo() const = 0
161
162 Tries to get contact information from the associated Want. Returns an empty optional if no
163 contact information is found.
164 See \l {https://developer.huawei.com/consumer/en/doc/harmonyos-references/share-system-share#section19799132782117}
165 {systemShare.getContactInfo}.
166
167 \sa QtOhosAppKit::AbilityContext::newWantInfoReceived(std::shared_ptr<QtOhosAppKit::WantInfo> wantInfo)
168 \sa std::shared_ptr<QtOhosAppKit::WantInfo> QtOhosAppKit::AppContext::appLaunchWantInfo()
169*/
170
171WantInfo::WantInfo() = default;
172
173WantInfo::~WantInfo() = default;
174
175}
176
177QT_END_NAMESPACE
Combined button and popup list for selecting options.