43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
@implementation AddSiteController
- (void)dealloc
{
[_nameField release];
[_lengthField release];
[_legacySwitch release];
[_keyFileLabel release];
[_mainViewController release];
[super dealloc];
}
- (void)tableView: (UITableView *)tableView
didSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath: indexPath
animated: YES];
if (indexPath.section == 1 && indexPath.row == 1)
[self selectKeyFile];
}
- (NSIndexPath *)tableView: (UITableView *)tableView
willSelectRowAtIndexPath: (NSIndexPath *)indexPath
{
if (indexPath.section == 1 && indexPath.row == 1)
return indexPath;
return nil;
}
- (void)selectKeyFile
{
showAlert(self, @"Not Supported", @"Key files are not supported yet");
}
- (IBAction)done: (id)sender
{
OFString *name = self.nameField.text.OFObject;
OFString *lengthString = self.lengthField.text.OFObject;
bool lengthValid = true;
size_t length;
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
-
+
+
|
showAlert(self, @"Site Already Exists",
@"Please pick a name that does not exist yet.");
return;
}
[self.mainViewController.siteStorage setSite: name
length: length
legacy: self.legacySwitch.on];
legacy: self.legacySwitch.on
keyFile: nil];
[self.mainViewController reset];
[self.navigationController popViewControllerAnimated: YES];
}
- (IBAction)cancel: (id)sender
{
[self.navigationController popViewControllerAnimated: YES];
}
@end
|