Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
macOS: ODTHelpBrowser now running
[xestiaab/.git] / source / frmMain.mm
index bb8d614..7e6b563 100644 (file)
@@ -66,4 +66,38 @@ void frmMain::DisplayTrustPanel( wxCommandEvent &event ){
        *SSLITNObj->ResultValue = (int)ResultValue;
        *SSLITNObj->PausePtr = FALSE;
        
-}
\ No newline at end of file
+}
+
+void frmMain::DisplayHelpBrowser()
+{
+       /* Replace with modern API when deployment target is 10.13+ in the future */
+       
+       /* Replace with NSWorkspace */
+       
+       NSString *language = [[NSLocale currentLocale] localeIdentifier];
+       NSString *documentationFilename = [NSString stringWithFormat:@"Documentation (%@)", language];
+       NSString *helpBrowserDocumentationPath = [[NSBundle mainBundle] pathForResource:documentationFilename ofType:@"fodt"];
+       
+       if (helpBrowserDocumentationPath == nil)
+       {
+               helpBrowserDocumentationPath = [[NSBundle mainBundle] pathForResource:@"Documentation (en_GB)" ofType:@"fodt"];
+       }
+       
+       NSURL *helpBrowserExecutableURL = [[NSBundle mainBundle] URLForResource:@"ODTHelpBrowser" withExtension:@"app"];
+
+       NSArray *args = [NSArray arrayWithObjects:@"-d", helpBrowserDocumentationPath, nil];
+       NSDictionary *helpBrowserArguments = [NSDictionary dictionaryWithObject:args
+                                                           forKey:NSWorkspaceLaunchConfigurationArguments];
+       
+       helpBrowserProcess = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:helpBrowserExecutableURL options:NSWorkspaceLaunchAndHide configuration:helpBrowserArguments error: nil];
+       
+       [helpBrowserProcess activateWithOptions:(NSApplicationActivateAllWindows | NSApplicationActivateIgnoringOtherApps)];
+}
+
+void frmMain::TerminateHelpBrowserProcess()
+{
+       if (helpBrowserProcess != nil)
+       {
+               [helpBrowserProcess terminate];
+       }
+}
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy