-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreferencesController.m
executable file
·93 lines (73 loc) · 1.71 KB
/
PreferencesController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// PreferencesController.m
// LabStatus
//
// Created by Christian Pape on 07.10.08.
// Copyright 2008 cc-productions. All rights reserved.
//
#import "PreferencesController.h"
#import "Host.h"
@implementation PreferencesController
- (id)init
{
if (![super initWithWindowNibName:@"PreferencesPanel"])
return nil;
if (!preferences) {
preferences = [[Preferences alloc] init];
}
hosts = [preferences hosts];
indicators = [preferences indicators];
actions = [preferences actions];
progress = [preferences progress];
return self;
}
- (void)setHosts:(NSMutableArray*)a
{
hosts = a;
}
- (void)setIndicators:(NSMutableArray*)a
{
indicators = a;
}
- (void)setActions:(NSMutableArray*)a
{
actions = a;
}
- (void)windowWillClose:(NSNotification *)notification
{
[preferences setHosts:hosts];
[preferences setIndicators:indicators];
[preferences setActions:actions];
[preferences setProgress:progress];
[NSApp stopModal];
}
- (IBAction) showPasswordSheet:(id)sender
{
[NSApp beginSheet:passwordSheet
modalForWindow:[self window]
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL];
}
- (IBAction) cancelPasswordSheet:(id)sender
{
[NSApp endSheet:passwordSheet];
[passwordSheet orderOut:sender];
}
- (IBAction) confirmPasswordSheet:(id)sender
{
[NSApp endSheet:passwordSheet];
[passwordSheet orderOut:sender];
NSString *username = [usernameTextField stringValue];
NSString *password = [passwordTextField stringValue];
NSEnumerator * enumeratorHosts = [hosts objectEnumerator];
Host* host;
int h = 0;
while(host = [enumeratorHosts nextObject])
{
[host setUsername:username];
[host setPassword:password];
h++;
}
}
@end