mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
moved the qml filedialog opening code below the ios section
This commit is contained in:
@@ -56,18 +56,6 @@ void SystemController::saveFile(QString fileName, const QString &data)
|
||||
|
||||
QString SystemController::getFileName()
|
||||
{
|
||||
auto mainFileDialog = m_qmlRoot->findChild<QObject>("mainFileDialog").parent();
|
||||
if (!mainFileDialog) {
|
||||
return "";
|
||||
}
|
||||
QMetaObject::invokeMethod(mainFileDialog, "open", Qt::DirectConnection);
|
||||
|
||||
QEventLoop wait;
|
||||
QObject::connect(this, &SystemController::fileDialogAccepted, &wait, &QEventLoop::quit);
|
||||
wait.exec();
|
||||
|
||||
auto fileName = mainFileDialog->property("selectedFile").toString();
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
CFURLRef url = CFURLCreateWithFileSystemPath(
|
||||
kCFAllocatorDefault,
|
||||
@@ -81,6 +69,18 @@ QString SystemController::getFileName()
|
||||
return fileName;
|
||||
#endif
|
||||
|
||||
auto mainFileDialog = m_qmlRoot->findChild<QObject>("mainFileDialog").parent();
|
||||
if (!mainFileDialog) {
|
||||
return "";
|
||||
}
|
||||
QMetaObject::invokeMethod(mainFileDialog, "open", Qt::DirectConnection);
|
||||
|
||||
QEventLoop wait;
|
||||
QObject::connect(this, &SystemController::fileDialogAccepted, &wait, &QEventLoop::quit);
|
||||
wait.exec();
|
||||
|
||||
auto fileName = mainFileDialog->property("selectedFile").toString();
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
// patch for files containing spaces etc
|
||||
const QString sep { "raw%3A%2F" };
|
||||
|
||||
Reference in New Issue
Block a user