diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/labs/platform/qquicklabsplatformfiledialog.cpp | 7 | ||||
-rw-r--r-- | src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/labs/platform/qquicklabsplatformfiledialog.cpp b/src/labs/platform/qquicklabsplatformfiledialog.cpp index 1650d043ec..d16f8f7f92 100644 --- a/src/labs/platform/qquicklabsplatformfiledialog.cpp +++ b/src/labs/platform/qquicklabsplatformfiledialog.cpp @@ -554,8 +554,13 @@ QUrl QQuickLabsPlatformFileDialog::addDefaultSuffix(const QUrl &file) const QUrl url = file; const QString path = url.path(); const QString suffix = m_options->defaultSuffix(); - if (!suffix.isEmpty() && !path.endsWith(QLatin1Char('/')) && path.lastIndexOf(QLatin1Char('.')) == -1) + // Urls with "content" scheme do not require suffixes. Such schemes are + // used on Android. + const bool isContentScheme = url.scheme() == u"content"_qs; + if (!isContentScheme && !suffix.isEmpty() && !path.endsWith(QLatin1Char('/')) + && path.lastIndexOf(QLatin1Char('.')) == -1) { url.setPath(path + QLatin1Char('.') + suffix); + } return url; } diff --git a/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp b/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp index da899140b7..5d4023a8cf 100644 --- a/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp +++ b/src/quickdialogs2/quickdialogs2/qquickfiledialog.cpp @@ -576,8 +576,13 @@ QUrl QQuickFileDialog::addDefaultSuffix(const QUrl &file) const QUrl url = file; const QString path = url.path(); const QString suffix = m_options->defaultSuffix(); - if (!suffix.isEmpty() && !path.endsWith(QLatin1Char('/')) && path.lastIndexOf(QLatin1Char('.')) == -1) + // Urls with "content" scheme do not require suffixes. Such schemes are + // used on Android. + const bool isContentScheme = url.scheme() == u"content"_qs; + if (!isContentScheme && !suffix.isEmpty() && !path.endsWith(QLatin1Char('/')) + && path.lastIndexOf(QLatin1Char('.')) == -1) { url.setPath(path + QLatin1Char('.') + suffix); + } return url; } |