|
|
| Line 1: |
Line 1: |
| <!-- Source: qtohosextras-fileshare.html --> | | < [[Qt_for_HarmonyOS/qtohosextras_doc|Qt for HarmonyOS / qtohosextras doc]] |
| <span id="fileshare-namespace"></span>
| | |
| = FileShare Namespace = | | = FileShare Namespace = |
|
| |
|
| <span class="small-subtitle">([[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|QtOhosExtras::FileShare]])<br />
| | The FileShare namespace exposes the file permission API for HarmonyOS. More... |
| </span>
| |
|
| |
|
| The [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|FileShare]] to expose file permission API. [[#details|More...]]
| | {| class="wikitable" |
| | |
| <div class="table">
| |
| | |
| {| class="wikitable alignedsummary" | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| Header:
| | ! Header: |
| | class="memItemRight bottomAlign"| <span class="preprocessor">#include <FileShare></span> | | | #include <FileShare> |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| qmake:
| | ! qmake: |
| | class="memItemRight bottomAlign"| QT += ohosextras
| | | QT += ohosextras |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| Since:
| | ! Since: |
| | class="memItemRight bottomAlign"| Qt 5.12.12
| | | Qt 5.12.12 |
| |} | | |} |
|
| |
|
|
| |
| </div>
| |
|
| |
|
| |
| <span id="classes"></span>
| |
|
| |
| <span id="classes"></span>
| |
| == Classes == | | == Classes == |
|
| |
|
| <div class="table">
| | {| class="wikitable" style="width:100%" |
| | |
| {| class="wikitable alignedsummary"
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| class | | | class || '''[[ActionResult_Class|ActionResult]]''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]]'''
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| class | | | class || '''[[CheckResult_Class|CheckResult]]''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]]'''
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| class | | | class || '''[[PathPolicy_Class|PathPolicy]]''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]]'''
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| class | | | class || '''[[PathPolicyCheckResult_Class|PathPolicyCheckResult]]''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class|PathPolicyCheckResult]]'''
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| class | | | class || '''[[PathPolicyErrorInfo_Class|PathPolicyErrorInfo]]''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]]'''
| |
| |} | | |} |
|
| |
|
|
| |
| </div>
| |
| <span id="types"></span>
| |
|
| |
| <span id="types"></span>
| |
| == Types == | | == Types == |
|
| |
|
| <div class="table">
| | {| class="wikitable" style="width:100%" |
| | |
| {| class="wikitable alignedsummary"
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| enum
| | | enum || '''[[#OperationMode-enum|OperationMode]]''' { Read, Write } |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#OperationMode-enum|OperationMode]]''' { Read, Write } | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| flags
| | | flags || '''OperationModes''' |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#OperationMode-enum|OperationModes]]''' | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| enum
| | | enum || '''[[#PathPolicyError-enum|PathPolicyError]]''' { Unknown, PersistenceForbidden, InvalidMode, InvalidPath, PermissionNotPersisted } |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#PathPolicyError-enum|PathPolicyError]]''' { Unknown, PersistenceForbidden, InvalidMode, InvalidPath, PermissionNotPersisted } | |
| |} | | |} |
|
| |
|
|
| |
| </div>
| |
| <span id="functions"></span>
| |
|
| |
| <span id="functions"></span>
| |
| == Functions == | | == Functions == |
|
| |
|
| <div class="table">
| | {| class="wikitable" style="width:100%" |
| | |
| {| class="wikitable alignedsummary" | |
| |-
| |
| | class="memItemLeft rightAlign topAlign"| QSharedPointer<QtOhosExtras::FileShare::ActionResult>
| |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]'''(const QList<QtOhosExtras::FileShare::PathPolicy> &''policies'')
| |
| |-
| |
| | class="memItemLeft rightAlign topAlign"| QSharedPointer<QtOhosExtras::FileShare::CheckResult>
| |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]'''(const QList<QtOhosExtras::FileShare::PathPolicy> &''policies'')
| |
| |-
| |
| | class="memItemLeft rightAlign topAlign"| QSharedPointer<QtOhosExtras::FileShare::ActionResult>
| |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]]'''(const QList<QtOhosExtras::FileShare::PathPolicy> &''policies'')
| |
| |-
| |
| | class="memItemLeft rightAlign topAlign"| QSharedPointer<QtOhosExtras::FileShare::ActionResult>
| |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]'''(const QList<QtOhosExtras::FileShare::PathPolicy> &''policies'')
| |
| |-
| |
| | class="memItemLeft rightAlign topAlign"| const QMetaObject *
| |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#qt_getEnumMetaObject|qt_getEnumMetaObject]]'''(''QtOhosExtras::FileShare::OperationMode'')
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| const char * | | | QSharedPointer<ActionResult> || '''[[#activatePermission|activatePermission]]'''(const QList<PathPolicy> &''policies'') |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#qt_getEnumName|qt_getEnumName]]'''(''QtOhosExtras::FileShare::OperationMode'')
| |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| QSharedPointer<QtOhosExtras::FileShare::ActionResult>
| | | QSharedPointer<CheckResult> || '''[[#checkPersistent|checkPersistent]]'''(const QList<PathPolicy> &''policies'') |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]]'''(const QList<QtOhosExtras::FileShare::PathPolicy> &''policies'') | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| QFlags<OperationModes::enum_type> | | | QSharedPointer<ActionResult> || '''[[#deactivatePermission|deactivatePermission]]'''(const QList<PathPolicy> &''policies'') |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#operator-7c|operator|]]'''(OperationModes::enum_type ''f1'', OperationModes::enum_type ''f2'') | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| QFlags<OperationModes::enum_type> | | | QSharedPointer<ActionResult> || '''[[#persistPermission|persistPermission]]'''(const QList<PathPolicy> &''policies'') |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#operator-7c-1|operator|]]'''(OperationModes::enum_type ''f1'', QFlags<OperationModes::enum_type> ''f2'') | |
| |- | | |- |
| | class="memItemLeft rightAlign topAlign"| QIncompatibleFlag | | | QSharedPointer<ActionResult> || '''[[#revokePermission|revokePermission]]'''(const QList<PathPolicy> &''policies'') |
| | class="memItemRight bottomAlign"| '''[[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#operator-7c-2|operator|]]'''(OperationModes::enum_type ''f1'', int ''f2'')
| |
| |} | | |} |
|
| |
|
|
| |
| </div>
| |
| <span id="details"></span>
| |
|
| |
| <div class="descr">
| |
|
| |
| <span id="details"></span>
| |
| == Detailed Description == | | == Detailed Description == |
|
| |
|
| The [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace|FileShare]] to expose file permission API. | | 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, the path <code>/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> will be converted to the URI <code>file://com.your.example/data/storage/el1/bundle/entry/resources/resfile/test.txt</code> , where <code>com.your.example</code> is app bundle name.
| |
| | |
| To learn more about file paths and URIs in HarmonyOS, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 sandbox documentation].
| |
| | |
| '''Warning:''' This API relies on the underlying OHOS implementation. The following functions: [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]](), [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#checkPersistent|checkPersistent]]() may be unavailable on some devices. Additionally, there may be limitations on the maximum number of policies, and certain permissions may need to be explicitly granted to the application.
| |
| | |
| For more details and limitations, refer to the [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation].
| |
| | |
| | |
| </div>
| |
| <div class="classes">
| |
| | |
| <span id="classes-1"></span>
| |
| == Classes ==
| |
| | |
| <span id="class-actionresult"></span>
| |
| === class [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]] ===
| |
| | |
| The [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]] class encapsulates the result of all file requested access permission actions. [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class#details|More...]]
| |
| | |
| <span id="class-checkresult"></span>
| |
| === class [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]] ===
| |
| | |
| The [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]] class encapsulates the result of all requested file access permission checks. [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class#details|More...]]
| |
| | |
| <span id="class-pathpolicy"></span>
| |
| === class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]] ===
| |
| | |
| The [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]] struct encapsulates information required to request file access permissions for a specified path. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class#details|More...]]
| |
| | |
| <span id="class-pathpolicycheckresult"></span>
| |
| === class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class|PathPolicyCheckResult]] ===
| |
| | |
| The [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class|PathPolicyCheckResult]] struct contains the result of a file permission check request for a specified path, indicating whether access is granted or denied. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyCheckResult_Class#details|More...]]
| |
| | |
| <span id="class-pathpolicyerrorinfo"></span>
| |
| === class [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]] ===
| |
|
| |
|
| The [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]] struct contains the result of a file access permission request for a specified path. [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class#details|More...]]
| | 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 <code>file://</code> URI containing the app bundle name. To learn more, see [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V5/app-sandbox-directory-V5 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 [https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/native-fileshare-guidelines-V14 API documentation] for more details. |
|
| |
|
| </div>
| |
| <div class="types">
| |
|
| |
| <span id="type-documentation"></span>
| |
| == Type Documentation == | | == Type Documentation == |
|
| |
|
| enum FileShare::<span class="name">OperationMode</span><br />flags FileShare::<span class="name">OperationModes</span>
| | === <span id="OperationMode-enum"></span>enum FileShare::OperationMode === |
|
| |
|
| Defines permissions on path. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_operationmode FileShare_OperationMode]. The flags can be combined using bitwise operations. | | Defines permissions on a path. |
|
| |
|
| <div class="table">
| | {| class="wikitable" |
| | | ! Constant !! Value !! Description |
| {| class="wikitable valuelist" | |
| |- class="odd" valign="top"
| |
| ! class="tblConst"| Constant | |
| ! class="tblval"| Value | |
| ! class="tbldscr"| Description | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::Read</code> | | | QtOhosExtras::FileShare::Read || 1 << 0 || Read access on path. |
| | class="topAlign tblval"| <code>1 << 0</code> | |
| | class="topAlign"| Read on path | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::Write</code> | | | QtOhosExtras::FileShare::Write || 1 << 1 || Write access on path. |
| | class="topAlign tblval"| <code>1 << 1</code> | |
| | class="topAlign"| Write on path | |
| |} | | |} |
|
| |
|
| | === <span id="PathPolicyError-enum"></span>enum FileShare::PathPolicyError === |
|
| |
|
| </div>
| | Defines permission policy error codes. |
| This enum was introduced or modified in Qt 5.12.12.
| |
| | |
| The OperationModes type is a typedef for [[../qtcore/qflags.html|QFlags]] <OperationMode>. It stores an OR combination of OperationMode values.
| |
| | |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]].
| |
| | |
| == '''enum FileShare'''::<span class="name">PathPolicyError</span> ==
| |
| <span id="PathPolicyError-enum"></span>Defines permission policy error codes. See [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#fileshare_policyerrorcode FileShare_PolicyErrorCode].
| |
|
| |
|
| <div class="table">
| | {| class="wikitable" |
| | | ! Constant !! Value !! Description |
| {| class="wikitable valuelist" | |
| |- class="odd" valign="top"
| |
| ! class="tblConst"| Constant | |
| ! class="tblval"| Value | |
| ! class="tbldscr"| Description | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::Unknown</code> | | | QtOhosExtras::FileShare::Unknown || 0 || Error type is unknown or not recognized. |
| | class="topAlign tblval"| <code>0</code> | |
| | class="topAlign"| Error type is unknown or not recognized | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::PersistenceForbidden</code> | | | QtOhosExtras::FileShare::PersistenceForbidden || 1 || The permission on the path cannot be persisted. |
| | class="topAlign tblval"| <code>1</code> | |
| | class="topAlign"| The permission on the path cannot be persisted | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::InvalidMode</code> | | | QtOhosExtras::FileShare::InvalidMode || 2 || Invalid operation mode. |
| | class="topAlign tblval"| <code>2</code> | |
| | class="topAlign"| Invalid operation mode | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::InvalidPath</code> | | | QtOhosExtras::FileShare::InvalidPath || 3 || Invalid path. |
| | class="topAlign tblval"| <code>3</code> | |
| | class="topAlign"| Invalid path | |
| |- | | |- |
| | class="topAlign"| <code>QtOhosExtras::FileShare::PermissionNotPersisted</code> | | | QtOhosExtras::FileShare::PermissionNotPersisted || 4 || The permission is not persisted. |
| | class="topAlign tblval"| <code>4</code> | |
| | class="topAlign"| The permission is not persisted | |
| |} | | |} |
|
| |
|
|
| |
| </div>
| |
| This enum was introduced or modified in Qt 5.12.12.
| |
|
| |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicyErrorInfo_Class|PathPolicyErrorInfo]].
| |
|
| |
|
| |
| </div>
| |
| <div class="func">
| |
|
| |
| <span id="function-documentation"></span>
| |
| == Function Documentation == | | == Function Documentation == |
| <span id="activatePermission"></span>
| |
| === activatePermission ===
| |
|
| |
| <syntaxhighlight lang="cpp">
| |
| QSharedPointer<QtOhosExtras::FileShare::ActionResult> FileShare::activatePermission(const QList<QtOhosExtras::FileShare::PathPolicy> &policies)
| |
| </syntaxhighlight>
| |
|
| |
| Activates file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]].
| |
|
| |
| This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_activatepermission OH_FileShare_ActivatePermission]. Each time an application is started, its persistent permissions have not been loaded to the memory. Use this function to make a persistent permission active after the application is started. If the activation fails because the permission has not been persisted, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]() first.
| |
|
| |
| To deactivate an active permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]]().
| |
|
| |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#deactivatePermission|deactivatePermission]]().
| |
|
| |
| <span id="checkPersistent"></span>
| |
| === checkPersistent ===
| |
|
| |
| <syntaxhighlight lang="cpp">
| |
| QSharedPointer<QtOhosExtras::FileShare::CheckResult> FileShare::checkPersistent(const QList<QtOhosExtras::FileShare::PathPolicy> &policies)
| |
| </syntaxhighlight>
| |
|
| |
| Checks if file or folder permissions from ''policies'' have persistent permissions. The result check for each file or folder can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]]. CheckResult::PathPolicyCheckResult::result will be set to <code>true</code> for each file or folder only for succesufull check and persistent permission found, <code>false</code> otherwise.
| |
|
| |
| This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_checkpersistentpermission OH_FileShare_CheckPersistentPermission].
| |
|
| |
| To persist permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]().
| |
|
| |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/CheckResult_Class|CheckResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]().
| |
|
| |
| <span id="deactivatePermission"></span>
| |
| === deactivatePermission ===
| |
|
| |
| <syntaxhighlight lang="cpp">
| |
| QSharedPointer<QtOhosExtras::FileShare::ActionResult> FileShare::deactivatePermission(const QList<QtOhosExtras::FileShare::PathPolicy> &policies)
| |
| </syntaxhighlight>
| |
|
| |
| Deactivates file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]].
| |
|
| |
| This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_deactivatepermission OH_FileShare_DeactivatePermission].
| |
|
| |
| To activate permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]().
| |
|
| |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]().
| |
|
| |
| <span id="persistPermission"></span>
| |
| === persistPermission ===
| |
|
| |
| <syntaxhighlight lang="cpp">
| |
| QSharedPointer<QtOhosExtras::FileShare::ActionResult> FileShare::persistPermission(const QList<QtOhosExtras::FileShare::PathPolicy> &policies)
| |
| </syntaxhighlight>
| |
|
| |
| Persists file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]].
| |
|
| |
| This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_persistpermission OH_FileShare_PersistPermission]. persistPermission() stores persistence data in the system database. After persistPermission() call, permissions are not yet active. Use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]() to activate permissions. persistPermission() must be called at least once before [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]().
| |
|
| |
| To revoke a persistent permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]]().
| |
|
| |
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#revokePermission|revokePermission]](), and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#activatePermission|activatePermission]]().
| |
|
| |
| <span id="qt_getEnumMetaObject"></span><syntaxhighlight>
| |
| const QMetaObject *FileShare::qt_getEnumMetaObject(QtOhosExtras::FileShare::OperationMode)
| |
| </syntaxhighlight><span id="qt_getEnumName"></span><syntaxhighlight>
| |
| const char *FileShare::qt_getEnumName(QtOhosExtras::FileShare::OperationMode)
| |
| </syntaxhighlight><span id="qt_getEnumName"></span><span id="revokePermission"></span>
| |
| === revokePermission ===
| |
|
| |
| <syntaxhighlight lang="cpp">
| |
| QSharedPointer<QtOhosExtras::FileShare::ActionResult> FileShare::revokePermission(const QList<QtOhosExtras::FileShare::PathPolicy> &policies)
| |
| </syntaxhighlight>
| |
|
| |
| Revokes file or folder permissions from ''policies''. The success of the action can be determined from [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]].
| |
|
| |
|
| This function calls [https://developer.huawei.com/consumer/en/doc/harmonyos-references-V5/file_share-V5#oh_fileshare_revokepermission OH_FileShare_RevokePermission].
| | === <span id="activatePermission"></span>QSharedPointer<ActionResult> FileShare::activatePermission(const QList<PathPolicy> &policies) === |
|
| |
|
| To persist permission, use [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]]().
| | Activates file or folder permissions from ''policies''. Use this function to make a persistent permission active after the application is started. |
|
| |
|
| '''See also''' [[Qt_for_HarmonyOS/qtohosextras_doc/ActionResult_Class|ActionResult]], [[Qt_for_HarmonyOS/qtohosextras_doc/PathPolicy_Class|PathPolicy]], and [[Qt_for_HarmonyOS/qtohosextras_doc/FileShare_Namespace#persistPermission|persistPermission]](). | | '''See also '''[[#persistPermission|persistPermission()]] and [[#deactivatePermission|deactivatePermission()]]. |
|
| |
|
| <span id="operator-7c"></span> | | === <span id="checkPersistent"></span>QSharedPointer<CheckResult> FileShare::checkPersistent(const QList<PathPolicy> &policies) === |
| === Function ===
| |
|
| |
|
| <syntaxhighlight lang="cpp">
| | Checks if file or folder permissions from ''policies'' have been persisted in the system. |
| QFlags<OperationModes::enum_type> FileShare::operator|(OperationModes::enum_type f1, OperationModes::enum_type f2)
| |
| </syntaxhighlight>
| |
|
| |
|
| <span id="operator-7c-1"></span> | | === <span id="persistPermission"></span>QSharedPointer<ActionResult> FileShare::persistPermission(const QList<PathPolicy> &policies) === |
| === Function ===
| |
|
| |
|
| <syntaxhighlight lang="cpp">
| | Persists file or folder permissions to the system database. Permissions must be persisted before they can be activated via [[#activatePermission|activatePermission()]]. |
| QFlags<OperationModes::enum_type> FileShare::operator|(OperationModes::enum_type f1, QFlags<OperationModes::enum_type> f2)
| |
| </syntaxhighlight><syntaxhighlight>
| |
| QIncompatibleFlag FileShare::operator|(OperationModes::enum_type f1, int f2)
| |
| </syntaxhighlight>
| |
|
| |
|
| </div>
| | [[Category:Qt for HarmonyOS]] |