]> git.saurik.com Git - apple/security.git/blob - SecurityServer/SettingsDialog/SettingsWindow.m
Security-176.tar.gz
[apple/security.git] / SecurityServer / SettingsDialog / SettingsWindow.m
1 #import "SettingsWindow.h"
2
3 // @@@ need to add code to remember the radio button settings as a pref
4
5 @implementation SettingsWindow
6
7 - (void)applicationDidFinishLaunching:(NSNotification *)val
8 {
9 [myWindow makeKeyAndOrderFront:self];
10 [NSApp activateIgnoringOtherApps:YES];
11 }
12
13 // @@@ don't need this right now as the nib is connected to terminate
14 - (void)cancel:(id)sender
15 {
16
17 }
18
19 - (void)ok:(id)sender
20 {
21 int status;
22 char commandLine[256];
23
24 strcpy(commandLine, "/System/Library/StartupItems/SecurityServer/enable ");
25 strcat(commandLine, (securityOnOffSetting ? "no" : "yes"));
26
27 status=system(commandLine);
28 if ( status )
29 {
30 NSRunAlertPanel(@"Alert", @"Error executing the enable component.\nSecurity settings not changed.", @"OK", nil, nil, nil);
31 }
32
33
34 [[NSApplication sharedApplication] terminate:self];
35
36 }
37
38 - (void)securityOnOff:(id)sender
39 {
40 switch ([sender selectedRow])
41 {
42 case 0: securityOnOffSetting = 0;
43 break;
44 case 1: securityOnOffSetting = 1;
45 break;
46 }
47 }
48
49
50
51
52
53 @end