summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2009-03-16 15:12:33 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:09:56 +0000
commitdc63e78f274cc5733250b137b1ad09ea248445ff (patch)
treea282d1bba36cf9a444a8e1f8550e1d268abe0b25
parente590d1ff0e28b577012d6d98d9600d2f86a7459f (diff)
That was at least interesting.
-rw-r--r--Cydia.app/Modes/Downgrade.pngbin0 -> 1176 bytes
-rw-r--r--Cydia.app/Modes/Install.pngbin0 -> 2135 bytes
l---------Cydia.app/Modes/New Install.png1
-rw-r--r--Cydia.app/Modes/Purge.pngbin0 -> 2443 bytes
-rw-r--r--Cydia.app/Modes/Reinstall.pngbin0 -> 2013 bytes
-rw-r--r--Cydia.app/Modes/Remove.pngbin0 -> 2552 bytes
-rw-r--r--Cydia.app/Modes/Upgrade.pngbin0 -> 1635 bytes
-rw-r--r--Cydia.app/package.html8
-rw-r--r--Cydia.app/package.js26
-rw-r--r--Cydia.mm178
-rw-r--r--UICaboodle/BrowserView.m16
-rw-r--r--UICaboodle/RVBook.mm10
-rw-r--r--control2
13 files changed, 216 insertions, 25 deletions
diff --git a/Cydia.app/Modes/Downgrade.png b/Cydia.app/Modes/Downgrade.png
new file mode 100644
index 0000000..41c0d70
--- /dev/null
+++ b/Cydia.app/Modes/Downgrade.png
Binary files differ
diff --git a/Cydia.app/Modes/Install.png b/Cydia.app/Modes/Install.png
new file mode 100644
index 0000000..a83f354
--- /dev/null
+++ b/Cydia.app/Modes/Install.png
Binary files differ
diff --git a/Cydia.app/Modes/New Install.png b/Cydia.app/Modes/New Install.png
new file mode 120000
index 0000000..3330a1b
--- /dev/null
+++ b/Cydia.app/Modes/New Install.png
@@ -0,0 +1 @@
+Install.png \ No newline at end of file
diff --git a/Cydia.app/Modes/Purge.png b/Cydia.app/Modes/Purge.png
new file mode 100644
index 0000000..795fa19
--- /dev/null
+++ b/Cydia.app/Modes/Purge.png
Binary files differ
diff --git a/Cydia.app/Modes/Reinstall.png b/Cydia.app/Modes/Reinstall.png
new file mode 100644
index 0000000..0b7754c
--- /dev/null
+++ b/Cydia.app/Modes/Reinstall.png
Binary files differ
diff --git a/Cydia.app/Modes/Remove.png b/Cydia.app/Modes/Remove.png
new file mode 100644
index 0000000..1b2e691
--- /dev/null
+++ b/Cydia.app/Modes/Remove.png
Binary files differ
diff --git a/Cydia.app/Modes/Upgrade.png b/Cydia.app/Modes/Upgrade.png
new file mode 100644
index 0000000..631b7ef
--- /dev/null
+++ b/Cydia.app/Modes/Upgrade.png
Binary files differ
diff --git a/Cydia.app/package.html b/Cydia.app/package.html
index 4dc34a8..fdbc835 100644
--- a/Cydia.app/package.html
+++ b/Cydia.app/package.html
@@ -213,6 +213,14 @@
</div>
</fieldset>
+<fieldset class="mode">
+ <a>
+ <img class="icon" id="mode-src"/><div>
+ <label>Package Queue</label>
+ <label id="mode"></label>
+ </div></a>
+</fieldset>
+
<fieldset id="actions">
<a id="settings">
<img class="icon" src="settings.png"/><div>
diff --git a/Cydia.app/package.js b/Cydia.app/package.js
index 200be8b..1a78a8b 100644
--- a/Cydia.app/package.js
+++ b/Cydia.app/package.js
@@ -53,12 +53,15 @@ $(function () {
var id = package.id;
var idc = encodeURIComponent(id);
var name = package.name;
- var regarding = encodeURIComponent("Cydia/APT: " + name);
var icon = 'cydia://package-icon/' + idc;
var api = 'http://cydia.saurik.com/api/';
+ var regarding = function (type) {
+ return encodeURIComponent("Cydia/APT(" + type + "): " + name);
+ };
+
$("#icon").css("background-image", 'url("' + icon + '")');
- $("#reflection").src("cydia://package-icon/" + idc);
+ //$("#reflection").src("cydia://package-icon/" + idc);
$("#name").html(name);
space("#latest", package.latest, 96);
@@ -110,6 +113,14 @@ $(function () {
$("#settings").href("cydia://package-settings/" + idc);
+ var mode = package.mode;
+ if (mode == null)
+ $(".mode").remove();
+ else {
+ $("#mode").html(mode);
+ $("#mode-src").src("Modes/" + mode + ".png");
+ }
+
var warnings = package.warnings;
var length = warnings == null ? 0 : warnings.length;
if (length == 0)
@@ -160,8 +171,13 @@ $(function () {
space("#author", author.name, 160);
if (author.address == null)
$("#author-icon").remove();
- else
- $("#author-href").href("mailto:" + author.address + "?subject=" + regarding);
+ else {
+ var support = package.support;
+ if (support == null)
+ $("#author-href").href("mailto:" + author.address + "?subject=" + regarding("A"));
+ else
+ $("#author-href").href(support);
+ }
}
//$("#notice-src").src("http://saurik.cachefly.net/notice/" + idc + ".html");
@@ -227,7 +243,7 @@ $(function () {
if (maintainer.address == null)
$("#maintainer-icon").remove();
else
- $("#maintainer-href").href("mailto:" + maintainer.address + "?subject=" + regarding);
+ $("#maintainer-href").href("mailto:" + maintainer.address + "?subject=" + regarding("M"));
}
var sponsor = package.sponsor;
diff --git a/Cydia.mm b/Cydia.mm
index 5e9d33a..eecc2be 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -659,6 +659,8 @@ class Pcre {
- (NSString *) name;
- (NSString *) address;
+- (void) setAddress:(NSString *)address;
+
+ (Address *) addressWithString:(NSString *)string;
- (Address *) initWithString:(NSString *)string;
@end
@@ -680,6 +682,15 @@ class Pcre {
return address_;
}
+- (void) setAddress:(NSString *)address {
+ if (address_ != nil)
+ [address_ autorelease];
+ if (address == nil)
+ address_ = nil;
+ else
+ address_ = [address retain];
+}
+
+ (Address *) addressWithString:(NSString *)string {
return [[[Address alloc] initWithString:string] autorelease];
}
@@ -764,6 +775,8 @@ static const float KeyboardTime_ = 0.3f;
#define SandboxTemplate_ "/usr/share/sandbox/SandboxTemplate.sb"
#define NotifyConfig_ "/etc/notify.conf"
+static bool Queuing_;
+
static CGColor Blue_;
static CGColor Blueish_;
static CGColor Black_;
@@ -774,7 +787,8 @@ static CGColor Green_;
static CGColor Purple_;
static CGColor Purplish_;
-static UIColor *CommercialColor_;
+static UIColor *InstallingColor_;
+static UIColor *RemovingColor_;
static NSString *App_;
static NSString *Home_;
@@ -917,6 +931,7 @@ bool isSectionVisible(NSString *section) {
@end
@protocol CydiaDelegate
+- (void) clearPackage:(Package *)package;
- (void) installPackage:(Package *)package;
- (void) removePackage:(Package *)package;
- (void) slideUp:(UIActionSheet *)alert;
@@ -1102,6 +1117,7 @@ class Progress :
NSString *description_;
NSString *label_;
NSString *origin_;
+ NSString *support_;
NSString *uri_;
NSString *distribution_;
@@ -1118,6 +1134,8 @@ class Progress :
- (NSComparisonResult) compareByNameAndType:(Source *)source;
+- (NSString *) supportForPackage:(NSString *)package;
+
- (NSDictionary *) record;
- (BOOL) trusted;
@@ -1152,6 +1170,7 @@ class Progress :
_clear(description_)
_clear(label_)
_clear(origin_)
+ _clear(support_)
_clear(version_)
_clear(defaultIcon_)
_clear(record_)
@@ -1205,6 +1224,8 @@ class Progress :
label_ = [[NSString stringWithUTF8String:value.c_str()] retain];
else if (name == "Origin")
origin_ = [[NSString stringWithUTF8String:value.c_str()] retain];
+ else if (name == "Support")
+ support_ = [[NSString stringWithUTF8String:value.c_str()] retain];
else if (name == "Version")
version_ = [[NSString stringWithUTF8String:value.c_str()] retain];
}
@@ -1244,6 +1265,10 @@ class Progress :
return [lhs compare:rhs options:LaxCompareOptions_];
}
+- (NSString *) supportForPackage:(NSString *)package {
+ return support_ == nil ? nil : [support_ stringByReplacingOccurrencesOfString:@"*" withString:package];
+}
+
- (NSDictionary *) record {
return record_;
}
@@ -1359,6 +1384,7 @@ class Progress :
NSString *homepage_;
Address *sponsor_;
Address *author_;
+ NSString *support_;
NSArray *tags_;
NSString *role_;
@@ -1409,6 +1435,8 @@ class Progress :
- (NSString *) depiction;
- (Address *) author;
+- (NSString *) support;
+
- (NSArray *) files;
- (NSArray *) relationships;
- (NSArray *) warnings;
@@ -1466,6 +1494,8 @@ class Progress :
[sponsor_ release];
if (author_ != nil)
[author_ release];
+ if (support_ != nil)
+ [support_ release];
if (tags_ != nil)
[tags_ release];
if (role_ != nil)
@@ -1489,7 +1519,7 @@ class Progress :
}
+ (NSArray *) _attributeKeys {
- return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"purposes", @"section", @"size", @"source", @"sponsor", @"tagline", @"warnings", nil];
+ return [NSArray arrayWithObjects:@"applications", @"author", @"depiction", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"mode", @"name", @"purposes", @"section", @"size", @"source", @"sponsor", @"support", @"tagline", @"warnings", nil];
}
- (NSArray *) attributeKeys {
@@ -1572,6 +1602,7 @@ class Progress :
{"depiction", &depiction_},
{"homepage", &homepage_},
{"website", &website},
+ {"support", &support_},
{"sponsor", &sponsor},
{"author", &author},
{"tag", &tag},
@@ -1888,14 +1919,16 @@ class Progress :
else
return @"Remove";
case pkgDepCache::ModeKeep:
- if ((state.iFlags & pkgDepCache::AutoKept) != 0)
- return nil;
+ if ((state.iFlags & pkgDepCache::ReInstall) != 0)
+ return @"Reinstall";
+ /*else if ((state.iFlags & pkgDepCache::AutoKept) != 0)
+ return nil;*/
else
return nil;
case pkgDepCache::ModeInstall:
- if ((state.iFlags & pkgDepCache::ReInstall) != 0)
+ /*if ((state.iFlags & pkgDepCache::ReInstall) != 0)
return @"Reinstall";
- else switch (state.Status) {
+ else*/ switch (state.Status) {
case -1:
return @"Downgrade";
case 0:
@@ -1957,6 +1990,10 @@ class Progress :
return author_;
}
+- (NSString *) support {
+ return support_ != nil ? support_ : [[self source] supportForPackage:id_];
+}
+
- (NSArray *) files {
NSString *path = [NSString stringWithFormat:@"/var/lib/dpkg/info/%@.list", id_];
NSMutableArray *files = [NSMutableArray arrayWithCapacity:128];
@@ -2200,6 +2237,12 @@ class Progress :
return _not(uint32_t) - value.key;
}
+- (void) clear {
+ pkgProblemResolver *resolver = [database_ resolver];
+ resolver->Clear(iterator_);
+ resolver->Protect(iterator_);
+}
+
- (void) install {
pkgProblemResolver *resolver = [database_ resolver];
resolver->Clear(iterator_);
@@ -2996,6 +3039,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@protocol ConfirmationViewDelegate
- (void) cancel;
- (void) confirm;
+- (void) queue;
@end
@interface ConfirmationView : BrowserView {
@@ -3735,6 +3779,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
NSString *source_;
UIImage *badge_;
bool cached_;
+ Package *package_;
#ifdef USE_BADGES
UITextLabel *status_;
#endif
@@ -3774,6 +3819,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[badge_ release];
badge_ = nil;
}
+
+ [package_ release];
+ package_ = nil;
}
- (void) dealloc {
@@ -3806,6 +3854,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
description_ = [[package tagline] retain];
commercial_ = [package isCommercial];
+ package_ = [package retain];
+
NSString *label = nil;
bool trusted = false;
@@ -3851,7 +3901,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) drawRect:(CGRect)rect {
if (!cached_) {
- //[self setBackgroundColor:(commercial_ ? CommercialColor_ : [UIColor whiteColor])];
+ UIColor *color;
+
+ if (NSString *mode = [package_ mode]) {
+ bool remove([mode isEqualToString:@"Remove"] || [mode isEqualToString:@"Purge"]);
+ color = remove ? RemovingColor_ : InstallingColor_;
+ } else
+ color = [UIColor whiteColor];
+
+ [self setBackgroundColor:color];
cached_ = true;
}
@@ -3859,7 +3917,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) drawBackgroundInRect:(CGRect)rect withFade:(float)fade {
- if (fade == 0 && commercial_) {
+ if (fade == 0) {
CGContextRef context(UIGraphicsGetCurrentContext());
[[self backgroundColor] set];
CGRect back(rect);
@@ -3908,6 +3966,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[super drawContentInRect:rect selected:selected];
}
+- (void) setSelected:(BOOL)selected withFade:(BOOL)fade {
+ cached_ = false;
+ [super setSelected:selected withFade:fade];
+}
+
+ (int) heightForPackage:(Package *)package {
NSString *tagline([package tagline]);
int height = tagline == nil || [tagline length] == 0 ? -17 : 0;
@@ -4191,7 +4254,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) _clickButtonWithName:(NSString *)name {
- if ([name isEqualToString:@"Install"])
+ if ([name isEqualToString:@"Clear"])
+ [delegate_ clearPackage:package_];
+ else if ([name isEqualToString:@"Install"])
[delegate_ installPackage:package_];
else if ([name isEqualToString:@"Reinstall"])
[delegate_ installPackage:package_];
@@ -4246,7 +4311,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[delegate_ slideUp:[[[UIActionSheet alloc]
initWithTitle:nil
buttons:buttons
- defaultButtonIndex:2
+ defaultButtonIndex:([buttons count] - 1)
delegate:self
context:@"modify"
] autorelease]];
@@ -4297,6 +4362,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[self loadURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"package" ofType:@"html"]]];
+ if ([package_ mode] != nil)
+ [buttons_ addObject:@"Clear"];
if ([package_ source] == nil);
else if ([package_ upgradableAndEssential:NO])
[buttons_ addObject:@"Upgrade"];
@@ -5224,7 +5291,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
#if !AlwaysReload
- (id) _rightButtonTitle {
- return nil;
+ return Queuing_ ? @"Queue" : nil;
+}
+
+- (UINavigationButtonStyle) rightButtonStyle {
+ return Queuing_ ? UINavigationButtonStyleHighlighted : UINavigationButtonStyleNormal;
+}
+
+- (void) _rightButtonClicked {
+ [delegate_ queue];
}
#endif
@@ -5950,10 +6025,17 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (section == nil || last != seen && (seen == nil || [seen compare:last] != NSOrderedSame)) {
last = seen;
- NSString *name(seen == nil ? [@"n/a ?" retain] : (NSString *) CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) seen));
+ NSString *name;
+ if (seen == nil)
+ name = @"unknown?";
+ else {
+ name = (NSString *) CFDateFormatterCreateStringWithDate(NULL, formatter, (CFDateRef) seen);
+ [name autorelease];
+ }
+
+ name = [@"New at " stringByAppendingString:name];
section = [[[Section alloc] initWithName:name row:offset] autorelease];
[sections_ addObject:section];
- [name release];
}
[section addToCount];
@@ -6600,7 +6682,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
NSString *badge([[NSNumber numberWithInt:changes] stringValue]);
[buttonbar_ setBadgeValue:badge forButton:3];
if ([buttonbar_ respondsToSelector:@selector(setBadgeAnimated:forButton:)])
- [buttonbar_ setBadgeAnimated:YES forButton:3];
+ [buttonbar_ setBadgeAnimated:([essential_ count] != 0) forButton:3];
[self setApplicationBadge:badge];
} else {
[buttonbar_ setBadgeValue:nil forButton:3];
@@ -6609,6 +6691,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[self removeApplicationBadge];
}
+ Queuing_ = false;
+ [buttonbar_ setBadgeValue:nil forButton:4];
+
[self updateData];
// XXX: what is this line of code for?
@@ -6719,6 +6804,20 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[self popUpBook:confirm_];
}
+- (void) queue {
+ @synchronized (self) {
+ [self perform];
+ }
+}
+
+- (void) clearPackage:(Package *)package {
+ @synchronized (self) {
+ [package clear];
+ [self resolve];
+ [self perform];
+ }
+}
+
- (void) installPackage:(Package *)package {
@synchronized (self) {
[package install];
@@ -6743,8 +6842,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) cancel {
+ [self slideUp:[[[UIActionSheet alloc]
+ initWithTitle:nil
+ buttons:[NSArray arrayWithObjects:@"Continue Queuing", @"Cancel and Clear", nil]
+ defaultButtonIndex:1
+ delegate:self
+ context:@"cancel"
+ ] autorelease]];
+}
+
+- (void) complete {
@synchronized (self) {
[self _reloadData];
+
if (confirm_ != nil) {
[confirm_ release];
confirm_ = nil;
@@ -6786,7 +6896,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[confirm_ popFromSuperviewAnimated:NO];
}
- [self cancel];
+ [self complete];
}
- (void) setPage:(RVPage *)page {
@@ -6994,7 +7104,39 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if ([context isEqualToString:@"missing"])
[sheet dismiss];
- else if ([context isEqualToString:@"fixhalf"]) {
+ else if ([context isEqualToString:@"cancel"]) {
+ bool clear;
+
+ switch (button) {
+ case 1:
+ clear = false;
+ break;
+
+ case 2:
+ clear = true;
+ break;
+
+ default:
+ _assert(false);
+ }
+
+ [sheet dismiss];
+
+ @synchronized (self) {
+ if (clear)
+ [self _reloadData];
+ else {
+ Queuing_ = true;
+ [buttonbar_ setBadgeValue:@"Q'd" forButton:4];
+ [book_ reloadData];
+ }
+
+ if (confirm_ != nil) {
+ [confirm_ release];
+ confirm_ = nil;
+ }
+ }
+ } else if ([context isEqualToString:@"fixhalf"]) {
switch (button) {
case 1:
@synchronized (self) {
@@ -7509,7 +7651,9 @@ int main(int argc, char *argv[]) { _pooled
/*Purple_.Set(space_, 0.5, 0.0, 0.7, 1.0);
Purplish_.Set(space_, 0.7, 0.4, 0.8, 1.0); PURPLE */
- CommercialColor_ = [UIColor colorWithRed:0.93f green:1.00f blue:0.88f alpha:1.00f];
+//.93
+ InstallingColor_ = [UIColor colorWithRed:0.88f green:1.00f blue:0.88f alpha:1.00f];
+ RemovingColor_ = [UIColor colorWithRed:1.00f green:0.88f blue:0.88f alpha:1.00f];
Finishes_ = [NSArray arrayWithObjects:@"return", @"reopen", @"restart", @"reload", @"reboot", nil];
diff --git a/UICaboodle/BrowserView.m b/UICaboodle/BrowserView.m
index 0f95a04..3a4b779 100644
--- a/UICaboodle/BrowserView.m
+++ b/UICaboodle/BrowserView.m
@@ -70,6 +70,22 @@
} return self;
}
++ (NSArray *) _attributeKeys {
+ return [NSArray arrayWithObjects:@"device", nil];
+}
+
+- (NSArray *) attributeKeys {
+ return [[self class] _attributeKeys];
+}
+
++ (BOOL) isKeyExcludedFromWebScript:(const char *)name {
+ return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
+}
+
+- (NSString *) device {
+ return [[UIDevice currentDevice] uniqueIdentifier];
+}
+
+ (NSString *) webScriptNameForSelector:(SEL)selector {
if (selector == @selector(close))
return @"close";
diff --git a/UICaboodle/RVBook.mm b/UICaboodle/RVBook.mm
index 28774ae..4b5a399 100644
--- a/UICaboodle/RVBook.mm
+++ b/UICaboodle/RVBook.mm
@@ -270,10 +270,16 @@
}
- (void) reloadData {
- for (int i(0), e([pages_ count]); i != e; ++i) {
- RVPage *page([pages_ objectAtIndex:(e - i - 1)]);
+ size_t count([pages_ count]);
+ for (size_t i(0); i != count; ++i) {
+ RVPage *page([pages_ objectAtIndex:(count - i - 1)]);
[page reloadData];
}
+
+ if (count != 0) {
+ RVPage *page([pages_ lastObject]);
+ [self reloadButtonsForPage:page];
+ }
}
- (CGRect) pageBounds {
diff --git a/control b/control
index 2d9c962..c8512b0 100644
--- a/control
+++ b/control
@@ -4,7 +4,7 @@ Priority: required
Section: Packaging
Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
Architecture: iphoneos-arm
-Version: 1.0.2780-43
+Version: 1.0.2793-44
Replaces: com.sosiphone.addcydia
Depends: apt, darwintools, pcre, shell-cmds
Conflicts: com.sosiphone.addcydia