Revision 3a8071d4 Classes/ErrorAlerter.m

b/Classes/ErrorAlerter.m
15 15

  
16 16
@implementation ErrorAlerter
17 17

  
18
@synthesize failedRequest, logEntryModalViewController, viewController;
19

  
18 20
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
19 21
    if (buttonIndex == 1) { // details button
20 22
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
21
            logEntryModalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
23
            self.logEntryModalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
22 24
        }                
23
        [viewController presentModalViewController:logEntryModalViewController animated:YES];
24
        [logEntryModalViewController release];
25
        [self.viewController presentModalViewController:self.logEntryModalViewController animated:YES];
25 26
    }
26 27
}
27 28

  
28 29
- (void)alert:(NSString *)message request:(OpenStackRequest *)request viewController:(UIViewController *)aViewController {
29 30
    
30
    viewController = aViewController;
31
    self.viewController = aViewController;
31 32

  
32 33
    NSString *title = @"Error";
33 34
    if (request.responseStatusCode == 0) {
......
35 36
        message = @"Please check your connection or API URL and try again.";
36 37
    }
37 38

  
38
    logEntryModalViewController = [[LogEntryModalViewController alloc] initWithNibName:@"LogEntryModalViewController" bundle:nil];
39
    logEntryModalViewController.logEntry = [[[APILogEntry alloc] initWithRequest:request] autorelease];
40
    logEntryModalViewController.requestDescription = [logEntryModalViewController.logEntry requestDescription];
41
    logEntryModalViewController.responseDescription = [logEntryModalViewController.logEntry responseDescription];
42
    logEntryModalViewController.requestMethod = [logEntryModalViewController.logEntry requestMethod];
43
    logEntryModalViewController.url = [[logEntryModalViewController.logEntry url] description];
39
    self.logEntryModalViewController = [[LogEntryModalViewController alloc] initWithNibName:@"LogEntryModalViewController" bundle:nil];
40
    self.logEntryModalViewController.logEntry = [[[APILogEntry alloc] initWithRequest:request] autorelease];
41
    self.logEntryModalViewController.requestDescription = [logEntryModalViewController.logEntry requestDescription];
42
    self.logEntryModalViewController.responseDescription = [logEntryModalViewController.logEntry responseDescription];
43
    self.logEntryModalViewController.requestMethod = [logEntryModalViewController.logEntry requestMethod];
44
    self.logEntryModalViewController.url = [[logEntryModalViewController.logEntry url] description];
44 45
    
45 46
    // present an alert with a Details button to show the API log entry
46 47
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Details", nil];
......
48 49
    [alert release];        
49 50
}
50 51

  
52
- (void)dealloc {
53
    [failedRequest release];
54
    [logEntryModalViewController release];
55
    [viewController release];
56
    [super dealloc];
57
}
58

  
51 59

  
52 60
@end

Also available in: Unified diff