androidfiledialog.h 960 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef ANDROIDFILEDIALOG_H
  2. #define ANDROIDFILEDIALOG_H
  3. #include <QObject>
  4. #include <QAndroidJniObject>
  5. #include <QtAndroid>
  6. #include <QAndroidActivityResultReceiver>
  7. class AndroidFileDialog : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit AndroidFileDialog(QObject *parent = 0);
  12. virtual ~AndroidFileDialog();
  13. bool provideExistingFileName();
  14. private:
  15. class ResultReceiver : public QAndroidActivityResultReceiver {
  16. AndroidFileDialog *_dialog;
  17. public:
  18. ResultReceiver(AndroidFileDialog *dialog);
  19. virtual ~ResultReceiver();
  20. void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data);
  21. QString uriToPath(QAndroidJniObject uri);
  22. };
  23. static const int EXISTING_FILE_NAME_REQUEST = 1;
  24. ResultReceiver *receiver;
  25. void emitExistingFileNameReady(QString result);
  26. signals:
  27. void existingFileNameReady(QString result);
  28. };
  29. #endif // ANDROIDFILEDIALOG_H