-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKeyPanelController.j
46 lines (38 loc) · 1.01 KB
/
KeyPanelController.j
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
// (c) 2010-2011 by Anton Korenyushkin
@import "TextView.j"
@import "RequestPanelController.j"
@implementation KeyPanelController : RequestPanelController
{
@outlet TextView keyTextView;
CPString keyValue;
}
- (id)init // public
{
return [super initWithWindowCibName:"KeyPanel"];
}
- (void)awakeFromCib // private
{
[keyTextView setEditable:NO];
}
- (void)showWindow:(id)sender // public
{
[super showWindow:sender];
if (keyValue) {
[keyTextView setStringValue:keyValue];
} else {
[keyTextView setStringValue:""];
[self requestWithMethod:"GET" URL:"/rsa.pub"];
}
}
- (void)didReceiveResponse:(CPString)data // protected
{
keyValue = data;
[keyTextView setStringValue:keyValue];
}
- (void)observeValueForKeyPath:(CPString)keyPath ofObject:(id)object change:(CPDictionary)change context:(id)context // protected
{
if (keyPath == "username")
keyValue = nil;
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
@end