Fix iOS build
This commit is contained in:
parent
4e9f68acff
commit
cacf74af3c
8 changed files with 15 additions and 18 deletions
|
|
@ -112,6 +112,7 @@ void AmneziaApplication::init()
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
#ifdef Q_OS_IOS
|
||||||
IosController::Instance()->initialize();
|
IosController::Instance()->initialize();
|
||||||
|
setImportController(m_importController.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
m_notificationHandler.reset(NotificationHandler::create(nullptr));
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,10 @@ void FileUtilites::saveFile(QString fileName, const QString &data)
|
||||||
filesToSend.append(fileName);
|
filesToSend.append(fileName);
|
||||||
MobileUtils::shareText(filesToSend);
|
MobileUtils::shareText(filesToSend);
|
||||||
return;
|
return;
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#ifdef Q_OS_IOS
|
|
||||||
QStringList filesToSend;
|
|
||||||
filesToSend.append(fileUrl.toString());
|
|
||||||
MobileUtils::shareText(filesToSend);
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QFileInfo fi(fileUrl.toLocalFile());
|
QFileInfo fi(fileUrl.toLocalFile());
|
||||||
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
QDesktopServices::openUrl(fi.absoluteDir().absolutePath());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileUtilites::getFileName(QString fileName)
|
QString FileUtilites::getFileName(QString fileName)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef QTAPPDELEGATECINTERFACE_H
|
#ifndef QTAPPDELEGATECINTERFACE_H
|
||||||
#define QTAPPDELEGATECINTERFACE_H
|
#define QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
||||||
#include "ui/pages_logic/StartPageLogic.h"
|
#include "ui/controllers/importController.h"
|
||||||
|
|
||||||
void QtAppDelegateInitialize();
|
void QtAppDelegateInitialize();
|
||||||
void setStartPageLogic(StartPageLogic*);
|
void setImportController(ImportController*);
|
||||||
|
|
||||||
#endif // QTAPPDELEGATECINTERFACE_H
|
#endif // QTAPPDELEGATECINTERFACE_H
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "QtAppDelegate-C-Interface.h"
|
#import "QtAppDelegate-C-Interface.h"
|
||||||
|
|
||||||
#include "ui/pages_logic/StartPageLogic.h"
|
#include "ui/controllers/importController.h"
|
||||||
|
|
||||||
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
|
||||||
+(QtAppDelegate *)sharedQtAppDelegate;
|
+(QtAppDelegate *)sharedQtAppDelegate;
|
||||||
@property (nonatomic) StartPageLogic* startPageLogic;
|
@property (nonatomic) ImportController* ImportController;
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
bool isOpenFile = file.open(QIODevice::ReadOnly);
|
||||||
QByteArray data = file.readAll();
|
QByteArray data = file.readAll();
|
||||||
|
|
||||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic->importAnyFile(QString(data));
|
[QtAppDelegate sharedQtAppDelegate].ImportController->extractConfigFromData(QString(data));
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
|
|
@ -92,8 +92,8 @@ void QtAppDelegateInitialize()
|
||||||
NSLog(@"Created a new AppDelegate");
|
NSLog(@"Created a new AppDelegate");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStartPageLogic(StartPageLogic* startPage) {
|
void setImportController(ImportController* controller) {
|
||||||
[QtAppDelegate sharedQtAppDelegate].startPageLogic = startPage;
|
[QtAppDelegate sharedQtAppDelegate].ImportController = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void ImportController::extractConfigFromFile(const QString &fileName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportController::extractConfigFromData(QString &data)
|
void ImportController::extractConfigFromData(QString data)
|
||||||
{
|
{
|
||||||
auto configFormat = checkConfigFormat(data);
|
auto configFormat = checkConfigFormat(data);
|
||||||
if (configFormat == ConfigTypes::OpenVpn) {
|
if (configFormat == ConfigTypes::OpenVpn) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void importConfig();
|
void importConfig();
|
||||||
void extractConfigFromFile(const QString &fileName);
|
void extractConfigFromFile(const QString &fileName);
|
||||||
void extractConfigFromData(QString &data);
|
void extractConfigFromData(QString data);
|
||||||
void extractConfigFromCode(QString code);
|
void extractConfigFromCode(QString code);
|
||||||
bool extractConfigFromQr(const QByteArray &data);
|
bool extractConfigFromQr(const QByteArray &data);
|
||||||
QString getConfig();
|
QString getConfig();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
#ifndef OSXUTIL_H
|
#ifndef OSXUTIL_H
|
||||||
#define OSXUTIL_H
|
#define OSXUTIL_H
|
||||||
|
|
||||||
|
#ifndef Q_OS_IOS
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
void setDockIconVisible(bool visible);
|
void setDockIconVisible(bool visible);
|
||||||
void fixWidget(QWidget *widget);
|
void fixWidget(QWidget *widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue