fixed conflicts after merge

This commit is contained in:
vladimir.kuznetsov 2023-08-28 22:03:28 +03:00
parent 36a2482165
commit 8f6aa950cd
6 changed files with 140 additions and 104 deletions

View file

@ -10,6 +10,9 @@
#include "../../platforms/android/androidutils.h"
#include <QJniObject>
#endif
#ifdef Q_OS_IOS
#include <CoreFoundation/CoreFoundation.h>
#endif
#include "fileUtilites.h"
namespace
@ -88,6 +91,18 @@ void ImportController::extractConfigFromFile()
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation),
"*.vpn *.ovpn *.conf");
QFile file(fileName);
#ifdef Q_OS_IOS
CFURLRef url = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(fileName.unicode()), fileName.length()),
kCFURLPOSIXPathStyle, 0);
if (!CFURLStartAccessingSecurityScopedResource(url)) {
qDebug() << "Could not access path " << QUrl::fromLocalFile(fileName).toString();
}
#endif
if (file.open(QIODevice::ReadOnly)) {
QString data = file.readAll();

View file

@ -95,6 +95,18 @@ void SettingsController::restoreAppConfig()
}
QFile file(fileName);
#ifdef Q_OS_IOS
CFURLRef url = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(fileName.unicode()), fileName.length()),
kCFURLPOSIXPathStyle, 0);
if (!CFURLStartAccessingSecurityScopedResource(url)) {
qDebug() << "Could not access path " << QUrl::fromLocalFile(fileName).toString();
}
#endif
file.open(QIODevice::ReadOnly);
QByteArray data = file.readAll();

View file

@ -90,6 +90,18 @@ void SitesController::importSites(bool replaceExisting)
}
QFile file(fileName);
#ifdef Q_OS_IOS
CFURLRef url = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault,
CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar *>(fileName.unicode()), fileName.length()),
kCFURLPOSIXPathStyle, 0);
if (!CFURLStartAccessingSecurityScopedResource(url)) {
qDebug() << "Could not access path " << QUrl::fromLocalFile(fileName).toString();
}
#endif
if (!file.open(QIODevice::ReadOnly)) {
emit errorOccurred(tr("Can't open file: ") + fileName);
return;