Commit 9b0be45f authored by Martin Straka's avatar Martin Straka

Fixed iOS global helper object

parent 1d898372
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
- (void)openExportDocumentPicker:(NSArray<NSURL *> *)exportUrls { - (void)openExportDocumentPicker:(NSArray<NSURL *> *)exportUrls {
//NSLog(@"EXPORT FILE URLs: %@", exportUrls); //NSLog(@"EXPORT FILE URLs: %@", exportUrls);
UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURLs:exportUrls inMode:UIDocumentPickerModeExportToService]; UIDocumentPickerViewController *documentPicker = [[UIDocumentPickerViewController alloc] initWithURLs:exportUrls inMode:UIDocumentPickerModeExportToService];
documentPicker.delegate = self; documentPicker.delegate = self;
documentPicker.modalPresentationStyle = UIModalPresentationFormSheet; documentPicker.modalPresentationStyle = UIModalPresentationFormSheet;
...@@ -71,12 +70,12 @@ ...@@ -71,12 +70,12 @@
QUrl tmpUrl = QUrl::fromNSURL(url); QUrl tmpUrl = QUrl::fromNSURL(url);
qUrls.append(tmpUrl); qUrls.append(tmpUrl);
} }
GlobInstcs::iOSHelperPtr->importFilesToAppInbox(qUrls); if (Q_NULLPTR != GlobInstcs::iOSHelperPtr) {
GlobInstcs::iOSHelperPtr->importFilesToAppInbox(qUrls);
}
} else if (controller.documentPickerMode == UIDocumentPickerModeExportToService) { } else if (controller.documentPickerMode == UIDocumentPickerModeExportToService) {
NSLog(@"STORAGE FILE URLs: %@", urls); NSLog(@"STORAGE FILE URLs: %@", urls);
} }
} }
......
...@@ -408,6 +408,12 @@ int main(int argc, char *argv[]) ...@@ -408,6 +408,12 @@ int main(int argc, char *argv[])
logErrorNL("%s", "Cannot create image provider."); logErrorNL("%s", "Cannot create image provider.");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
GlobInstcs::iOSHelperPtr = new (std::nothrow) IosHelper;
if (GlobInstcs::iOSHelperPtr == Q_NULLPTR) {
logErrorNL("%s", "Cannot create iOS helper.");
return EXIT_FAILURE;
}
} }
QStringList cmdLineFileNames; QStringList cmdLineFileNames;
...@@ -448,6 +454,7 @@ int main(int argc, char *argv[]) ...@@ -448,6 +454,7 @@ int main(int argc, char *argv[])
Files files; Files files;
Log log(&memLog); Log log(&memLog);
IsdsWrapper isds; IsdsWrapper isds;
IosHelper iOSHelper;
GovWrapper gov(&isds); GovWrapper gov(&isds);
GlobalSettingsQmlWrapper settings; GlobalSettingsQmlWrapper settings;
InteractionZfoFile interactionZfoFile; InteractionZfoFile interactionZfoFile;
...@@ -455,20 +462,14 @@ int main(int argc, char *argv[]) ...@@ -455,20 +462,14 @@ int main(int argc, char *argv[])
StringManipulation strManipulation; StringManipulation strManipulation;
Zfo zfo; Zfo zfo;
IosHelper iOSHelper;
GlobInstcs::iOSHelperPtr = new (std::nothrow) IosHelper;
if (GlobInstcs::iOSHelperPtr == Q_NULLPTR) {
logErrorNL("%s", "Cannot create iOS helper.");
return EXIT_FAILURE;
}
GlobInstcs::iOSHelperPtr = &iOSHelper;
/* Inicialize app delegate component for interaction with iOS /* Inicialize app delegate component for interaction with iOS
* Reaction on the iOS action "Open in..." */ * Reaction on the iOS action "Open in..." */
#if defined Q_OS_IOS #if defined Q_OS_IOS
QtAppDelegateInitialize(&interactionZfoFile); QtAppDelegateInitialize(&interactionZfoFile);
GlobInstcs::iOSHelperPtr = &iOSHelper;
/* Clear send dir. */ /* Clear send dir. */
iOSHelper.clearSendDir(); iOSHelper.clearSendDir();
#endif #endif
...@@ -763,7 +764,7 @@ int main(int argc, char *argv[]) ...@@ -763,7 +764,7 @@ int main(int argc, char *argv[])
delete GlobInstcs::workPoolPtr; GlobInstcs::workPoolPtr = Q_NULLPTR; delete GlobInstcs::workPoolPtr; GlobInstcs::workPoolPtr = Q_NULLPTR;
delete GlobInstcs::msgProcEmitterPtr; GlobInstcs::msgProcEmitterPtr = Q_NULLPTR; delete GlobInstcs::msgProcEmitterPtr; GlobInstcs::msgProcEmitterPtr = Q_NULLPTR;
delete GlobInstcs::iOSHelperPtr; GlobInstcs::iOSHelperPtr = Q_NULLPTR; GlobInstcs::iOSHelperPtr = Q_NULLPTR;
} }
/* Finally, destroy global log object. */ /* Finally, destroy global log object. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment