Skip to content

Commit

Permalink
Update homeform.cpp (#1927)
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein authored Dec 29, 2023
1 parent 82ef4e4 commit 4e6b29d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/homeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e6b29d

Please sign in to comment.