#include <CoreFoundation/CFInternal.h>
#endif
-#include <CoreFoundation/CFPriv.h>
#include <CoreFoundation/CFUniChar.h>
#include <SystemConfiguration/SystemConfiguration.h>
debReleaseIndex *dindex(dynamic_cast<debReleaseIndex *>(index));
if (dindex != NULL) {
std::string file(dindex->MetaIndexURI(""));
- files_.insert(file + "Release.gpg");
- files_.insert(file + "Release");
base_.set(pool, file);
- std::vector<IndexTarget *> *targets(dindex->ComputeIndexTargets());
- for (std::vector<IndexTarget *>::const_iterator target(targets->begin()); target != targets->end(); ++target) {
- std::string file((*target)->URI);
+ pkgAcquire acquire;
+ dindex->GetIndexes(&acquire, true);
+ for (pkgAcquire::ItemIterator item(acquire.ItemsBegin()); item != acquire.ItemsEnd(); item++) {
+ std::string file((*item)->DescURI());
+ files_.insert(file);
+ if (file.length() < sizeof("Packages.bz2") || file.substr(file.length() - sizeof("Packages.bz2")) != "/Packages.bz2")
+ continue;
+ file = file.substr(0, file.length() - 4);
files_.insert(file);
files_.insert(file + ".gz");
- files_.insert(file + ".bz2");
files_.insert(file + "Index");
- } delete targets;
+ }
FileFd fd;
if (!fd.Open(dindex->MetaIndexFile("Release"), FileFd::ReadOnly))
CFStringRef lhn(lhi), rhn(rhi);
if (lhn == NULL)
- return rhn == NULL ? NSOrderedSame : NSOrderedAscending;
+ return rhn == NULL ? kCFCompareEqualTo : kCFCompareLessThan;
else if (rhn == NULL)
- return NSOrderedDescending;
+ return kCFCompareGreaterThan;
_profile(PackageNameCompare$NumbersLast)
if (!lhi.empty() && !rhi.empty()) {
UniChar rhc(CFStringGetCharacterAtIndex(rhn, 0));
bool lha(CFUniCharIsMemberOf(lhc, kCFUniCharLetterCharacterSet));
if (lha != CFUniCharIsMemberOf(rhc, kCFUniCharLetterCharacterSet))
- return lha ? NSOrderedAscending : NSOrderedDescending;
+ return lha ? kCFCompareLessThan : kCFCompareGreaterThan;
}
_end
std::binary_function<Package *, Package *, bool>
{
_finline bool operator ()(Package *lhs, Package *rhs) const {
- return PackageNameCompare(lhs, rhs, NULL) == NSOrderedAscending;
+ return PackageNameCompare(lhs, rhs, NULL) == kCFCompareLessThan;
}
};
- (BOOL) hasMode {
@synchronized (database_) {
if ([database_ era] != era_ || iterator_.end())
- return nil;
+ return NO;
pkgDepCache::StateCache &state([database_ cache][iterator_]);
return state.Mode != pkgDepCache::ModeKeep;
}
- (bool) isInstalledAndUnfiltered:(NSNumber *)number {
- return ![self uninstalled] && (![number boolValue] && role_ != 7 || [self unfiltered]);
+ return ![self uninstalled] && role_ <= ([number boolValue] ? 1 : 3);
}
- (bool) isVisibleInSection:(NSString *)name source:(Source *)source {
reason = @"virtual";
}
- NSDictionary *version(start.TargetVer() == 0 ? [NSNull null] : [NSDictionary dictionaryWithObjectsAndKeys:
+ NSDictionary *version(start.TargetVer() == 0 ? (NSDictionary *) [NSNull null] : [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:start.CompType()], @"operator",
[NSString stringWithUTF8String:start.TargetVer()], @"value",
nil]);
if (!highlighted)
UISetColor(commercial_ ? Purple_ : Black_);
- [name_ drawAtPoint:CGPointMake(36, 8) forWidth:(width - (placard_ == nil ? 68 : 94)) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation];
+ [name_ drawAtPoint:CGPointMake(36, 8) forWidth:(width - (placard_ == nil ? 68 : 94)) withFont:Font18Bold_ lineBreakMode:NSLineBreakByTruncatingTail];
if (placard_ != nil)
[placard_ drawAtPoint:CGPointMake(width - 52, 11)];
if (!highlighted)
UISetColor(commercial_ ? Purple_ : Black_);
- [name_ drawAtPoint:CGPointMake(48, 8) forWidth:(width - (placard_ == nil ? 80 : 106)) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation];
- [source_ drawAtPoint:CGPointMake(58, 29) forWidth:(width - 95) withFont:Font12_ lineBreakMode:UILineBreakModeTailTruncation];
+ [name_ drawAtPoint:CGPointMake(48, 8) forWidth:(width - (placard_ == nil ? 80 : 106)) withFont:Font18Bold_ lineBreakMode:NSLineBreakByTruncatingTail];
+ [source_ drawAtPoint:CGPointMake(58, 29) forWidth:(width - 95) withFont:Font12_ lineBreakMode:NSLineBreakByTruncatingTail];
if (!highlighted)
UISetColor(commercial_ ? Purplish_ : Gray_);
- [description_ drawAtPoint:CGPointMake(12, 46) forWidth:(width - 46) withFont:Font14_ lineBreakMode:UILineBreakModeTailTruncation];
+ [description_ drawAtPoint:CGPointMake(12, 46) forWidth:(width - 46) withFont:Font14_ lineBreakMode:NSLineBreakByTruncatingTail];
if (placard_ != nil)
[placard_ drawAtPoint:CGPointMake(width - 52, 9)];
section_ = [section localized];
name_ = section_ == nil || [section_ length] == 0 ? UCLocalize("NO_SECTION") : (NSString *) section_;
- count_ = [NSString stringWithFormat:@"%d", [section count]];
+ count_ = [NSString stringWithFormat:@"%zd", [section count]];
if (editing_)
[switch_ setOn:(isSectionVisible(basic_) ? 1 : 0) animated:NO];
if (!highlighted)
UISetColor(Black_);
- [name_ drawAtPoint:CGPointMake(48, 12) forWidth:(width - 58) withFont:Font18_ lineBreakMode:UILineBreakModeTailTruncation];
+ [name_ drawAtPoint:CGPointMake(48, 12) forWidth:(width - 58) withFont:Font18_ lineBreakMode:NSLineBreakByTruncatingTail];
CGSize size = [count_ sizeWithFont:Font14_];
}
- (void) beginUpdate {
+ if (updating_)
+ return;
+
UIViewController *controller([[self viewControllers] objectAtIndex:1]);
UITabBarItem *item([controller tabBarItem]);
if (!highlighted)
UISetColor(Black_);
- [origin_ drawAtPoint:CGPointMake(52, 8) forWidth:(width - 61) withFont:Font18Bold_ lineBreakMode:UILineBreakModeTailTruncation];
+ [origin_ drawAtPoint:CGPointMake(52, 8) forWidth:(width - 61) withFont:Font18Bold_ lineBreakMode:NSLineBreakByTruncatingTail];
if (!highlighted)
UISetColor(Gray_);
- [label_ drawAtPoint:CGPointMake(52, 29) forWidth:(width - 61) withFont:Font12_ lineBreakMode:UILineBreakModeTailTruncation];
+ [label_ drawAtPoint:CGPointMake(52, 29) forWidth:(width - 61) withFont:Font12_ lineBreakMode:NSLineBreakByTruncatingTail];
}
- (void) setFetch:(NSNumber *)fetch {
}
}
+- (void) tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath {
+ [self updateButtonsForEditingStatusAnimated:YES];
+}
+
- (void) complete {
[delegate_ addTrivialSource:href_];
href_ = nil;
case 1: {
NSString *href = [[alert textField] text];
+ static Pcre href_r("^http(s?)://[^# ]*$");
+ if (!href_r(href)) {
+ UIAlertView *alert = [[[UIAlertView alloc]
+ initWithTitle:Error_
+ message:UCLocalize("INVALID_URL")
+ delegate:self
+ cancelButtonTitle:UCLocalize("OK")
+ otherButtonTitles:nil
+ ] autorelease];
+
+ [alert setContext:@"badurl"];
+ [alert show];
+
+ break;
+ }
+
if (![href hasSuffix:@"/"])
href_ = [href stringByAppendingString:@"/"];
else
[caption_ setTextColor:[UIColor whiteColor]];
[caption_ setBackgroundColor:[UIColor clearColor]];
[caption_ setShadowColor:[UIColor blackColor]];
- [caption_ setTextAlignment:UITextAlignmentCenter];
+ [caption_ setTextAlignment:NSTextAlignmentCenter];
[view addSubview:caption_];
CGRect statusrect;
[status_ setTextColor:[UIColor whiteColor]];
[status_ setBackgroundColor:[UIColor clearColor]];
[status_ setShadowColor:[UIColor blackColor]];
- [status_ setTextAlignment:UITextAlignmentCenter];
+ [status_ setTextAlignment:NSTextAlignmentCenter];
[view addSubview:status_];
}
Changed_ = true;
}
+
+ _H<NSMutableArray> broken([NSMutableArray array]);
+ for (NSString *key in (id) Sources_)
+ if ([key rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"# "]].location != NSNotFound)
+ [broken addObject:key];
+ if ([broken count] != 0) {
+ for (NSString *key in (id) broken)
+ [Sources_ removeObjectForKey:key];
+ Changed_ = true;
+ } broken = nil;
/* }}} */
CydiaWriteSources();