1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
/*
* Copyright (c) 2016, Jonathan Schleifer <js@heap.zone>
* Copyright (c) 2016, 2017, Jonathan Schleifer <js@heap.zone>
*
* https://heap.zone/git/scrypt-pwgen.git
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice is present in all copies.
*
|
︙ | | |
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
+
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#import <ObjFW_Bridge/ObjFW_Bridge.h>
#import "AddSiteController.h"
#import "SelectKeyFileController.h"
static void
showAlert(UIViewController *controller, NSString *title, NSString *message)
{
UIAlertController *alert = [UIAlertController
alertControllerWithTitle: title
message: message
|
︙ | | |
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
|
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
|
+
-
+
+
-
-
-
-
-
|
@implementation AddSiteController
- (void)dealloc
{
[_nameField release];
[_lengthField release];
[_legacySwitch release];
[_keyFile 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];
[self performSegueWithIdentifier: @"selectKeyFile"
sender: self];
}
- (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;
|
︙ | | |
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
-
+
+
+
+
+
+
+
+
|
@"Please pick a name that does not exist yet.");
return;
}
[self.mainViewController.siteStorage setSite: name
length: length
legacy: self.legacySwitch.on
keyFile: nil];
keyFile: self.keyFile.OFObject];
[self.mainViewController reset];
[self.navigationController popViewControllerAnimated: YES];
}
- (IBAction)cancel: (id)sender
{
[self.navigationController popViewControllerAnimated: YES];
}
- (void)prepareForSegue: (UIStoryboardSegue *)segue
sender: (id)sender
{
if ([segue.identifier isEqual: @"selectKeyFile"])
[segue.destinationViewController setAddSiteController: self];
}
@end
|