summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2009-07-01 13:26:11 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:13:58 +0000
commit327624b6106222962bcd56edbce94294362bb4b6 (patch)
treec9f890820ed8103c85734f55ef32f28a355dc513
parent8696b988ce2b755ed708a5a84740446bbb7fb7f1 (diff)
Massive fixes for 3.x.
-rw-r--r--Cydia.app/English.lproj/Localizable.strings4
-rw-r--r--Cydia.app/French.lproj/Localizable.strings4
-rw-r--r--Cydia.app/Sections.plist12
-rw-r--r--Cydia.mm321
-rw-r--r--UICaboodle/BrowserView.mm28
-rw-r--r--UICaboodle/ResetView.mm4
6 files changed, 206 insertions, 167 deletions
diff --git a/Cydia.app/English.lproj/Localizable.strings b/Cydia.app/English.lproj/Localizable.strings
index 421b6c6..3cadf3e 100644
--- a/Cydia.app/English.lproj/Localizable.strings
+++ b/Cydia.app/English.lproj/Localizable.strings
@@ -47,7 +47,7 @@
"DONE" = "Done";
"DOUBLE_QUOTED" = "“%@”";
"DOWNGRADE" = "Downgrade";
-"DOWNLOADING" = "Downloading";
+"DOWNLOADING" = "Downloading %@";
"EDIT" = "Edit";
"ENTER_APT_URL" = "Enter Cydia/APT URL";
"ENTERED_BY_USER" = "Entered by User";
@@ -108,7 +108,7 @@
"NO" = "No";
"NO_SECTION" = "(No Section)";
"NOT_RATED" = "Not Rated";
-"NODE" = "Note";
+"NOTE" = "Note";
"NOT_REPOSITORY" = "Did not Find Repository";
"NOT_REPOSITORY_EX" = "The indicated repository could not be found. This could be because you are trying to add a legacy Installer repository (these are not supported). Also, this interface is only capable of working with exact repository URLs. If you host a repository and are having issues please contact the author of Cydia with any questions you have.";
"OK" = "OK";
diff --git a/Cydia.app/French.lproj/Localizable.strings b/Cydia.app/French.lproj/Localizable.strings
index 1414942..d29630b 100644
--- a/Cydia.app/French.lproj/Localizable.strings
+++ b/Cydia.app/French.lproj/Localizable.strings
@@ -47,7 +47,7 @@
"DONE" = "OK";
"DOUBLE_QUOTED" = "« $@ »";
"DOWNGRADE" = "Rétrograder";
-"DOWNLOADING" = "Téléchargement";
+"DOWNLOADING" = "Téléchargement %@";
"EDIT" = "Éditer";
"ENTER_APT_URL" = "Entrez une adresse Cydia/APT";
"ENTERED_BY_USER" = "Entré par l'Utilisateur";
@@ -106,7 +106,7 @@
"NEW_INSTALL" = "Nouvelle Installation";
"NO_SECTION" = "(Pas de Catégorie)";
"NOT_RATED" = "Pas de Note";
-"NODE" = "Note";
+"NOTE" = "Note";
"NOT_REPOSITORY" = "Impossible de Trouver Cette Source";
"NOT_REPOSITORY_EX" = "La source de paquets ne peut pas être trouvée. Ce pourrait être car c'est une source d'Installer (qui ne fonctionne pas avec Cydia). Cydia ne peut fonctionner qu'avec des adresses rigoureusement exactes. Si vous hébergez une source de paquets, contactez l'auteur de Cydia à propos de ces erreurs.";
"OK" = "OK";
diff --git a/Cydia.app/Sections.plist b/Cydia.app/Sections.plist
index 441b4f7..247d709 100644
--- a/Cydia.app/Sections.plist
+++ b/Cydia.app/Sections.plist
@@ -3,6 +3,18 @@
<plist version="1.0">
<dict>
+ <key>Hunspell_Dictionaries</key>
+ <dict>
+ <key>Rename</key>
+ <string>Dictionaries_(Hunspell)</string>
+ </dict>
+
+ <key>Utility</key>
+ <dict>
+ <key>Rename</key>
+ <string>Utilities</string>
+ </dict>
+
<key>Themes_(Springboard)</key>
<dict>
<key>Rename</key>
diff --git a/Cydia.mm b/Cydia.mm
index 9e165b4..bafa5e9 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -1276,7 +1276,7 @@ class Status :
virtual void Fetch(pkgAcquire::ItemDesc &item) {
//NSString *name([NSString stringWithUTF8String:item.ShortDesc.c_str()]);
- [delegate_ setProgressTitle:[NSString stringWithUTF8String:("Downloading " + item.ShortDesc).c_str()]];
+ [delegate_ setProgressTitle:[NSString stringWithFormat:UCLocalize("DOWNLOADING"), [NSString stringWithUTF8String:item.ShortDesc.c_str()]]];
}
virtual void Done(pkgAcquire::ItemDesc &item) {
@@ -2833,7 +2833,7 @@ struct PackageNameOrdering :
/* XXX: localize the index thingees */
- (Section *) initWithIndex:(unichar)index row:(size_t)row {
if ((self = [super init]) != nil) {
- name_ = [(index == '#' ? @"123" : [NSString stringWithCharacters:&index length:1]) retain];
+ name_ = [[NSString stringWithCharacters:&index length:1] retain];
index_ = index;
row_ = row;
} return self;
@@ -4277,7 +4277,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
#define ListCache_ "/User/Library/Caches/com.apple.mobile.installation.plist"
#define IconCache_ "/User/Library/Caches/com.apple.springboard-imagecache-icons.plist"
- if (NSMutableDictionary *cache = [[NSMutableDictionary alloc] initWithContentsOfFile:@ Cache_]) {
+ unlink(IconCache_);
+
+ if (NSMutableDictionary *cache = [[NSMutableDictionary alloc] initWithContentsOfFile:@ListCache_]) {
[cache autorelease];
NSFileManager *manager = [NSFileManager defaultManager];
@@ -4288,7 +4290,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
goto error;
struct stat info;
- if (stat(Cache_, &info) == -1)
+ if (stat(ListCache_, &info) == -1)
goto error;
[system removeAllObjects];
@@ -4309,11 +4311,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
} else goto error;
- [cache writeToFile:@Cache_ atomically:YES];
+ [cache writeToFile:@ListCache_ atomically:YES];
- if (chown(Cache_, info.st_uid, info.st_gid) == -1)
+ if (chown(ListCache_, info.st_uid, info.st_gid) == -1)
goto error;
- if (chmod(Cache_, info.st_mode) == -1)
+ if (chmod(ListCache_, info.st_mode) == -1)
goto error;
if (false) error:
@@ -4566,24 +4568,49 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
/* }}} */
/* Package Cell {{{ */
-@interface PackageCell : UITableCell {
+@interface ContentView : UIView {
+ _transient id delegate_;
+}
+
+@end
+
+@interface PackageCell : UITableViewCell {
UIImage *icon_;
NSString *name_;
NSString *description_;
bool commercial_;
NSString *source_;
UIImage *badge_;
- bool cached_;
Package *package_;
-#ifdef USE_BADGES
- UITextLabel *status_;
-#endif
+ UIColor *color_;
+ ContentView *content_;
+ BOOL faded_;
+ float fade_;
}
- (PackageCell *) init;
- (void) setPackage:(Package *)package;
+ (int) heightForPackage:(Package *)package;
+- (void) drawContentRect:(CGRect)rect;
+
+@end
+
+@implementation ContentView
+
+- (id) initWithFrame:(CGRect)frame {
+ if ((self = [super initWithFrame:frame]) != nil) {
+ } return self;
+}
+
+- (void) setDelegate:(id)delegate {
+ delegate_ = delegate;
+}
+
+- (void) drawRect:(CGRect)rect {
+ [super drawRect:rect];
+ [delegate_ drawContentRect:rect];
+}
@end
@@ -4621,22 +4648,42 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) dealloc {
[self clearPackage];
-#ifdef USE_BADGES
- [status_ release];
-#endif
+ [content_ release];
+ [color_ release];
[super dealloc];
}
+- (float) fade {
+ return faded_ ? [self selectionPercent] : fade_;
+}
+
- (PackageCell *) init {
- if ((self = [super init]) != nil) {
-#ifdef USE_BADGES
- status_ = [[UITextLabel alloc] initWithFrame:CGRectMake(48, 68, 280, 20)];
- [status_ setBackgroundColor:[UIColor clearColor]];
- [status_ setFont:small];
-#endif
+ CGRect frame(CGRectMake(0, 0, 320, 74));
+ if ((self = [super initWithFrame:frame reuseIdentifier:@"Package"]) != nil) {
+ UIView *content([self contentView]);
+ CGRect bounds([content bounds]);
+ content_ = [[ContentView alloc] initWithFrame:bounds];
+ [content_ setDelegate:self];
+ [content_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
+ [content_ setOpaque:YES];
+ [content addSubview:content_];
+ if ([self respondsToSelector:@selector(selectionPercent)])
+ faded_ = YES;
} return self;
}
+- (void) _setBackgroundColor {
+ UIColor *color;
+ if (NSString *mode = [package_ mode]) {
+ bool remove([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]);
+ color = remove ? RemovingColor_ : InstallingColor_;
+ } else
+ color = [UIColor whiteColor];
+
+ [content_ setBackgroundColor:color];
+ [self setNeedsDisplay];
+}
+
- (void) setPackage:(Package *)package {
[self clearPackage];
[package parse];
@@ -4676,57 +4723,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if ((badge_ = [UIImage imageAtPath:[NSString stringWithFormat:@"%@/Purposes/%@.png", App_, purpose]]) != nil)
badge_ = [badge_ retain];
-#ifdef USE_BADGES
- if (NSString *mode = [package mode]) {
- [badge_ setImage:[UIImage applicationImageNamed:
- [mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"] ? @"removing.png" : @"installing.png"
- ]];
-
- [status_ setText:[NSString stringWithFormat:UCLocalize("QUEUED_FOR"), UCLocalize(mode)]];
- [status_ setColor:[UIColor colorWithCGColor:Blueish_]];
- } else if ([package half]) {
- [badge_ setImage:[UIImage applicationImageNamed:@"damaged.png"]];
- [status_ setText:UCLocalize("PACKAGE_DAMAGED")];
- [status_ setColor:[UIColor redColor]];
- } else {
- [badge_ setImage:nil];
- [status_ setText:nil];
- }
-#endif
-
- cached_ = false;
+ [self _setBackgroundColor];
+ [content_ setNeedsDisplay];
}
-- (void) drawRect:(CGRect)rect {
- if (!cached_) {
- UIColor *color;
-
- if (NSString *mode = [package_ mode]) {
- bool remove([mode isEqualToString:@"REMOVE"] || [mode isEqualToString:@"PURGE"]);
- color = remove ? RemovingColor_ : InstallingColor_;
- } else
- color = [UIColor whiteColor];
+- (void) drawContentRect:(CGRect)rect {
+ bool selected([self isSelected]);
- [self setBackgroundColor:color];
- cached_ = true;
- }
-
- [super drawRect:rect];
-}
-
-- (void) drawBackgroundInRect:(CGRect)rect withFade:(float)fade {
- if (fade == 0) {
- CGContextRef context(UIGraphicsGetCurrentContext());
- [[self backgroundColor] set];
- CGRect back(rect);
- back.size.height -= 1;
- CGContextFillRect(context, back);
- }
-
- [super drawBackgroundInRect:rect withFade:fade];
-}
+#if 0
+ CGContextRef context(UIGraphicsGetCurrentContext());
+ [([[self selectedBackgroundView] superview] != nil ? [UIColor clearColor] : [self backgroundColor]) set];
+ CGContextFillRect(context, rect);
+#endif
-- (void) drawContentInRect:(CGRect)rect selected:(BOOL)selected {
if (icon_ != nil) {
CGRect rect;
rect.size = [icon_ size];
@@ -4760,13 +4769,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
if (!selected)
UISetColor(commercial_ ? Purplish_ : Gray_);
[description_ drawAtPoint:CGPointMake(12, 46) forWidth:280 withFont:Font14_ ellipsis:2];
-
- [super drawContentInRect:rect selected:selected];
}
-- (void) setSelected:(BOOL)selected withFade:(BOOL)fade {
- cached_ = false;
- [super setSelected:selected withFade:fade];
+- (void) setSelected:(BOOL)selected animated:(BOOL)fade {
+ //[self _setBackgroundColor];
+ [super setSelected:selected animated:fade];
+ [content_ setNeedsDisplay];
}
+ (int) heightForPackage:(Package *)package {
@@ -5214,7 +5222,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
NSString *title_;
NSMutableArray *packages_;
NSMutableArray *sections_;
- UISectionList *list_;
+ UITableView *list_;
+ NSMutableArray *index_;
+ NSMutableDictionary *indices_;
}
- (id) initWithBook:(RVBook *)book database:(Database *)database title:(NSString *)title;
@@ -5224,7 +5234,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
- (void) reloadData;
- (void) resetCursor;
-- (UISectionList *) list;
+- (UITableView *) list;
- (void) setShouldHideHeaderInShortLists:(BOOL)hide;
@@ -5239,51 +5249,64 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[packages_ release];
[sections_ release];
[list_ release];
+ [index_ release];
+ [indices_ release];
[super dealloc];
}
-- (int) numberOfSectionsInSectionList:(UISectionList *)list {
- return [sections_ count];
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)list {
+ NSInteger count([sections_ count]);
+ return count == 0 ? 1 : count;
}
-- (NSString *) sectionList:(UISectionList *)list titleForSection:(int)section {
+- (NSString *) tableView:(UITableView *)list titleForHeaderInSection:(NSInteger)section {
+ if ([sections_ count] == 0)
+ return nil;
return [[sections_ objectAtIndex:section] name];
}
-- (int) sectionList:(UISectionList *)list rowForSection:(int)section {
- return [[sections_ objectAtIndex:section] row];
-}
-
-- (int) numberOfRowsInTable:(UITable *)table {
- return [packages_ count];
+- (NSInteger) tableView:(UITableView *)list numberOfRowsInSection:(NSInteger)section {
+ if ([sections_ count] == 0)
+ return 0;
+ return [[sections_ objectAtIndex:section] count];
}
-- (float) table:(UITable *)table heightForRow:(int)row {
- return [PackageCell heightForPackage:[packages_ objectAtIndex:row]];
+- (Package *) packageAtIndexPath:(NSIndexPath *)path {
+ Section *section([sections_ objectAtIndex:[path section]]);
+ NSInteger row([path row]);
+ Package *package([packages_ objectAtIndex:([section row] + row)]);
+ return package;
}
-- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col reusing:(UITableCell *)reusing {
- if (reusing == nil)
- reusing = [[[PackageCell alloc] init] autorelease];
- [(PackageCell *)reusing setPackage:[packages_ objectAtIndex:row]];
- return reusing;
+- (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
+ PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+ if (cell == nil)
+ cell = [[[PackageCell alloc] init] autorelease];
+ [cell setPackage:[self packageAtIndexPath:path]];
+ return cell;
}
-- (BOOL) table:(UITable *)table showDisclosureForRow:(int)row {
- return NO;
+- (CGFloat) tableView:(UITableView *)table heightForRowAtIndexPath:(NSIndexPath *)path {
+ return 73;
+ return [PackageCell heightForPackage:[self packageAtIndexPath:path]];
}
-- (void) tableRowSelected:(NSNotification *)notification {
- int row = [[notification object] selectedRow];
- if (row == INT_MAX)
- return;
-
- Package *package = [packages_ objectAtIndex:row];
+- (NSIndexPath *) tableView:(UITableView *)table willSelectRowAtIndexPath:(NSIndexPath *)path {
+ Package *package([self packageAtIndexPath:path]);
package = [database_ packageWithName:[package id]];
PackageView *view([delegate_ packageView]);
[view setPackage:package];
[view setDelegate:delegate_];
[book_ pushPage:view];
+ return path;
+}
+
+- (NSArray *) sectionIndexTitlesForTableView:(UITableView *)tableView {
+ return [packages_ count] > 20 ? index_ : nil;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
+ return index;
}
- (id) initWithBook:(RVBook *)book database:(Database *)database title:(NSString *)title {
@@ -5291,23 +5314,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
database_ = database;
title_ = [title retain];
+ index_ = [[NSMutableArray alloc] initWithCapacity:32];
+ indices_ = [[NSMutableDictionary alloc] initWithCapacity:32];
+
packages_ = [[NSMutableArray arrayWithCapacity:16] retain];
sections_ = [[NSMutableArray arrayWithCapacity:16] retain];
- list_ = [[UISectionList alloc] initWithFrame:[self bounds] showSectionIndex:YES];
+ list_ = [[UITableView alloc] initWithFrame:[self bounds] style:UITableViewStylePlain];
[list_ setDataSource:self];
-
- UITableColumn *column = [[[UITableColumn alloc]
- initWithTitle:UCLocalize("NAME")
- identifier:@"name"
- width:[self frame].size.width
- ] autorelease];
-
- UITable *table = [list_ table];
- [table setSeparatorStyle:1];
- [table addTableColumn:column];
- [table setDelegate:self];
- [table setReusesTableCells:YES];
+ [list_ setDelegate:self];
[self addSubview:list_];
@@ -5336,6 +5351,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[packages_ addObject:package];
_end
+ [index_ removeAllObjects];
+ [indices_ removeAllObjects];
+
Section *section = nil;
_profile(PackageTable$reloadData$Section)
@@ -5353,6 +5371,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
section = [[[Section alloc] initWithIndex:index row:offset] autorelease];
_end
+ [index_ addObject:[section name]];
+ //[indices_ setObject:[NSNumber numberForInt:[sections_ count]] forKey:index];
+
_profile(PackageTable$reloadData$Section$Add)
[sections_ addObject:section];
_end
@@ -5376,15 +5397,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
}
- (void) resetCursor {
- [[list_ table] scrollPointVisibleAtTopLeft:CGPointMake(0, 0) animated:NO];
+ [list_ scrollRectToVisible:CGRectMake(0, 0, 0, 0) animated:NO];
}
-- (UISectionList *) list {
+- (UITableView *) list {
return list_;
}
- (void) setShouldHideHeaderInShortLists:(BOOL)hide {
- [list_ setShouldHideHeaderInShortLists:hide];
+ //XXX:[list_ setShouldHideHeaderInShortLists:hide];
}
@end
@@ -6764,7 +6785,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
_transient Database *database_;
NSMutableArray *packages_;
NSMutableArray *sections_;
- UISectionList *list_;
+ UITableView *list_;
unsigned upgrades_;
}
@@ -6776,7 +6797,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
@implementation ChangesView
- (void) dealloc {
- [[list_ table] setDelegate:nil];
+ [list_ setDelegate:nil];
[list_ setDataSource:nil];
[packages_ release];
@@ -6785,46 +6806,49 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[super dealloc];
}
-- (int) numberOfSectionsInSectionList:(UISectionList *)list {
- return [sections_ count];
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)list {
+ NSInteger count([sections_ count]);
+ return count == 0 ? 1 : count;
}
-- (NSString *) sectionList:(UISectionList *)list titleForSection:(int)section {
+- (NSString *) tableView:(UITableView *)list titleForHeaderInSection:(NSInteger)section {
+ if ([sections_ count] == 0)
+ return nil;
return [[sections_ objectAtIndex:section] name];
}
-- (int) sectionList:(UISectionList *)list rowForSection:(int)section {
- return [[sections_ objectAtIndex:section] row];
+- (NSInteger) tableView:(UITableView *)list numberOfRowsInSection:(NSInteger)section {
+ if ([sections_ count] == 0)
+ return 0;
+ return [[sections_ objectAtIndex:section] count];
}
-- (int) numberOfRowsInTable:(UITable *)table {
- return [packages_ count];
+- (Package *) packageAtIndexPath:(NSIndexPath *)path {
+ Section *section([sections_ objectAtIndex:[path section]]);
+ NSInteger row([path row]);
+ return [packages_ objectAtIndex:([section row] + row)];
}
-- (float) table:(UITable *)table heightForRow:(int)row {
- return [PackageCell heightForPackage:[packages_ objectAtIndex:row]];
+- (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
+ PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+ if (cell == nil)
+ cell = [[[PackageCell alloc] init] autorelease];
+ [cell setPackage:[self packageAtIndexPath:path]];
+ return cell;
}
-- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col reusing:(UITableCell *)reusing {
- if (reusing == nil)
- reusing = [[[PackageCell alloc] init] autorelease];
- [(PackageCell *)reusing setPackage:[packages_ objectAtIndex:row]];
- return reusing;
-}
-
-- (BOOL) table:(UITable *)table showDisclosureForRow:(int)row {
- return NO;
+- (CGFloat) tableView:(UITableView *)table heightForRowAtIndexPath:(NSIndexPath *)path {
+ return 73;
+ return [PackageCell heightForPackage:[self packageAtIndexPath:path]];
}
-- (void) tableRowSelected:(NSNotification *)notification {
- int row = [[notification object] selectedRow];
- if (row == INT_MAX)
- return;
- Package *package = [packages_ objectAtIndex:row];
+- (NSIndexPath *) tableView:(UITableView *)table willSelectRowAtIndexPath:(NSIndexPath *)path {
+ Package *package([self packageAtIndexPath:path]);
PackageView *view([delegate_ packageView]);
[view setDelegate:delegate_];
[view setPackage:package];
[book_ pushPage:view];
+ return path;
}
- (void) _leftButtonClicked {
@@ -6843,25 +6867,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
packages_ = [[NSMutableArray arrayWithCapacity:16] retain];
sections_ = [[NSMutableArray arrayWithCapacity:16] retain];
- list_ = [[UISectionList alloc] initWithFrame:[self bounds] showSectionIndex:NO];
+ list_ = [[UITableView alloc] initWithFrame:[self bounds] style:UITableViewStylePlain];
[self addSubview:list_];
- [list_ setShouldHideHeaderInShortLists:NO];
+ //XXX:[list_ setShouldHideHeaderInShortLists:NO];
[list_ setDataSource:self];
+ [list_ setDelegate:self];
//[list_ setSectionListStyle:1];
- UITableColumn *column = [[[UITableColumn alloc]
- initWithTitle:UCLocalize("NAME")
- identifier:@"name"
- width:[self frame].size.width
- ] autorelease];
-
- UITable *table = [list_ table];
- [table setSeparatorStyle:1];
- [table addTableColumn:column];
- [table setDelegate:self];
- [table setReusesTableCells:YES];
-
[self reloadData];
[self setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm
index e08c291..bd2c236 100644
--- a/UICaboodle/BrowserView.mm
+++ b/UICaboodle/BrowserView.mm
@@ -10,6 +10,9 @@ extern NSString * const kCAFilterNearest;
#include "substrate.h"
+static CFArrayRef (*$GSSystemCopyCapability)(CFStringRef);
+static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
+
@interface NSString (UIKit)
- (NSString *) stringByAddingPercentEscapes;
@end
@@ -222,7 +225,6 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
#endif
+ (void) _initialize {
- NSLog(@"INITIALIZING");
[WebView enableWebThread];
WebPreferences *preferences([WebPreferences standardPreferences]);
@@ -230,6 +232,9 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
[preferences setOfflineWebApplicationCacheEnabled:YES];
[WebPreferences _setInitialDefaultTextEncodingToSystemEncoding];
+
+ $GSSystemCopyCapability = reinterpret_cast<CFArrayRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemCopyCapability"));
+ $GSSystemGetCapability = reinterpret_cast<CFArrayRef (*)(CFStringRef)>(dlsym(RTLD_DEFAULT, "GSSystemGetCapability"));
}
- (void) dealloc {
@@ -704,6 +709,7 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
}
NSURL *url([request URL]);
+ NSString *host([url host]);
if (url == nil) use: {
if (!error_ && [frame parentFrame] == nil) {
@@ -728,16 +734,22 @@ UIActionSheet *mailAlertSheet = [[UIActionSheet alloc] initWithTitle:UCLocalize(
const NSArray *capability;
-#if 0 // XXX:3:GSSystemCopyCapability
- capability = reinterpret_cast<const NSArray *>(GSSystemGetCapability(kGSDisplayIdentifiersCapability));
-#else
- capability = nil;
-#endif
+ if ($GSSystemCopyCapability != NULL) {
+ capability = reinterpret_cast<const NSArray *>((*$GSSystemCopyCapability)(kGSDisplayIdentifiersCapability));
+ capability = [capability autorelease];
+ } else if ($GSSystemGetCapability != NULL) {
+ capability = reinterpret_cast<const NSArray *>((*$GSSystemGetCapability)(kGSDisplayIdentifiersCapability));
+ } else
+ capability = nil;
+
+ NSURL *open(nil);
if (capability != nil && (
- [capability containsObject:@"com.apple.Maps"] && [url mapsURL] ||
- [capability containsObject:@"com.apple.youtube"] && [url youTubeURL]
+ [url isGoogleMapsURL] && [capability containsObject:@"com.apple.Maps"] && (open = [url mapsURL]) != nil||
+ [host hasSuffix:@"youtube.com"] && [capability containsObject:@"com.apple.youtube"] && (open = [url youTubeURL]) != nil ||
+ [url respondsToSelector:@selector(phobosURL)] && (open = [url phobosURL]) != nil
)) {
+ url = open;
open:
[UIApp openURL:url];
goto ignore;
diff --git a/UICaboodle/ResetView.mm b/UICaboodle/ResetView.mm
index 4265be4..bd1c8ee 100644
--- a/UICaboodle/ResetView.mm
+++ b/UICaboodle/ResetView.mm
@@ -37,7 +37,9 @@
@implementation UITableView (RVBook)
- (void) resetViewAnimated:(BOOL)animated {
- [self selectRowAtIndexPath:nil animated:animated scrollPosition:UITableViewScrollPositionNone];
+ //[self selectRowAtIndexPath:nil animated:animated scrollPosition:UITableViewScrollPositionNone];
+ if (NSIndexPath *path = [self indexPathForSelectedRow])
+ [self deselectRowAtIndexPath:path animated:animated];
}
- (void) clearView {