Save files for iOS
This commit is contained in:
parent
1b3a32f83f
commit
195a3ab170
6 changed files with 22 additions and 9 deletions
|
@ -24,7 +24,8 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
QFile file(fileName);
|
QUrl fileUrl = QDir::tempPath() + "/" + fileName;
|
||||||
|
QFile file(fileUrl.toString());
|
||||||
#else
|
#else
|
||||||
QUrl fileUrl = QUrl(fileName);
|
QUrl fileUrl = QUrl(fileName);
|
||||||
QFile file(fileUrl.toLocalFile());
|
QFile file(fileUrl.toLocalFile());
|
||||||
|
@ -37,7 +38,7 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
QStringList filesToSend;
|
QStringList filesToSend;
|
||||||
filesToSend.append(fileName);
|
filesToSend.append(fileUrl.toString());
|
||||||
MobileUtils::shareText(filesToSend);
|
MobileUtils::shareText(filesToSend);
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef QTAPPDELEGATECINTERFACE_H
|
#ifndef QTAPPDELEGATECINTERFACE_H
|
||||||
#define QTAPPDELEGATECINTERFACE_H
|
#define QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
||||||
#include "ui/controllers/importController.h"
|
|
||||||
|
|
||||||
void QtAppDelegateInitialize();
|
void QtAppDelegateInitialize();
|
||||||
|
|
||||||
#endif // QTAPPDELEGATECINTERFACE_H
|
#endif // QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
#include "ui/controllers/importController.h"
|
|
||||||
|
|
||||||
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -69,7 +69,13 @@ DrawerType {
|
||||||
text: qsTr("Share")
|
text: qsTr("Share")
|
||||||
imageSource: "qrc:/images/controls/share-2.svg"
|
imageSource: "qrc:/images/controls/share-2.svg"
|
||||||
|
|
||||||
onClicked: fileDialog.open()
|
onClicked: {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
ExportController.saveFile("amnezia_config.vpn")
|
||||||
|
} else {
|
||||||
|
fileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
@ -100,7 +100,13 @@ PageType {
|
||||||
|
|
||||||
image: "qrc:/images/controls/save.svg"
|
image: "qrc:/images/controls/save.svg"
|
||||||
|
|
||||||
onClicked: fileDialog.open()
|
onClicked: {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
SettingsController.exportLogsFile("AmneziaVPN.log")
|
||||||
|
} else {
|
||||||
|
fileDialog.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: fileDialog
|
id: fileDialog
|
||||||
|
|
|
@ -302,8 +302,12 @@ PageType {
|
||||||
text: qsTr("Save site list")
|
text: qsTr("Save site list")
|
||||||
|
|
||||||
clickedFunction: function() {
|
clickedFunction: function() {
|
||||||
|
if (Qt.platform.os === "ios") {
|
||||||
|
ExportController.saveFile("amezia_tunnel.json")
|
||||||
|
} else {
|
||||||
saveFileDialog.open()
|
saveFileDialog.open()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileDialog {
|
FileDialog {
|
||||||
id: saveFileDialog
|
id: saveFileDialog
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue