Skip To Content

DocumentDialog QML Type

(BETA) Provides access to documents external to your app. More...

Import Statement: import ArcGIS.AppFramework.Platform 1.0

Properties

Signals

Methods

Detailed Description

The DocumentDialog component is used to access documents external to your app, of any filetype. This component doesn't facilitate interaction with these files; this needs to be provided by other components.

The External Storage capability must be enabled to use this component in an app on Android. The app will crash if this capability is not enabled.

Only files available on the device's local storage can be accessed using DocumentDialog. Files stored in a cloud service will first need to be downloaded before using DocumentDialog to browse to and select them.

The following code sample demonstrates opening a document dialog to search through your device's files.

Item {
        Button {
                text: "Select document"
                onClicked: {
                        if (doc.supported)
                        {
                                doc.open()
                        }
                        else
                        {
                                console.log("Not Supported")
                        }
                }
        }

        DocumentDialog {
                id: doc

                onAccepted: {
                        console.log("selected file path " , filePath)
                }

                onRejected: {
                        if (status == DocumentDialog.DocumentDialogCancelledByUser) {
                                // Cancelled By User
                        }
                        if (status == DocumentDialog.DocumentDialogPermissionDenied) {
                                // Permission Denied
                        }
                        if (status == DocumentDialog.DocumentDialogNotSupported) {
                                // Not Supported
                        }
                        if (status == DocumentDialog.DocumentDialogFileReadError) {
                                // File Read Error
                        }
                }
        }

        // Show storage permission pop-up on Android

        FileFolder {
                id: fileFolder
                path: AppFramework.userHomePath
        }

        Component.onCompleted: {
                fileFolder.makeFolder()
        }

Enumerations

DocumentDialogErrorStatus enumeration

Enum describing the potential errors encountered by this component. Informs the rejected signal.

NameValue
DocumentDialog.DocumentDialogCancelledByUser0
DocumentDialog.DocumentDialogPermissionDenied1
DocumentDialog.DocumentDialogNotSupported2
DocumentDialog.DocumentDialogFileReadError3

Property Documentation

[read-only] supported : bool

Returns true if external document access is supported by your device. Otherwise, returns false.


Signal Documentation

accepted( string filePath)

Signal emitted when the process of opening an external document has succeeded. The signal will return the filepath of the document that was opened.


rejected( DocumentDialogErrorStatus status)

Signal emitted when the request to access external documents has failed, either by encountering an error or cancelling the dialog. This signal also returns the error state, informed by the DocumentDialogErrorStatus enum.


Method Documentation

open()

Attempts to open a document selection dialog.