X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmMain.mm;h=39200a7aac325c189bdf3021340b6c9c63a15d22;hp=bb8d614ba6086ff9b3544c0884c4e07c9e6f9796;hb=3ef806261b5482a584e05dc8311c8d7633f146b4;hpb=7463b9071a5aa395e59737cbdfd3445832ff016c diff --git a/source/frmMain.mm b/source/frmMain.mm index bb8d614..39200a7 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]; + } +}