Qt for HarmonyOS/qtohosextras doc/FileShare Namespace
< Qt for HarmonyOS / qtohosextras doc
The FileShare namespace exposes the file permission API for HarmonyOS. More...
| Header: | #include <FileShare> |
|---|---|
| qmake: | QT += ohosextras |
| Since: | Qt 5.12.12 |
Classes
| class | ActionResult |
| class | CheckResult |
| class | PathPolicy |
| class | PathPolicyCheckResult |
| class | PathPolicyErrorInfo |
Types
| enum | OperationMode { Read, Write } |
| flags | OperationModes |
| enum | PathPolicyError { Unknown, PersistenceForbidden, InvalidMode, InvalidPath, PermissionNotPersisted } |
Functions
| QSharedPointer<ActionResult> | activatePermission(const QList<PathPolicy> &policies) |
| QSharedPointer<CheckResult> | checkPersistent(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | deactivatePermission(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | persistPermission(const QList<PathPolicy> &policies) |
| QSharedPointer<ActionResult> | revokePermission(const QList<PathPolicy> &policies) |
Detailed Description
The FileShare namespace provides a C++ interface to HarmonyOS file permission management.
This API uses file system paths, which differ from the URIs used internally by HarmonyOS. For example, a sandbox path will be converted to a
file://URI containing the app bundle name. To learn more, see sandbox documentation.
Warning: This API relies on the underlying OHOS implementation. Certain functions may be unavailable on some devices, and there may be limitations on the maximum number of persistent policies. Refer to the API documentation for more details.
Type Documentation
Defines permissions on a path.
| Constant | Value | Description |
|---|---|---|
| QtOhosExtras::FileShare::Read | 1 << 0 | Read access on path. |
| QtOhosExtras::FileShare::Write | 1 << 1 | Write access on path. |
Defines permission policy error codes.
| Constant | Value | Description |
|---|---|---|
| QtOhosExtras::FileShare::Unknown | 0 | Error type is unknown or not recognized. |
| QtOhosExtras::FileShare::PersistenceForbidden | 1 | The permission on the path cannot be persisted. |
| QtOhosExtras::FileShare::InvalidMode | 2 | Invalid operation mode. |
| QtOhosExtras::FileShare::InvalidPath | 3 | Invalid path. |
| QtOhosExtras::FileShare::PermissionNotPersisted | 4 | The permission is not persisted. |
Function Documentation
Activates file or folder permissions from policies. Use this function to make a persistent permission active after the application is started.
See also persistPermission() and deactivatePermission().
Checks if file or folder permissions from policies have been persisted in the system.
Persists file or folder permissions to the system database. Permissions must be persisted before they can be activated via activatePermission().