summaryrefslogtreecommitdiff
path: root/Cydia.mm
diff options
context:
space:
mode:
authorGrant Paul <chpwn@chpwn.com>2010-08-10 17:37:22 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 08:21:30 +0000
commit969eaf2fc7d6cc51eca971d69872f0b5dc46decd (patch)
tree4839d2064b5c5fbe4ec7a6ca4429e89bcd76d51c /Cydia.mm
parent0853e8ff72237a2f54ebec36156ddb4a028f19bd (diff)
Commit (chpwn): conffile-alert.patch
Diffstat (limited to 'Cydia.mm')
-rw-r--r--Cydia.mm51
1 files changed, 19 insertions, 32 deletions
diff --git a/Cydia.mm b/Cydia.mm
index ca7cd6b..a6860c9 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -4373,25 +4373,16 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[transition_ transition:6 toView:view_];
}
-- (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:@"conffile"]) {
- FILE *input = [database_ input];
-
- switch (button) {
- case 1:
- fprintf(input, "N\n");
- fflush(input);
- break;
- case 2:
- fprintf(input, "Y\n");
- fflush(input);
- break;
- _nodefault
- }
-
- [sheet dismiss];
+ FILE *input = [database_ input];
+ if (button == [alert cancelButtonIndex]) fprintf(input, "N\n");
+ else if (button == [alert firstOtherButtonIndex]) fprintf(input, "Y\n");
+ fflush(input);
+
+ [alert dismissWithClickedButtonIndex:-1 animated:YES];
}
}
@@ -4612,22 +4603,18 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
NSString *ofile = conffile_r[1];
//NSString *nfile = conffile_r[2];
- UIActionSheet *sheet = [[[UIActionSheet alloc]
+ UIAlertView *alert = [[[UIAlertView alloc]
initWithTitle:UCLocalize("CONFIGURATION_UPGRADE")
- buttons:[NSArray arrayWithObjects:
- UCLocalize("KEEP_OLD_COPY"),
- UCLocalize("ACCEPT_NEW_COPY"),
- // XXX: UCLocalize("SEE_WHAT_CHANGED"),
- nil]
- defaultButtonIndex:0
- delegate:self
- context:@"conffile"
- ] autorelease];
-
- [sheet setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
-
- [sheet setBodyText:[NSString stringWithFormat:@"%@\n\n%@", UCLocalize("CONFIGURATION_UPGRADE_EX"), ofile]];
- [sheet popupAlertAnimated:YES];
+ message:[NSString stringWithFormat:@"%@\n\n%@", UCLocalize("CONFIGURATION_UPGRADE_EX"), ofile]
+ delegate:self
+ cancelButtonTitle:UCLocalize("KEEP_OLD_COPY")
+ otherButtonTitles:UCLocalize("ACCEPT_NEW_COPY"),
+ // XXX: UCLocalize("SEE_WHAT_CHANGED"),
+ nil
+ ] autorelease];
+
+ [alert setContext:@"conffile"];
+ [alert show];
}
- (void) _setProgressTitle:(NSString *)title {