_transient NSDate *firstSeen_;
_transient NSDate *lastSeen_;
bool subscribed_;
+ bool ignored_;
}
- (Package *) initWithVersion:(pkgCache::VerIterator)version withZone:(NSZone *)zone inPool:(apr_pool_t *)pool database:(Database *)database;
obsolete_ = [self hasTag:@"cydia::obsolete"];
essential_ = ((iterator_->Flags & pkgCache::Flag::Essential) == 0 ? NO : YES) || [self hasTag:@"cydia::essential"];
_end
+
+ ignored_ = iterator_->SelectedState == pkgCache::State::Hold;
_end } return self;
}
}
- (BOOL) ignored {
- NSDictionary *metadata([self metadata]);
- if (NSNumber *ignored = [metadata objectForKey:@"IsIgnored"])
- return [ignored boolValue];
- else
- return false;
+ return ignored_;
}
- (NSString *) latest {
- (NSArray *) getInstalledPackages {
NSArray *packages([[Database sharedInstance] packages]);
- NSMutableArray *installed([NSMutableArray arrayWithCapacity:[packages count]]);
+ NSMutableArray *installed([NSMutableArray arrayWithCapacity:1024]);
for (Package *package in packages)
if ([package installed] != nil)
[installed addObject:package];
#endif
Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
- Section *ignored = [[[Section alloc] initWithName:UCLocalize("IGNORED_UPGRADES") localize:NO] autorelease];
+ Section *ignored = nil;
Section *section = nil;
NSDate *last = nil;
}
[section addToCount];
- } else if ([package ignored])
+ } else if ([package ignored]) {
+ if (ignored == nil) {
+ ignored = [[[Section alloc] initWithName:UCLocalize("IGNORED_UPGRADES") row:offset localize:NO] autorelease];
+ }
[ignored addToCount];
- else {
+ } else {
++upgrades_;
[upgradable addToCount];
}
}
- (void) onIgnored:(id)control {
- [self onSomething:(int) [control isOn] withKey:@"IsIgnored"];
+ // TODO: set Held state - possibly call out to dpkg, etc.
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Database *database_;
int tag_;
-
- UIKeyboard *keyboard_;
- int huds_;
+ int hudcount_;
+ NSURL *starturl_;
SectionsController *sections_;
ChangesController *changes_;
}
- (BOOL) hudIsShowing {
- return (huds_ > 0);
+ return (hudcount_ > 0);
}
- (void) applicationSuspend:(__GSEvent *)event {
while ([target modalViewController] != nil) target = [target modalViewController];
[[target view] addSubview:hud];
- huds_++;
+ hudcount_++;
return hud;
}
[hud show:NO];
[hud removeFromSuperview];
[window_ setUserInteractionEnabled:YES];
- huds_--;
+ hudcount_--;
}
- (CYViewController *) pageForPackage:(NSString *)name {
return nil;
}
-- (void) applicationOpenURL:(NSURL *)url {
- [super applicationOpenURL:url];
- int tag;
- if (CYViewController *page = [self pageForURL:url hasTag:&tag]) {
+- (BOOL) openCydiaURL:(NSURL *)url {
+ CYViewController *page = nil;
+ int tag = 0;
+
+ NSLog(@"open url: %@", url);
+
+ if ((page = [self pageForURL:url hasTag:&tag])) {
[self setPage:page];
tag_ = tag;
[tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
}
+
+ return !!page;
+}
+
+- (void) applicationOpenURL:(NSURL *)url {
+ [super applicationOpenURL:url];
+ NSLog(@"first: %@", url);
+ if (!loaded_) starturl_ = [url retain];
+ else [self openCydiaURL:url];
}
- (void) applicationWillResignActive:(UIApplication *)application {
[self reloadData];
PrintTimes();
- // Show the home page
- [tabbar_ setSelectedIndex:0];
- _setHomePage(self);
+ // Show the initial page
+ if (starturl_ == nil || ![self openCydiaURL:starturl_]) {
+ [tabbar_ setSelectedIndex:0];
+ _setHomePage(self);
+ }
+
+ [starturl_ release];
+ starturl_ = nil;
+
[window_ setUserInteractionEnabled:YES];
// XXX: does this actually slow anything down?