From ff24232ba18f5146410275215293132d814dddc6 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 1 Jun 2014 11:36:11 +0000
Subject: [PATCH] open links in Safari

---
 contrib/mobile/iOS/Onelab/AboutViewController.h  |  2 +-
 contrib/mobile/iOS/Onelab/AboutViewController.mm | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/contrib/mobile/iOS/Onelab/AboutViewController.h b/contrib/mobile/iOS/Onelab/AboutViewController.h
index f509cecc87..8df8225255 100644
--- a/contrib/mobile/iOS/Onelab/AboutViewController.h
+++ b/contrib/mobile/iOS/Onelab/AboutViewController.h
@@ -1,6 +1,6 @@
 #import <UIKit/UIKit.h>
 
-@interface AboutViewController : UIViewController
+@interface AboutViewController : UIViewController <UIWebViewDelegate>
 
 @property (weak, nonatomic) IBOutlet UIWebView *aboutView;
 
diff --git a/contrib/mobile/iOS/Onelab/AboutViewController.mm b/contrib/mobile/iOS/Onelab/AboutViewController.mm
index cd6812230e..899719e577 100644
--- a/contrib/mobile/iOS/Onelab/AboutViewController.mm
+++ b/contrib/mobile/iOS/Onelab/AboutViewController.mm
@@ -19,10 +19,21 @@
   return self;
 }
 
+// this allows to open links in Safari, instead of opening them in the AboutViewController
+-(BOOL) webView:(UIWebView *)inWeb shouldStartLoadWithRequest:(NSURLRequest *)inRequest navigationType:(UIWebViewNavigationType)inType {
+  if ( inType == UIWebViewNavigationTypeLinkClicked ) {
+    [[UIApplication sharedApplication] openURL:[inRequest URL]];
+    return NO;
+  }
+  
+  return YES;
+}
+
 - (void)viewDidLoad
 {
   [super viewDidLoad];
   // Do any additional setup after loading the view.
+  self.aboutView.delegate = self;
   [self.aboutView loadHTMLString:[NSString stringWithFormat:@"<center><h3>Onelab/Mobile</h3>Version %@<p>Copyright (C) 2014 Christophe Geuzaine and Maxime Graulich, University of Li&egrave;ge</p><p>Visit <a href=\"http://onelab.info/\">http://onelab.info/</a> for more information</p><p>This version of Onelab/Mobile contains:</p><h3>Gmsh</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2014 Christophe Geuzaine and Jean-Fran&ccedil;ois Remacle</p><p><a href=\"http://geuz.org/gmsh/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/gmsh/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://gmsh.info/\">http://gmsh.info</a> for more information</p><h3>GetDP</h3>Version %s (<i>Build date:</i> %s)<p>Copyright (C) 1997-2014 Patrick Dular and Christophe Geuzaine, University of Li&egrave;ge</p><p><a href=\"http://geuz.org/getdp/doc/CREDITS.txt\">Credits</a> and <a href=\"http://geuz.org/getdp/doc/LICENSE.txt\">licensing information</a></p><p><i>Build options:</i> %s</p><p>Visit <a href=\"http://getdp.info\">http://getdp.info</a> for more information</p></center>",
                                            [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"],
                                            GMSH_VERSION,
-- 
GitLab