Commit c7a633b1 authored by Martin Straka's avatar Martin Straka

iOS: Open and show external zfo file in Datovka

parent 97a42643
......@@ -8,15 +8,18 @@ LIBS = \
$${_PRO_FILE_PWD_}/ios/openssl/lib/libssl.a
HEADERS += \
ios/src/send_email_controller.h \
ios/src/app_delegate.h \
ios/src/doc_view_controller.h \
ios/src/qt_app_delegate.h \
ios/src/ios_file_opener.h \
ios/src/send_email_controller.h \
ios/src/url_opener.h
OBJECTIVE_SOURCES += \
ios/src/send_email_controller.mm \
ios/src/app_delegate.mm \
ios/src/doc_view_controller.mm \
ios/src/ios_file_opener.mm \
ios/src/send_email_controller.mm \
ios/src/url_opener.mm
QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
......@@ -28,3 +31,4 @@ QMAKE_BUNDLE_DATA += ios_icon
app_launch_images.files = $$files($${_PRO_FILE_PWD_}/ios/Images.xcassets/LaunchImage.launchimage/*.png)
QMAKE_BUNDLE_DATA += app_launch_images
LIBS += -framework UIKit -framework MessageUI -framework MobileCoreServices
#import <UIKit/UIKit.h>
#import <qt_app_delegate.h>
@interface QtAppDelegate : UIResponder <UIApplicationDelegate>
+(QtAppDelegate *)sharedQtAppDelegate;
@end
#include <QtCore>
#include "src/files.h"
#import "app_delegate.h"
@implementation QtAppDelegate
Files *filesPtr;
+(QtAppDelegate *)sharedQtAppDelegate{
static dispatch_once_t pred;
static QtAppDelegate *shared = nil;
dispatch_once(&pred, ^{shared = [[super alloc] init];});
return shared;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
Q_UNUSED(application);
Q_UNUSED(sourceApplication);
Q_UNUSED(annotation);
if (url != nil && [url isFileURL]) {
if ([[url pathExtension] isEqualToString:@"zfo"]) {
NSLog(@"URL:%@", [url absoluteString]);
if (Q_NULLPTR != filesPtr) {
filesPtr->openZfoFileFromStorage(QString::fromNSString(url.path));
}
}
}
return YES;
}
void QtAppDelegateInitialize (Files *files)
{
filesPtr = files;
[[UIApplication sharedApplication] setDelegate:[QtAppDelegate sharedQtAppDelegate]];
NSLog(@"Created a new appdelegate");
}
@end
#ifndef QTAPPDELEGATECINTERFACE_H
#define QTAPPDELEGATECINTERFACE_H
#include "src/files.h"
void QtAppDelegateInitialize(Files *files);
#endif // QTAPPDELEGATECINTERFACE_H
......@@ -48,6 +48,11 @@
#include "src/sqlite/file_db_container.h"
#include "src/setwrapper.h"
/* iOS extras. */
#if defined Q_OS_IOS
#include "ios/src/qt_app_delegate.h"
#endif
/* namespace for QML registered objects */
const char *uri = "cz.nic.mobileDatovka";
......@@ -212,6 +217,10 @@ int main(int argc, char *argv[])
IsdsWrapper isds;
GlobalSettingsQmlWrapper settings;
#if defined Q_OS_IOS
QtAppDelegateInitialize(&files);
#endif
/* Connect slot for update message detail after downloading */
QObject::connect(&isds, SIGNAL(messageDownloadFinish(QString, qint64)),
&messages, SLOT(fillMessageDetail(QString, qint64)));
......
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