if ([request_ HTTPBody] == nil && [request_ HTTPBodyStream] == nil)
[self loadRequest:request_];
else {
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("RESUBMIT_FORM")
- buttons:[NSArray arrayWithObjects:UCLocalize("CANCEL"), UCLocalize("SUBMIT"), nil]
- defaultButtonIndex:0
+ message:nil
delegate:self
- context:@"submit"
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("SUBMIT"), nil
] autorelease];
-
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setNumberOfRows:1];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"submit"];
+ [alert show];
}
}
- (void) _promptForSensitive:(NSMutableArray *)array {
NSString *name([array objectAtIndex:0]);
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:nil
- buttons:[NSArray arrayWithObjects:UCLocalize("YES"), UCLocalize("NO"), nil]
- defaultButtonIndex:0
+ message:nil
delegate:indirect_
- context:@"sensitive"
+ cancelButtonTitle:UCLocalize("NO")
+ otherButtonTitles:UCLocalize("YES"), nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
NSString *host(@"XXX");
- [sheet setNumberOfRows:1];
- [sheet setBodyText:[NSString stringWithFormat:@"The website at %@ is requesting your phone's %@. This is almost certainly for product licensing purposes. Will you allow this?", host, name]];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"sensitive"];
+ [alert setMessage:[NSString stringWithFormat:@"The website at %@ is requesting your phone's %@. This is almost certainly for product licensing purposes. Will you allow this?", host, name]];
+ [alert show];
NSRunLoop *loop([NSRunLoop currentRunLoop]);
NSDate *future([NSDate distantFuture]);
return;
[self retain];
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:nil
- buttons:[NSArray arrayWithObjects:UCLocalize("OK"), nil]
- defaultButtonIndex:0
+ message:message
delegate:self
- context:@"alert"
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
] autorelease];
-
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setBodyText:message];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"alert"];
+ [alert show];
}
- (BOOL) webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
return NO;
[self retain];
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:nil
- buttons:[NSArray arrayWithObjects:UCLocalize("OK"), UCLocalize("CANCEL"), nil]
- defaultButtonIndex:0
+ message:message
delegate:indirect_
- context:@"confirm"
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("OK"), nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setNumberOfRows:1];
- [sheet setBodyText:message];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"confirm"];
+ [alert show];
NSRunLoop *loop([NSRunLoop currentRunLoop]);
NSDate *future([NSDate distantFuture]);
//lprintf("Status:%s\n", [text UTF8String]);
}
-- (void) alertSheet:(UIActionSheet *)sheet buttonClicked:(int)button {
- NSString *context([sheet context]);
+- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button {
+ NSString *context([alert context]);
if ([context isEqualToString:@"alert"]) {
[self autorelease];
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
} else if ([context isEqualToString:@"confirm"]) {
switch (button) {
case 1:
break;
}
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
} else if ([context isEqualToString:@"sensitive"]) {
switch (button) {
case 1:
break;
}
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
} else if ([context isEqualToString:@"challenge"]) {
id<NSURLAuthenticationChallengeSender> sender([challenge_ sender]);
switch (button) {
case 1: {
- NSString *username([[sheet textFieldAtIndex:0] text]);
- NSString *password([[sheet textFieldAtIndex:1] text]);
+ NSString *username([[alert textFieldAtIndex:0] text]);
+ NSString *password([[alert textFieldAtIndex:1] text]);
NSURLCredential *credential([NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession]);
[challenge_ release];
challenge_ = nil;
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
} else if ([context isEqualToString:@"submit"]) {
switch (button) {
case 1:
_nodefault
}
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
}
}
if (realm == nil)
realm = @"";
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:realm
- buttons:[NSArray arrayWithObjects:UCLocalize("LOGIN"), UCLocalize("CANCEL"), nil]
- defaultButtonIndex:0
+ message:nil
delegate:self
- context:@"challenge"
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("LOGIN"), nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setNumberOfRows:1];
+ [alert setContext:@"challenge"];
+ [alert setNumberOfRows:1];
- [sheet addTextFieldWithValue:@"" label:UCLocalize("USERNAME")];
- [sheet addTextFieldWithValue:@"" label:UCLocalize("PASSWORD")];
+ [alert addTextFieldWithValue:@"" label:UCLocalize("USERNAME")];
+ [alert addTextFieldWithValue:@"" label:UCLocalize("PASSWORD")];
- UITextField *username([sheet textFieldAtIndex:0]); {
+ UITextField *username([alert textFieldAtIndex:0]); {
UITextInputTraits *traits([username textInputTraits]);
[traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[traits setAutocorrectionType:UITextAutocorrectionTypeNo];
[traits setReturnKeyType:UIReturnKeyNext];
}
- UITextField *password([sheet textFieldAtIndex:1]); {
+ UITextField *password([alert textFieldAtIndex:1]); {
UITextInputTraits *traits([password textInputTraits]);
[traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[traits setAutocorrectionType:UITextAutocorrectionTypeNo];
[traits setSecureTextEntry:YES];
}
- [sheet popupAlertAnimated:YES];
+ [alert show];
}
- (NSURLRequest *) webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)source {