From 4e6b29d494175267c7f378f187649a44774d91e6 Mon Sep 17 00:00:00 2001 From: Roberto Viola Date: Fri, 29 Dec 2023 16:12:45 +0000 Subject: [PATCH] Update homeform.cpp (#1927) --- src/homeform.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/homeform.cpp b/src/homeform.cpp index ef71577da..634e0897f 100644 --- a/src/homeform.cpp +++ b/src/homeform.cpp @@ -5251,19 +5251,24 @@ QString homeform::getFileNameFromContentUri(const QString &uriString) { QString homeform::copyAndroidContentsURI(QUrl file, QString subfolder) { #ifdef Q_OS_ANDROID - QString fileNameLocal = getFileNameFromContentUri(file.toString()); + QString fileNameLocal = ""; + qDebug() << "Android Version:" << QOperatingSystemVersion::current(); + if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Android, 13)) + fileNameLocal = getFileNameFromContentUri(file.toString()); if(fileNameLocal.contains(getWritableAppDir() + subfolder + "/")) { qDebug() << "no need to copy file, the file is already in QZ subfolder" << file << subfolder; return file.toString(); } - QFileInfo f(fileNameLocal); - QString filename = f.fileName(); - QFile fileFile(QQmlFile::urlToLocalFileOrQrc(file)); + QString filename = ""; + QFile fileFile(QQmlFile::urlToLocalFileOrQrc(file)); // android <14 fallback if(fileNameLocal.length() == 0) { qDebug() << "android <14 fallback" << fileNameLocal << filename << file.fileName(); filename = file.fileName(); + } else { + QFileInfo f(fileNameLocal); + filename = f.fileName(); } QString dest = getWritableAppDir() + subfolder + "/" + filename; qDebug() << file.fileName() << fileNameLocal << filename;