}
virtual void IMSHit(pkgAcquire::ItemDesc &item) {
+ Done(item);
}
virtual void Fetch(pkgAcquire::ItemDesc &item) {
}
virtual void Done(pkgAcquire::ItemDesc &item) {
+ NSString *name([NSString stringWithUTF8String:item.ShortDesc.c_str()]);
+ CydiaProgressEvent *event([CydiaProgressEvent eventWithMessage:[NSString stringWithFormat:Colon_, UCLocalize("DONE"), name] ofType:kCydiaProgressEventTypeStatus forItem:item]);
+ [delegate_ performSelectorOnMainThread:@selector(addProgressEvent:) withObject:event waitUntilDone:YES];
}
virtual void Fail(pkgAcquire::ItemDesc &item) {
badge_ = nil;
placard_ = nil;
- [package parse];
+ if (package == nil)
+ [content_ setBackgroundColor:[UIColor whiteColor]];
+ else {
+ [package parse];
+
+ Source *source = [package source];
- Source *source = [package source];
+ icon_ = [package icon];
- icon_ = [package icon];
+ if (NSString *name = [package name])
+ name_ = [NSString stringWithString:name];
- if (NSString *name = [package name])
- name_ = [NSString stringWithString:name];
+ NSString *description(nil);
- NSString *description(nil);
+ if (description == nil && IsWildcat_)
+ description = [package longDescription];
+ if (description == nil)
+ description = [package shortDescription];
- if (description == nil && IsWildcat_)
- description = [package longDescription];
- if (description == nil)
- description = [package shortDescription];
+ if (description != nil)
+ description_ = [NSString stringWithString:description];
- if (description != nil)
- description_ = [NSString stringWithString:description];
+ commercial_ = [package isCommercial];
- commercial_ = [package isCommercial];
+ NSString *label = nil;
+ bool trusted = false;
- NSString *label = nil;
- bool trusted = false;
+ if (source != nil) {
+ label = [source label];
+ trusted = [source trusted];
+ } else if ([[package id] isEqualToString:@"firmware"])
+ label = UCLocalize("APPLE");
+ else
+ label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
- if (source != nil) {
- label = [source label];
- trusted = [source trusted];
- } else if ([[package id] isEqualToString:@"firmware"])
- label = UCLocalize("APPLE");
- else
- label = [NSString stringWithFormat:UCLocalize("SLASH_DELIMITED"), UCLocalize("UNKNOWN"), UCLocalize("LOCAL")];
+ NSString *from(label);
- NSString *from(label);
+ NSString *section = [package simpleSection];
+ if (section != nil && ![section isEqualToString:label]) {
+ section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
+ from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
+ }
- NSString *section = [package simpleSection];
- if (section != nil && ![section isEqualToString:label]) {
- section = [[NSBundle mainBundle] localizedStringForKey:section value:nil table:@"Sections"];
- from = [NSString stringWithFormat:UCLocalize("PARENTHETICAL"), from, section];
- }
+ source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
- source_ = [NSString stringWithFormat:UCLocalize("FROM"), from];
+ if (NSString *purpose = [package primaryPurpose])
+ badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
- if (NSString *purpose = [package primaryPurpose])
- badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]];
+ UIColor *color;
+ NSString *placard;
- UIColor *color;
- NSString *placard;
+ if (NSString *mode = [package mode]) {
+ if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
+ color = RemovingColor_;
+ //placard = @"removing";
+ } else {
+ color = InstallingColor_;
+ //placard = @"installing";
+ }
- if (NSString *mode = [package mode]) {
- if ([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]) {
- color = RemovingColor_;
- //placard = @"removing";
+ // XXX: the removing/installing placards are not @2x
+ placard = nil;
} else {
- color = InstallingColor_;
- //placard = @"installing";
+ color = [UIColor whiteColor];
+
+ if ([package installed] != nil)
+ placard = @"installed";
+ else
+ placard = nil;
}
- // XXX: the removing/installing placards are not @2x
- placard = nil;
- } else {
- color = [UIColor whiteColor];
+ [content_ setBackgroundColor:color];
- if ([package installed] != nil)
- placard = @"installed";
- else
- placard = nil;
+ if (placard != nil)
+ placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
}
- [content_ setBackgroundColor:color];
-
- if (placard != nil)
- placard_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/%@.png", App_, placard]];
-
[self setNeedsDisplay];
[content_ setNeedsDisplay];
}
- (void) releaseSubviews {
list_ = nil;
+ package_ = nil;
+ files_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- files_ = [NSMutableArray arrayWithCapacity:32];
} return self;
}
package_ = nil;
name_ = nil;
- [files_ removeAllObjects];
+ files_ = [NSMutableArray arrayWithCapacity:32];
if (package != nil) {
package_ = package;
if ((self = [super init]) != nil) {
database_ = database;
buttons_ = [NSMutableArray arrayWithCapacity:4];
- name_ = [NSString stringWithString:name];
+ name_ = name == nil ? @"" : [NSString stringWithString:name];
[self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/#!/package/%@", UI_, (id) name_]]];
} return self;
}
database_ = database;
title_ = [title copy];
[[self navigationItem] setTitle:title_];
-
-#if TryIndexedCollation
- if ([[self class] hasIndexedCollation])
- index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
- else
-#endif
- index_ = [NSMutableArray arrayWithCapacity:32];
-
- indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
-
- packages_ = [NSArray array];
- sections_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
- (void) releaseSubviews {
list_ = nil;
+ packages_ = nil;
+ sections_ = nil;
+ index_ = nil;
+ indices_ = nil;
+
[super releaseSubviews];
}
packages_ = packages;
- [indices_ removeAllObjects];
- [sections_ removeAllObjects];
+ indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
Section *section = nil;
#if TryIndexedCollation
if ([[self class] hasIndexedCollation]) {
+ index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
+
id collation = [objc_getClass("UILocalizedIndexedCollation") currentCollation];
NSArray *titles = [collation sectionIndexTitles];
int secidx = -1;
} else
#endif
{
- [index_ removeAllObjects];
+ index_ = [NSMutableArray arrayWithCapacity:32];
bool sectioned([self showsSections]);
if (!sectioned) {
- (void) reloadData {
[super reloadData];
- [self performSelector:@selector(_reloadData) withObject:nil afterDelay:0];
+
+ if ([self shouldYield])
+ [self performSelector:@selector(_reloadData) withObject:nil afterDelay:0];
+ else
+ [self _reloadData];
}
- (void) resetCursor {
- (void) releaseSubviews {
list_ = nil;
+ sections_ = nil;
+ filtered_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- sections_ = [NSMutableArray arrayWithCapacity:16];
- filtered_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
NSArray *packages = [database_ packages];
- [sections_ removeAllObjects];
- [filtered_ removeAllObjects];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
+ filtered_ = [NSMutableArray arrayWithCapacity:16];
NSMutableDictionary *sections([NSMutableDictionary dictionaryWithCapacity:32]);
- (void) releaseSubviews {
list_ = nil;
+ packages_ = nil;
+ sections_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
-
- packages_ = [NSArray array];
- sections_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
goto reload;
packages_ = packages;
- [sections_ removeAllObjects];
+ sections_ = [NSMutableArray arrayWithCapacity:16];
Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
Section *ignored = nil;
@implementation SourceController
- (NSURL *) navigationURL {
- return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://sources/%@", [source_ name]]];
+ return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://sources/%@", [key_ stringByAddingPercentEscapesIncludingReserved]]];
}
- (id) initWithDatabase:(Database *)database source:(Source *)source {
- (void) releaseSubviews {
list_ = nil;
+ sources_ = nil;
+
[super releaseSubviews];
}
- (id) initWithDatabase:(Database *)database {
if ((self = [super init]) != nil) {
database_ = database;
- sources_ = [NSMutableArray arrayWithCapacity:16];
} return self;
}
if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
return;
- [sources_ removeAllObjects];
+ sources_ = [NSMutableArray arrayWithCapacity:16];
[sources_ addObjectsFromArray:[database_ sources]];
_trace();
[sources_ sortUsingSelector:@selector(compareByNameAndType:)];
controller = [[[SourcesController alloc] initWithDatabase:database_] autorelease];
[(SourcesController *)controller showAddSourcePrompt];
} else {
- Source *source = [database_ sourceWithKey:argument];
+ Source *source = [database_ sourceWithKey:[argument stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
controller = [[[SourceController alloc] initWithDatabase:database_ source:source] autorelease];
}
}
Version_ = [NSNumber numberWithUnsignedInt:1];
[Metadata_ setObject:Version_ forKey:@"Version"];
+ [Metadata_ removeObjectForKey:@"LastUpdate"];
+
Changed_ = true;
}
/* }}} */