X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmMain.mm;h=7e6b563e1412172e266128d34f0f88edb68012df;hp=bb8d614ba6086ff9b3544c0884c4e07c9e6f9796;hb=32b56fabfeac4fea69986ebf183d5e9564bec040;hpb=97dfbc0f8d220e9bf55c8b0f3044b0717be3eec0 diff --git a/source/frmMain.mm b/source/frmMain.mm index bb8d614..7e6b563 100644 --- a/source/frmMain.mm +++ b/source/frmMain.mm @@ -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]; + } +}