1 #ifndef QTMVVM_ANDROIDFILECHOOSER_H 2 #define QTMVVM_ANDROIDFILECHOOSER_H 4 #include <QtCore/QObject> 6 #include <QtCore/QVariant> 8 #include <QtAndroidExtras/QAndroidActivityResultReceiver> 9 #include <QtAndroidExtras/QAndroidJniObject> 31 class AndroidFileChooser :
public QObject,
public QAndroidActivityResultReceiver
92 Q_PROPERTY(ChooserFlags chooserFlags READ chooserFlags WRITE setChooserFlags NOTIFY
chooserFlagsChanged)
132 explicit AndroidFileChooser(
QObject *parent =
nullptr);
133 ~AndroidFileChooser()
override;
136 ChooserFlags chooserFlags()
const;
149 void setChooserFlags(ChooserFlags chooserFlags);
172 void handleActivityResult(
int receiverRequestCode,
int resultCode,
const QAndroidJniObject &data)
override;
175 const static int RequestCodeNormal = 0x1091c657;
176 const static int RequestCodePersist = 0x1091c658;
187 QAndroidJniObject createGetIntent();
188 QAndroidJniObject createOpenIntent();
189 QAndroidJniObject createOpenMultipleIntent();
190 QAndroidJniObject createSaveIntent();
191 QAndroidJniObject createOpenTreeIntent();
193 void setupBasic(QAndroidJniObject &intent,
bool asTree =
false);
198 Q_DECLARE_OPERATORS_FOR_FLAGS(QtMvvm::AndroidFileChooser::ChooserFlags)
200 #endif // QTMVVM_ANDROIDFILECHOOSER_H The returned URL must be openable (for reading)
QString title
The activity title/description of the file chooser.
ChooserFlag
Extra flags to configure how to open the URLs.
void typeChanged(ChooserType type)
NOTIFY accessor for FileChooser::type.
ChooserType type
The type of URL to get.
void titleChanged(const QString &title)
NOTIFY accessor for FileChooser::title.
void rejected()
Emitted when the user cancels without selecting a url.
Get a permanent content url.
void folderUrlChanged(const QUrl &folderUrl)
NOTIFY accessor for FileChooser::folderUrl.
Create a new permanent content url.
A QML class access the native file chooser on android.
void chooserFlagsChanged(ChooserFlags chooserFlags)
NOTIFY accessor for FileChooser::chooserFlags.
void accepted()
Emitted when the user select a url (or multiple)
void mimeTypesChanged(const QStringList &mimeTypes)
NOTIFY accessor for FileChooser::mimeTypes.
Get a list of permanent content urls.
Only local files are allowed.
The QML import for the QtMvvmQuick QML module.
QUrl folderUrl
The URL of the place to show the dialog from.
Persist the permission to access the content across reboots.
Get a non-permanent, read only content url.
Always allow writing, not only for FileChooser::CreateDocument.
void resultChanged(QVariant result)
NOTIFY accessor for FileChooser::result.
void open()
Opens the file chooser by sending the show intent.
QStringList mimeTypes
A list of acceptable mimetypes. Can contain wildcards.
The primary namespace of the QtMvvm library.
ChooserType
The different modes the chooser can return urls for.
Get a URL to content folder.