summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/androidcontentfileengine.h
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2025-07-14 17:55:31 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2025-08-14 00:11:41 +0300
commitf735cf7cd174c98606a03349507e3bb18589e417 (patch)
treeeb907ddb2ceec78a7a1a9f8cd19caab063b8b522 /src/plugins/platforms/android/androidcontentfileengine.h
parent609725c651806e204e75f397ac60d98c23e8ba3c (diff)
Android: rework and fix issues with content file engine
Rework parts of the content file engine handling especially when parsing the paths to get valid uri that can be used seemlessly with DocumentsContract. This fixes few issues with the content uri handling and allow more operations to be done without awkward workarounds: * The main issue was parsing the URI and creating a valid DocumentFile and parent if applicable, this was not handled quite properly before. So now, each case of a URI type is delt with separately (e.g. document, tree, mixed, children URIs) all while making sure to keep proper encoding while parsing the URI. * open() was getting involved into details like the path structure and not relying on DocumentFile implementation. * Handle file names, especially in cases where the file is not yet created and doing query() would fail, so in such cases initialize the DocumentFile with an initial name as fallback. * Moving operations were always failing due to the various name and path string manipulations, and not properly relying on the DocumentFile child/parent implementation. Pick-to: 6.10 6.9 6.8 Fixes: QTBUG-124011 Fixes: QTBUG-115143 Fixes: QTBUG-114979 Change-Id: I949f84fc658bf0588ebe239b07e6111d5b3b0cce Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/androidcontentfileengine.h')
-rw-r--r--src/plugins/platforms/android/androidcontentfileengine.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/plugins/platforms/android/androidcontentfileengine.h b/src/plugins/platforms/android/androidcontentfileengine.h
index a93ea3373a0..3069185aed3 100644
--- a/src/plugins/platforms/android/androidcontentfileengine.h
+++ b/src/plugins/platforms/android/androidcontentfileengine.h
@@ -79,11 +79,13 @@ public:
static DocumentFilePtr parseFromAnyUri(const QString &filename);
static DocumentFilePtr fromSingleUri(const QJniObject &uri);
static DocumentFilePtr fromTreeUri(const QJniObject &treeUri);
+ static QStringList getPathSegments(const QJniObject &uri);
DocumentFilePtr createFile(const QString &mimeType, const QString &displayName);
DocumentFilePtr createDirectory(const QString &displayName);
const QJniObject &uri() const;
const DocumentFilePtr &parent() const;
+ QString initialName() const;
QString name() const;
QString id() const;
QString mimeType() const;
@@ -100,9 +102,10 @@ public:
bool rename(const QString &newName);
protected:
- DocumentFile(const QJniObject &uri, const std::shared_ptr<DocumentFile> &parent);
+ DocumentFile(const QJniObject &uri, const QString &displayName, const std::shared_ptr<DocumentFile> &parent);
protected:
+ QString m_displayName;
QJniObject m_uri;
DocumentFilePtr m_parent;
};