summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorGrant Paul <chpwn@chpwn.com>2010-08-10 17:39:04 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 08:21:36 +0000
commit0fe9a7e80efcdd1d938e16a0bd7d55a83f573d51 (patch)
tree599158f31a0ebfabbed569fc75e1bda4335c38a6 /Cydia.mm
parentbe2b3d7b4fdbf477e754aa8e0b12a5d34551b303 (diff)
Commit (chpwn): good-bye-uiactionsheet.patch
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm89
1 files changed, 42 insertions, 47 deletions
diff --git a/Cydia.mm b/Cydia.mm
index 86ddb4a..f792200 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -5879,47 +5879,41 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (NSString *warning = [self yieldToSelector:@selector(getWarning)]) {
defer = true;
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("SOURCE_WARNING")
- buttons:[NSArray arrayWithObjects:UCLocalize("ADD_ANYWAY"), UCLocalize("CANCEL"), nil]
- defaultButtonIndex:0
- delegate:self
- context:@"warning"
+ message:warning
+ delegate:self
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("ADD_ANYWAY"), nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setNumberOfRows:1];
- [sheet setBodyText:warning];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"warning"];
+ [alert setNumberOfRows:1];
+ [alert show];
} else
[self complete];
} else if (error_ != nil) {
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("VERIFICATION_ERROR")
- buttons:[NSArray arrayWithObjects:UCLocalize("OK"), nil]
- defaultButtonIndex:0
- delegate:self
- context:@"urlerror"
+ message:[error_ localizedDescription]
+ delegate:self
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setBodyText:[error_ localizedDescription]];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"urlerror"];
+ [alert show];
} else {
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("NOT_REPOSITORY")
- buttons:[NSArray arrayWithObjects:UCLocalize("OK"), nil]
- defaultButtonIndex:0
- delegate:self
- context:@"trivial"
+ message:UCLocalize("NOT_REPOSITORY_EX")
+ delegate:self
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setBodyText:UCLocalize("NOT_REPOSITORY_EX")];
- [sheet popupAlertAnimated:YES];
+ [alert setContext:@"trivial"];
+ [alert show];
}
[delegate_ setStatusBarShowsProgress:NO];
@@ -5977,13 +5971,13 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
return [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];
}
-- (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:@"source"]) {
switch (button) {
case 1: {
- NSString *href = [[sheet textField] text];
+ NSString *href = [[alert textField] text];
//installer_ = [[self _requestHRef:href method:@"GET"] retain];
@@ -6004,24 +5998,24 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[hud_ setText:UCLocalize("VERIFYING_URL")];
} break;
- case 2:
+ case 0:
break;
_nodefault
}
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
} else if ([context isEqualToString:@"trivial"])
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
else if ([context isEqualToString:@"urlerror"])
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
else if ([context isEqualToString:@"warning"]) {
switch (button) {
case 1:
[self complete];
break;
- case 2:
+ case 0:
break;
_nodefault
@@ -6030,7 +6024,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[href_ release];
href_ = nil;
- [sheet dismiss];
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
}
}
@@ -6095,27 +6089,28 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
database:database_
] autorelease]];*/
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("ENTER_APT_URL")
- buttons:[NSArray arrayWithObjects:UCLocalize("ADD_SOURCE"), UCLocalize("CANCEL"), nil]
- defaultButtonIndex:0
- delegate:self
- context:@"source"
+ message:nil
+ delegate:self
+ cancelButtonTitle:UCLocalize("CANCEL")
+ otherButtonTitles:UCLocalize("ADD_SOURCE"), nil
] autorelease];
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+ [alert setContext:@"source"];
+ [alert setTransform:CGAffineTransformTranslate([alert transform], 0.0, 100.0)];
- [sheet setNumberOfRows:1];
- [sheet addTextFieldWithValue:@"http://" label:@""];
+ [alert setNumberOfRows:1];
+ [alert addTextFieldWithValue:@"http://" label:@""];
- UITextInputTraits *traits = [[sheet textField] textInputTraits];
+ UITextInputTraits *traits = [[alert textField] textInputTraits];
[traits setAutocapitalizationType:UITextAutocapitalizationTypeNone];
[traits setAutocorrectionType:UITextAutocorrectionTypeNo];
[traits setKeyboardType:UIKeyboardTypeURL];
// XXX: UIReturnKeyDone
[traits setReturnKeyType:UIReturnKeyNext];
- [sheet popupAlertAnimated:YES];
+ [alert show];
}
- (void) _rightButtonClicked {