]> git.saurik.com Git - cydia.git/commitdiff
Rewrote the build environment from scratch.
authorJay Freeman (saurik) <saurik@saurik.com>
Mon, 4 Oct 2010 09:40:27 +0000 (02:40 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 4 Oct 2010 09:45:29 +0000 (09:45 +0000)
15 files changed:
.gitignore [new file with mode: 0644]
Cydia.mm
Reachability.m [deleted file]
Reachability.mm [new file with mode: 0644]
UICaboodle/BrowserView.h
UICaboodle/BrowserView.mm
UICaboodle/RVBook.h
UICaboodle/RVBook.mm
UICaboodle/RVPage.h
UICaboodle/ResetView.h
UICaboodle/ResetView.mm
compiling.txt [new file with mode: 0644]
iPhonePrivate.h [new file with mode: 0644]
makefile
sysroot.sh [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..a4a6c1c
--- /dev/null
@@ -0,0 +1,4 @@
+sysroot
+Cydia
+_
+*.deb
index 005dc2ee6e4daa1a91008afc4e293236f5f22cd3..efbb9b83afb866794315bc7123d6dca5a1e2d096 100644 (file)
--- a/Cydia.mm
+++ b/Cydia.mm
 #define USE_SYSTEM_MALLOC 1
 
 /* #include Directives {{{ */
-#import "UICaboodle/UCPlatform.h"
-#import "UICaboodle/UCLocalize.h"
+#include "UICaboodle/UCPlatform.h"
+#include "UICaboodle/UCLocalize.h"
 
 #include <objc/objc.h>
 #include <objc/runtime.h>
 
 #include <CoreGraphics/CoreGraphics.h>
-#include <GraphicsServices/GraphicsServices.h>
 #include <Foundation/Foundation.h>
 
 #if 0
 #include <CoreFoundation/CFPriv.h>
 #include <CoreFoundation/CFUniChar.h>
 
-#import <UIKit/UIKit.h>
+#include <UIKit/UIKit.h>
+#include "iPhonePrivate.h"
+
+#include <IOKit/IOKitLib.h>
 
 #include <WebCore/WebCoreThread.h>
-#import <WebKit/WebDefaultUIKitDelegate.h>
 
 #include <algorithm>
 #include <iomanip>
 #include <sys/param.h>
 #include <sys/mount.h>
 
+#include <fcntl.h>
 #include <notify.h>
 #include <dlfcn.h>
 
@@ -116,55 +118,13 @@ extern "C" {
 
 #include <ext/hash_map>
 
-#include <notify.h>
-
-#import "UICaboodle/BrowserView.h"
-#import "UICaboodle/ResetView.h"
+#include "UICaboodle/BrowserView.h"
+#include "UICaboodle/ResetView.h"
 
-#import "substrate.h"
+#include "substrate.h"
 
 // Apple's sample Reachability code, ASPL licensed.
-#import "Reachability.h"
-/* }}} */
-
-/* Header Fixes and Updates {{{ */
-typedef enum {
-   UIModalPresentationFullScreen = 0,
-   UIModalPresentationPageSheet,
-   UIModalPresentationFormSheet,
-   UIModalPresentationCurrentContext,
-} UIModalPresentationStyle;
-
-@interface UIAlertView (Private)
-- (void)setNumberOfRows:(int)rows;
-- (void)setContext:(id)context;
-- (id)context;
-@end
-
-@interface UIViewController (UIKit)
-- (id)navigationItem;
-- (id)navigationController;
-- (id)tabBarItem;
-@end
-
-@interface UITabBarController : UIViewController {
-    id _tabBar;
-    id _containerView;
-    id _viewControllerTransitionView;
-    id _viewControllers;
-    id _tabBarItemsToViewControllers;
-    id _selectedViewController;
-    id _moreNavigationController;
-    id _customizableViewControllers;
-    id _delegate;
-    id _selectedViewControllerDuringWillAppear;
-    id _transientViewController;
-    unsigned int isShowingMoreItem:1;
-    unsigned int needsToRebuildItems:1;
-    unsigned int isBarHidden:1;
-    unsigned int editButtonOnLeft:1;
-}
-@end
+#include "Reachability.h"
 /* }}} */
 
 /* Profiler {{{ */
@@ -686,10 +646,6 @@ NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *s
     return length;
 }
 
-@interface NSString (UIKit)
-- (NSString *) stringByAddingPercentEscapes;
-@end
-
 /* Cydia NSString Additions {{{ */
 @interface NSString (Cydia)
 + (NSString *) stringWithUTF8BytesNoCopy:(const char *)bytes length:(int)length;
@@ -1250,13 +1206,15 @@ bool isSectionVisible(NSString *section) {
 - (void) installPackage:(Package *)package;
 - (void) installPackages:(NSArray *)packages;
 - (void) removePackage:(Package *)package;
+- (void) beginUpdate;
+- (BOOL) updating;
 - (void) distUpgrade;
 - (void) updateData;
 - (void) syncData;
 - (void) showSettings;
 - (UIProgressHUD *) addProgressHUD;
 - (void) removeProgressHUD:(UIProgressHUD *)hud;
-- (UIViewController *) pageForPackage:(NSString *)name;
+- (UCViewController *) pageForPackage:(NSString *)name;
 - (PackageController *) packageController;
 @end
 /* }}} */
@@ -1448,7 +1406,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
 @end
 /* }}} */
 /* Delegate Helpers {{{ */
-@implementation NSObject(ProgressDelegate)
+@implementation NSObject (ProgressDelegate)
 
 - (void) _setProgressErrorPackage:(NSArray *)args {
     [self performSelector:@selector(setProgressError:forPackage:)
@@ -1474,7 +1432,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;
 - (void) setProgressError:(NSString *)error forPackage:(NSString *)id {
     Package *package = id == nil ? nil : [[Database sharedInstance] packageWithName:id];
     // XXX: holy typecast batman!
-    [self setProgressError:error withTitle:(package == nil ? id : [package name])];
+    [(id<ProgressDelegate>)self setProgressError:error withTitle:(package == nil ? id : [package name])];
 }
 
 @end
@@ -4292,7 +4250,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [database_ setDelegate:self];
         delegate_ = delegate;
 
-        [[self view] setBackgroundColor:(CGColor *)[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]];
+        [[self view] setBackgroundColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:1.0f]];
 
         progress_ = [[UIProgressBar alloc] init];
         [progress_ setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin)];
@@ -4366,7 +4324,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) viewWillAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     [[self navigationItem] setHidesBackButton:YES];
-    [[[self navigationController] navigationBar] setBarStyle:1];
+    [[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
     
     [self positionViews];
 }
@@ -4649,8 +4607,12 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 /* }}} */
 
 /* Cell Content View {{{ */
+@protocol ContentDelegate
+- (void) drawContentRect:(CGRect)rect;
+@end
+
 @interface ContentView : UIView {
-    _transient id delegate_;
+    _transient id<ContentDelegate> delegate_;
 }
 
 @end
@@ -4663,7 +4625,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     } return self;
 }
 
-- (void) setDelegate:(id)delegate {
+- (void) setDelegate:(id<ContentDelegate>)delegate {
     delegate_ = delegate;
 }
 
@@ -4674,7 +4636,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Package Cell {{{ */
-@interface PackageCell : UITableViewCell {
+@interface PackageCell : UITableViewCell <
+    ContentDelegate
+> {
     UIImage *icon_;
     NSString *name_;
     NSString *description_;
@@ -4889,7 +4853,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Section Cell {{{ */
-@interface SectionCell : UITableViewCell {
+@interface SectionCell : UITableViewCell <
+    ContentDelegate
+> {
     NSString *basic_;
     NSString *section_;
     NSString *name_;
@@ -4900,7 +4866,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     BOOL editing_;
 }
 
-- (id) init;
 - (void) setSection:(Section *)section editing:(BOOL)editing;
 
 @end
@@ -4997,7 +4962,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             [switch_ setOn:(isSectionVisible(basic_) ? 1 : 0) animated:NO];
     }
 
-    [self setAccessoryType:editing ? 0 : 1 /*UITableViewCellAccessoryDisclosureIndicator*/];
+    [self setAccessoryType:editing ? UITableViewCellAccessoryNone : UITableViewCellAccessoryDisclosureIndicator];
     [content_ setNeedsDisplay];
 }
 
@@ -5036,7 +5001,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 /* }}} */
 
 /* File Table {{{ */
-@interface FileTable : CYViewController {
+@interface FileTable : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     Package *package_;
     NSString *name_;
@@ -5078,7 +5046,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [cell setFont:[UIFont systemFontOfSize:16]];
     }
     [cell setText:[files_ objectAtIndex:indexPath.row]];
-    [cell setSelectionStyle:0 /*UITableViewCellSelectionStyleNone*/];
+    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
 
     return cell;
 }
@@ -5208,8 +5176,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         }
         
         [sheet dismissWithClickedButtonIndex:-1 animated:YES];
-    } else {
-        [super alertSheet:sheet clickedButtonAtIndex:button];
     }
 }
 
@@ -5361,7 +5327,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Package Table {{{ */
-@interface PackageTable : UIView {
+@interface PackageTable : UIView <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     NSMutableArray *packages_;
     NSMutableArray *sections_;
@@ -5425,7 +5394,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 }
 
 - (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
-    PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+    PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]);
     if (cell == nil)
         cell = [[[PackageCell alloc] init] autorelease];
     [cell setPackage:[self packageAtIndexPath:path]];
@@ -5699,7 +5668,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Source Cell {{{ */
-@interface SourceCell : UITableViewCell {
+@interface SourceCell : UITableViewCell <
+    ContentDelegate
+> {
     UIImage *icon_;
     NSString *origin_;
     NSString *description_;
@@ -5793,7 +5764,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 /* Source Table {{{ */
-@interface SourceTable : CYViewController {
+@interface SourceTable : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     UITableView *list_;
     NSMutableArray *sources_;
@@ -5814,6 +5788,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (id) initWithDatabase:(Database *)database;
 
+- (void) updateButtonsForEditingStatus:(BOOL)editing animated:(BOOL)animated;
+
 @end
 
 @implementation SourceTable
@@ -5899,8 +5875,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     return cell;
 }
 
-- (int) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
-    return 1; //UITableViewCellAccessoryDisclosureIndicator?
+- (UITableViewCellAccessoryType) tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
+    return UITableViewCellAccessoryDisclosureIndicator;
 }
 
 - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -6255,6 +6231,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (id) initWithDatabase:(Database *)database;
 
+- (void) updateRoleButton;
+- (void) queueStatusDidChange;
+
 @end
 
 @implementation InstalledController
@@ -6386,6 +6365,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @interface ManageController : CYBrowserController {
 }
 
+- (void) queueStatusDidChange;
 @end
 
 @implementation ManageController
@@ -6499,10 +6479,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [self setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
 
         [self setTintColor:[UIColor colorWithRed:0.23 green:0.23 blue:0.23 alpha:1]];
-        [self setBarStyle:1];
+        [self setBarStyle:UIBarStyleBlack];
 
-        int barstyle([self _barStyle:NO]);
-        bool ugly(barstyle == 0);
+        UIBarStyle barstyle([self _barStyle:NO]);
+        bool ugly(barstyle == UIBarStyleDefault);
 
         UIProgressIndicatorStyle style = ugly ?
             UIProgressIndicatorStyleMediumBrown :
@@ -6558,6 +6538,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 @end
 /* }}} */
 
+@class CYNavigationController;
+
 /* Cydia Tab Bar Controller {{{ */
 @interface CYTabBarController : UITabBarController {
     Database *database_;
@@ -6573,7 +6555,7 @@ freeing the view controllers on tab change */
 - (void) reloadData {
     size_t count([[self viewControllers] count]);
     for (size_t i(0); i != count; ++i) {
-        UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
+        CYNavigationController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
         [page reloadData];
     }
 }
@@ -6588,9 +6570,7 @@ freeing the view controllers on tab change */
 /* }}} */
 
 /* Cydia Navigation Controller {{{ */
-@interface CYNavigationController : UINavigationController <
-    ProgressDelegate
-> {
+@interface CYNavigationController : UINavigationController {
     _transient Database *database_;
     id delegate_;
 }
@@ -6619,7 +6599,7 @@ freeing the view controllers on tab change */
 - (void) reloadData {
     size_t count([[self viewControllers] count]);
     for (size_t i(0); i != count; ++i) {
-        UIViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
+        CYViewController *page([[self viewControllers] objectAtIndex:(count - i - 1)]);
         [page reloadData];
     }
 }
@@ -6738,7 +6718,10 @@ freeing the view controllers on tab change */
 /* }}} */
 
 /* Sections Controller {{{ */
-@interface SectionsController : CYViewController {
+@interface SectionsController : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     NSMutableArray *sections_;
     NSMutableArray *filtered_;
@@ -6751,6 +6734,8 @@ freeing the view controllers on tab change */
 - (void) reloadData;
 - (void) resetView;
 
+- (void) editButtonClicked;
+
 @end
 
 @implementation SectionsController
@@ -6967,7 +6952,10 @@ freeing the view controllers on tab change */
 @end
 /* }}} */
 /* Changes Controller {{{ */
-@interface ChangesController : CYViewController {
+@interface ChangesController : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     NSMutableArray *packages_;
     NSMutableArray *sections_;
@@ -7027,7 +7015,7 @@ freeing the view controllers on tab change */
 }
 
 - (UITableViewCell *) tableView:(UITableView *)table cellForRowAtIndexPath:(NSIndexPath *)path {
-    PackageCell *cell([table dequeueReusableCellWithIdentifier:@"Package"]);
+    PackageCell *cell((PackageCell *) [table dequeueReusableCellWithIdentifier:@"Package"]);
     if (cell == nil)
         cell = [[[PackageCell alloc] init] autorelease];
     [cell setPackage:[self packageAtIndexPath:path]];
@@ -7048,7 +7036,7 @@ freeing the view controllers on tab change */
 }
 
 - (void) refreshButtonClicked {
-    [[UIApplication sharedApplication] beginUpdate];
+    [delegate_ beginUpdate];
     [[self navigationItem] setLeftBarButtonItem:nil];
 }
 
@@ -7187,15 +7175,17 @@ freeing the view controllers on tab change */
         target:self
         action:@selector(refreshButtonClicked)
     ];
-    if (![[UIApplication sharedApplication] updating]) [[self navigationItem] setLeftBarButtonItem:leftItem];
+    if (![delegate_ updating]) [[self navigationItem] setLeftBarButtonItem:leftItem];
     [leftItem release];
 }
 
 @end
 /* }}} */
 /* Search Controller {{{ */
-@interface SearchController : FilteredPackageController {
-    id search_;
+@interface SearchController : FilteredPackageController <
+    UISearchBarDelegate
+> {
+    UISearchBar *search_;
 }
 
 - (id) initWithDatabase:(Database *)database;
@@ -7230,7 +7220,7 @@ freeing the view controllers on tab change */
 - (void)viewDidAppear:(BOOL)animated {
        [super viewDidAppear:animated];
        if (!search_) {
-        search_ = [[objc_getClass("UISearchBar") alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)];
+        search_ = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, [[self view] bounds].size.width, 44.0f)];
         [search_ layoutSubviews];
         [search_ setPlaceholder:UCLocalize("SEARCH_EX")];
         UITextField *textField = [search_ searchField];
@@ -7260,7 +7250,10 @@ freeing the view controllers on tab change */
 @end
 /* }}} */
 /* Settings Controller {{{ */
-@interface SettingsController : CYViewController {
+@interface SettingsController : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     NSString *name_;
     Package *package_;
@@ -7438,13 +7431,20 @@ freeing the view controllers on tab change */
 @end
 /* }}} */
 /* Role Controller {{{ */
-@interface RoleController : CYViewController {
+@interface RoleController : CYViewController <
+    UITableViewDataSource,
+    UITableViewDelegate
+> {
     _transient Database *database_;
     id roledelegate_;
     UITableView *table_;
     UISegmentedControl *segment_;
     UIView *container_;
 }
+
+- (void) showDoneButton;
+- (void) resizeSegmentedControl;
+
 @end
 
 @implementation RoleController
@@ -7605,9 +7605,15 @@ freeing the view controllers on tab change */
     bool dropped_;
     bool updating_;
     id updatedelegate_;
-    UIViewController *root_;
+    UITabBarController *root_;
 }
 
+- (void) setTabBarController:(UITabBarController *)controller;
+
+- (void) dropBar:(BOOL)animated;
+- (void) beginUpdate;
+- (void) raiseBar:(BOOL)animated;
+
 @end
 
 @implementation CYContainer
@@ -7639,7 +7645,7 @@ freeing the view controllers on tab change */
     return YES; /* XXX: return YES; */
 }
 
-- (void) setRootController:(UIViewController *)controller {
+- (void) setTabBarController:(UITabBarController *)controller {
     root_ = controller;
     [[self view] addSubview:[root_ view]];
 }
@@ -7862,8 +7868,8 @@ typedef enum {
     bool loaded_;
 }
 
-- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
-- (void) setPage:(UIViewController *)page;
+- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class;
+- (void) setPage:(UCViewController *)page;
 
 @end
 
@@ -7945,7 +7951,7 @@ static _finline void _setHomePage(Cydia *self) {
     if (tag_ != 4 && search_ != nil)
         [search_ reloadData];
 
-    [[tabbar_ selectedViewController] reloadData];
+    [(CYNavigationController *)[tabbar_ selectedViewController] reloadData];
 }
 
 - (int)indexOfTabWithTag:(int)tag {
@@ -8187,17 +8193,17 @@ static _finline void _setHomePage(Cydia *self) {
     [self complete];
 }
 
-- (void) setPage:(UIViewController *)page {
+- (void) setPage:(UCViewController *)page {
     [page setDelegate:self];
 
-    UINavigationController *navController = [tabbar_ selectedViewController];
+    CYNavigationController *navController = (CYNavigationController *) [tabbar_ selectedViewController];
     [navController setViewControllers:[NSArray arrayWithObject:page] animated:NO];
-    for (UIViewController *page in [tabbar_ viewControllers]) {
+    for (CYNavigationController *page in [tabbar_ viewControllers]) {
         if (page != navController) [page setViewControllers:nil];
     }
 }
 
-- (UIViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
+- (UCViewController *) _pageForURL:(NSURL *)url withClass:(Class)_class {
     CYBrowserController *browser = [[[_class alloc] init] autorelease];
     [browser loadURL:url];
     return browser;
@@ -8249,7 +8255,7 @@ static _finline void _setHomePage(Cydia *self) {
 - (void) tabBarController:(id)tabBarController didSelectViewController:(UIViewController *)viewController {    
     int tag = [[viewController tabBarItem] tag];
     if (tag == tag_) {
-        [[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
+        [(CYNavigationController *)[tabbar_ selectedViewController] popToRootViewControllerAnimated:YES];
         return;
     } else if (tag_ == 1) {
         [[self sectionsController] resetView];
@@ -8333,7 +8339,7 @@ static _finline void _setHomePage(Cydia *self) {
             Queuing_ = true;
 
             [[[[tabbar_ viewControllers] objectAtIndex:[self indexOfTabWithTag:kManageTag] != -1 ? [self indexOfTabWithTag:kManageTag] : [self indexOfTabWithTag:kInstalledTag]] tabBarItem] setBadgeValue:UCLocalize("Q_D")];
-            [[tabbar_ selectedViewController] reloadData];
+            [(CYNavigationController *)[tabbar_ selectedViewController] reloadData];
             
             [queueDelegate_ queueStatusDidChange];
         }
@@ -8426,7 +8432,7 @@ static _finline void _setHomePage(Cydia *self) {
     [window_ setUserInteractionEnabled:YES];
 }
 
-- (UIViewController *) pageForPackage:(NSString *)name {
+- (UCViewController *) pageForPackage:(NSString *)name {
     if (Package *package = [database_ packageWithName:name]) {
         PackageController *view([self packageController]);
         [view setPackage:package];
@@ -8438,7 +8444,7 @@ static _finline void _setHomePage(Cydia *self) {
     }
 }
 
-- (UIViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
+- (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag {
     if (tag != NULL)
         *tag = -1;
 
@@ -8490,7 +8496,7 @@ static _finline void _setHomePage(Cydia *self) {
 - (void) applicationOpenURL:(NSURL *)url {
     [super applicationOpenURL:url];
     int tag;
-    if (UIViewController *page = [self pageForURL:url hasTag:&tag]) {
+    if (UCViewController *page = [self pageForURL:url hasTag:&tag]) {
         [self setPage:page];
         tag_ = tag;
         [tabbar_ setSelectedViewController:(tag_ == -1 ? nil : [[tabbar_ viewControllers] objectAtIndex:tag_])];
@@ -8590,9 +8596,8 @@ static _finline void _setHomePage(Cydia *self) {
         [items insertObject:[[[UITabBarItem alloc] initWithTitle:UCLocalize("MANAGE") image:[UIImage applicationImageNamed:@"manage.png"] tag:kManageTag] autorelease] atIndex:3];
     }
     
-    for (int i = 0; i < [items count]; i++) {
+    for (size_t i(0); i != [items count]; i++)
         [[controllers objectAtIndex:i] setTabBarItem:[items objectAtIndex:i]];
-    }
 
     tabbar_ = [[CYTabBarController alloc] initWithDatabase:database_];
     [tabbar_ setViewControllers:controllers];
@@ -8601,7 +8606,7 @@ static _finline void _setHomePage(Cydia *self) {
 
     container_ = [[CYContainer alloc] initWithDatabase:database_];
     [container_ setUpdateDelegate:self];
-    [container_ setRootController:tabbar_];
+    [container_ setTabBarController:tabbar_];
     [window_ addSubview:[container_ view]];
     [[tabbar_ view] setFrame:CGRectMake(0, -20.0f, [window_ bounds].size.width, [window_ bounds].size.height)];
 
diff --git a/Reachability.m b/Reachability.m
deleted file mode 100644 (file)
index 5ecdcf4..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- File: Reachability.m
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
- Version: 2.2
- Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms.  If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple.  Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
- The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
-*/
-
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-
-#import <CoreFoundation/CoreFoundation.h>
-
-#import "Reachability.h"
-
-#define kShouldPrintReachabilityFlags 1
-
-static void PrintReachabilityFlags(SCNetworkReachabilityFlags    flags, const char* comment)
-{
-#if kShouldPrintReachabilityFlags
-       
-    NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
-                       (flags & kSCNetworkReachabilityFlagsIsWWAN)                               ? 'W' : '-',
-                       (flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
-                       
-                       (flags & kSCNetworkReachabilityFlagsTransientConnection)  ? 't' : '-',
-                       (flags & kSCNetworkReachabilityFlagsConnectionRequired)   ? 'c' : '-',
-                       (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic)  ? 'C' : '-',
-                       (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
-                       (flags & kSCNetworkReachabilityFlagsConnectionOnDemand)   ? 'D' : '-',
-                       (flags & kSCNetworkReachabilityFlagsIsLocalAddress)       ? 'l' : '-',
-                       (flags & kSCNetworkReachabilityFlagsIsDirect)             ? 'd' : '-',
-                       comment
-                       );
-#endif
-}
-
-
-@implementation Reachability
-static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
-       #pragma unused (target, flags)
-       NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
-       NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
-
-       //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
-       // in case someon uses the Reachablity object in a different thread.
-       NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
-       
-       Reachability* noteObject = (Reachability*) info;
-       // Post a notification to notify the client that the network reachability changed.
-       [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
-       
-       [myPool release];
-}
-
-- (BOOL) startNotifier
-{
-       BOOL retVal = NO;
-       SCNetworkReachabilityContext    context = {0, self, NULL, NULL, NULL};
-       if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
-       {
-               if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
-               {
-                       retVal = YES;
-               }
-       }
-       return retVal;
-}
-
-- (void) stopNotifier
-{
-       if(reachabilityRef!= NULL)
-       {
-               SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
-       }
-}
-
-- (void) dealloc
-{
-       [self stopNotifier];
-       if(reachabilityRef!= NULL)
-       {
-               CFRelease(reachabilityRef);
-       }
-       [super dealloc];
-}
-
-+ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
-{
-       Reachability* retVal = NULL;
-       SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
-       if(reachability!= NULL)
-       {
-               retVal= [[[self alloc] init] autorelease];
-               if(retVal!= NULL)
-               {
-                       retVal->reachabilityRef = reachability;
-                       retVal->localWiFiRef = NO;
-               }
-       }
-       return retVal;
-}
-
-+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
-{
-       SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
-       Reachability* retVal = NULL;
-       if(reachability!= NULL)
-       {
-               retVal= [[[self alloc] init] autorelease];
-               if(retVal!= NULL)
-               {
-                       retVal->reachabilityRef = reachability;
-                       retVal->localWiFiRef = NO;
-               }
-       }
-       return retVal;
-}
-
-+ (Reachability*) reachabilityForInternetConnection;
-{
-       struct sockaddr_in zeroAddress;
-       bzero(&zeroAddress, sizeof(zeroAddress));
-       zeroAddress.sin_len = sizeof(zeroAddress);
-       zeroAddress.sin_family = AF_INET;
-       return [self reachabilityWithAddress: &zeroAddress];
-}
-
-+ (Reachability*) reachabilityForLocalWiFi;
-{
-       struct sockaddr_in localWifiAddress;
-       bzero(&localWifiAddress, sizeof(localWifiAddress));
-       localWifiAddress.sin_len = sizeof(localWifiAddress);
-       localWifiAddress.sin_family = AF_INET;
-       // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
-       localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
-       Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
-       if(retVal!= NULL)
-       {
-               retVal->localWiFiRef = YES;
-       }
-       return retVal;
-}
-
-#pragma mark Network Flag Handling
-
-- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
-       PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
-
-       BOOL retVal = NotReachable;
-       if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
-       {
-               retVal = ReachableViaWiFi;      
-       }
-       return retVal;
-}
-
-- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
-{
-       PrintReachabilityFlags(flags, "networkStatusForFlags");
-       if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
-       {
-               // if target host is not reachable
-               return NotReachable;
-       }
-
-       BOOL retVal = NotReachable;
-       
-       if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
-       {
-               // if target host is reachable and no connection is required
-               //  then we'll assume (for now) that your on Wi-Fi
-               retVal = ReachableViaWiFi;
-       }
-       
-       
-       if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
-               (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
-       {
-                       // ... and the connection is on-demand (or on-traffic) if the
-                       //     calling application is using the CFSocketStream or higher APIs
-
-                       if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
-                       {
-                               // ... and no [user] intervention is needed
-                               retVal = ReachableViaWiFi;
-                       }
-               }
-       
-       if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
-       {
-               // ... but WWAN connections are OK if the calling application
-               //     is using the CFNetwork (CFSocketStream?) APIs.
-               retVal = ReachableViaWWAN;
-       }
-       return retVal;
-}
-
-- (BOOL) connectionRequired;
-{
-       NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
-       SCNetworkReachabilityFlags flags;
-       if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
-       {
-               return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
-       }
-       return NO;
-}
-
-- (NetworkStatus) currentReachabilityStatus
-{
-       NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
-       NetworkStatus retVal = NotReachable;
-       SCNetworkReachabilityFlags flags;
-       if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
-       {
-               if(localWiFiRef)
-               {
-                       retVal = [self localWiFiStatusForFlags: flags];
-               }
-               else
-               {
-                       retVal = [self networkStatusForFlags: flags];
-               }
-       }
-       return retVal;
-}
-@end
diff --git a/Reachability.mm b/Reachability.mm
new file mode 100644 (file)
index 0000000..31c0ed0
--- /dev/null
@@ -0,0 +1,273 @@
+/*
+ File: Reachability.m
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
+ Version: 2.2
+ Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms.  If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple.  Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Copyright (C) 2010 Apple Inc. All Rights Reserved.
+*/
+
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+#import <CoreFoundation/CoreFoundation.h>
+
+#import "Reachability.h"
+
+#define kShouldPrintReachabilityFlags 1
+
+static void PrintReachabilityFlags(SCNetworkReachabilityFlags    flags, const char* comment)
+{
+#if kShouldPrintReachabilityFlags
+       
+    NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
+                       (flags & kSCNetworkReachabilityFlagsIsWWAN)                               ? 'W' : '-',
+                       (flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
+                       
+                       (flags & kSCNetworkReachabilityFlagsTransientConnection)  ? 't' : '-',
+                       (flags & kSCNetworkReachabilityFlagsConnectionRequired)   ? 'c' : '-',
+                       (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic)  ? 'C' : '-',
+                       (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
+                       (flags & kSCNetworkReachabilityFlagsConnectionOnDemand)   ? 'D' : '-',
+                       (flags & kSCNetworkReachabilityFlagsIsLocalAddress)       ? 'l' : '-',
+                       (flags & kSCNetworkReachabilityFlagsIsDirect)             ? 'd' : '-',
+                       comment
+                       );
+#endif
+}
+
+
+@implementation Reachability
+static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
+{
+       #pragma unused (target, flags)
+       NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
+       NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
+
+       //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
+       // in case someon uses the Reachablity object in a different thread.
+       NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
+       
+       Reachability* noteObject = (Reachability*) info;
+       // Post a notification to notify the client that the network reachability changed.
+       [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
+       
+       [myPool release];
+}
+
+- (BOOL) startNotifier
+{
+       BOOL retVal = NO;
+       SCNetworkReachabilityContext    context = {0, self, NULL, NULL, NULL};
+       if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
+       {
+               if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
+               {
+                       retVal = YES;
+               }
+       }
+       return retVal;
+}
+
+- (void) stopNotifier
+{
+       if(reachabilityRef!= NULL)
+       {
+               SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+       }
+}
+
+- (void) dealloc
+{
+       [self stopNotifier];
+       if(reachabilityRef!= NULL)
+       {
+               CFRelease(reachabilityRef);
+       }
+       [super dealloc];
+}
+
++ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
+{
+       Reachability* retVal = NULL;
+       SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
+       if(reachability!= NULL)
+       {
+               retVal= [[[self alloc] init] autorelease];
+               if(retVal!= NULL)
+               {
+                       retVal->reachabilityRef = reachability;
+                       retVal->localWiFiRef = NO;
+               }
+       }
+       return retVal;
+}
+
++ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
+{
+       SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
+       Reachability* retVal = NULL;
+       if(reachability!= NULL)
+       {
+               retVal= [[[self alloc] init] autorelease];
+               if(retVal!= NULL)
+               {
+                       retVal->reachabilityRef = reachability;
+                       retVal->localWiFiRef = NO;
+               }
+       }
+       return retVal;
+}
+
++ (Reachability*) reachabilityForInternetConnection;
+{
+       struct sockaddr_in zeroAddress;
+       bzero(&zeroAddress, sizeof(zeroAddress));
+       zeroAddress.sin_len = sizeof(zeroAddress);
+       zeroAddress.sin_family = AF_INET;
+       return [self reachabilityWithAddress: &zeroAddress];
+}
+
++ (Reachability*) reachabilityForLocalWiFi;
+{
+       struct sockaddr_in localWifiAddress;
+       bzero(&localWifiAddress, sizeof(localWifiAddress));
+       localWifiAddress.sin_len = sizeof(localWifiAddress);
+       localWifiAddress.sin_family = AF_INET;
+       // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
+       localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
+       Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
+       if(retVal!= NULL)
+       {
+               retVal->localWiFiRef = YES;
+       }
+       return retVal;
+}
+
+#pragma mark Network Flag Handling
+
+- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
+{
+       PrintReachabilityFlags(flags, "localWiFiStatusForFlags");
+
+       NetworkStatus retVal = NotReachable;
+       if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
+       {
+               retVal = ReachableViaWiFi;      
+       }
+       return retVal;
+}
+
+- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
+{
+       PrintReachabilityFlags(flags, "networkStatusForFlags");
+       if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
+       {
+               // if target host is not reachable
+               return NotReachable;
+       }
+
+       NetworkStatus retVal = NotReachable;
+       
+       if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
+       {
+               // if target host is reachable and no connection is required
+               //  then we'll assume (for now) that your on Wi-Fi
+               retVal = ReachableViaWiFi;
+       }
+       
+       
+       if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
+               (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
+       {
+                       // ... and the connection is on-demand (or on-traffic) if the
+                       //     calling application is using the CFSocketStream or higher APIs
+
+                       if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
+                       {
+                               // ... and no [user] intervention is needed
+                               retVal = ReachableViaWiFi;
+                       }
+               }
+       
+       if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN)
+       {
+               // ... but WWAN connections are OK if the calling application
+               //     is using the CFNetwork (CFSocketStream?) APIs.
+               retVal = ReachableViaWWAN;
+       }
+       return retVal;
+}
+
+- (BOOL) connectionRequired;
+{
+       NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
+       SCNetworkReachabilityFlags flags;
+       if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
+       {
+               return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
+       }
+       return NO;
+}
+
+- (NetworkStatus) currentReachabilityStatus
+{
+       NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
+       NetworkStatus retVal = NotReachable;
+       SCNetworkReachabilityFlags flags;
+       if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
+       {
+               if(localWiFiRef)
+               {
+                       retVal = [self localWiFiStatusForFlags: flags];
+               }
+               else
+               {
+                       retVal = [self networkStatusForFlags: flags];
+               }
+       }
+       return retVal;
+}
+@end
index ec779c94ab6ee8c9cf6aab42d1dd5daf1f1e06ee..2f77f84137d73ad68a55f9b76f816c8bb1baf1e2 100644 (file)
@@ -1,22 +1,9 @@
 #import "ResetView.h"
 
-#include <WebKit/DOMCSSPrimitiveValue.h>
-#include <WebKit/DOMCSSStyleDeclaration.h>
-#include <WebKit/DOMDocument.h>
-#include <WebKit/DOMHTMLBodyElement.h>
 #include <WebKit/DOMNodeList.h>
-#include <WebKit/DOMRGBColor.h>
-
 #include <WebKit/WebFrame.h>
-#include <WebKit/WebPolicyDelegate.h>
-#include <WebKit/WebPreferences.h>
 #include <WebKit/WebScriptObject.h>
-
-#import <WebKit/WebView.h>
-#import <WebKit/WebView-WebPrivate.h>
-
-#include <WebCore/Page.h>
-#include <WebCore/Settings.h>
+#include <WebKit/WebView.h>
 
 #import <JavaScriptCore/JavaScriptCore.h>
 
@@ -43,7 +30,9 @@
 - (UCViewController *) pageForURL:(NSURL *)url hasTag:(int *)tag;
 @end
 
-@interface BrowserController : UCViewController {
+@interface BrowserController : UCViewController <
+    HookProtocol
+> {
     UIScroller *scroller_;
     UIWebDocumentView *document_;
     UIProgressIndicator *indicator_;
 - (bool) promptForSensitive:(NSString *)name;
 - (bool) allowSensitiveRequests;
 
+- (void) alertView:(UIAlertView *)alert clickedButtonAtIndex:(NSInteger)button;
+- (void) applyRightButton;
+
+- (void) _startLoading;
+- (void) close;
+
 @end
\ No newline at end of file
index 5fa21e169094275ad80ee2a04a9ccfe85c5d9dfa..8dd2afa0405bc710c6cfe4b5bb24998c914a18f9 100644 (file)
@@ -1,12 +1,28 @@
+#include <UIKit/UIKit.h>
+#include "iPhonePrivate.h"
+
+#include "UCPlatform.h"
+
 #include <UICaboodle/BrowserView.h>
 #include <UICaboodle/UCLocalize.h>
 
-#import <QuartzCore/CALayer.h>
+//#include <QuartzCore/CALayer.h>
 // XXX: fix the minimum requirement
 extern NSString * const kCAFilterNearest;
 
 #include <WebCore/WebCoreThread.h>
-#include <WebKit/WebPreferences-WebPrivate.h>
+
+#include <WebKit/WebPolicyDelegate.h>
+#include <WebKit/WebPreferences.h>
+
+#include <WebKit/DOMCSSPrimitiveValue.h>
+#include <WebKit/DOMCSSStyleDeclaration.h>
+#include <WebKit/DOMDocument.h>
+#include <WebKit/DOMHTMLBodyElement.h>
+#include <WebKit/DOMRGBColor.h>
+
+//#include <WebCore/Page.h>
+//#include <WebCore/Settings.h>
 
 #include "substrate.h"
 
@@ -19,12 +35,10 @@ static CFArrayRef (*$GSSystemGetCapability)(CFStringRef);
 static Class $UIFormAssistant;
 static Class $UIWebBrowserView;
 
-@interface NSString (UIKit)
-- (NSString *) stringByAddingPercentEscapes;
-@end
-
 /* Indirect Delegate {{{ */
-@interface IndirectDelegate : NSObject {
+@interface IndirectDelegate : NSObject <
+    HookProtocol
+> {
     _transient volatile id delegate_;
 }
 
@@ -89,6 +103,11 @@ static Class $UIWebBrowserView;
     return nil;
 }
 
+- (void) didDismissModalViewController {
+    if (delegate_ != nil)
+        return [delegate_ didDismissModalViewController];
+}
+
 - (IMP) methodForSelector:(SEL)sel {
     if (IMP method = [super methodForSelector:sel])
         return method;
@@ -125,11 +144,19 @@ static Class $UIWebBrowserView;
 /* }}} */
 
 @interface WebView (UICaboodle)
-- (void) setScriptDebugDelegate:(id)delegate;
++ (BOOL) _canHandleRequest:(NSURLRequest *)request;
 - (void) _setFormDelegate:(id)delegate;
+- (void) _setLayoutInterval:(float)interval;
+- (void) setScriptDebugDelegate:(id)delegate;
 - (void) _setUIKitDelegate:(id)delegate;
+- (void) _setUsesLoaderCache:(BOOL)uses;
 - (void) setWebMailDelegate:(id)delegate;
-- (void) _setLayoutInterval:(float)interval;
+@end
+
+@interface WebPreferences (Apple)
++ (void) _setInitialDefaultTextEncodingToSystemEncoding;
+- (void) _setLayoutInterval:(NSInteger)interval;
+- (void) setOfflineWebApplicationCacheEnabled:(BOOL)enabled;
 @end
 
 @implementation WebScriptObject (UICaboodle)
@@ -356,7 +383,7 @@ static Class $UIWebBrowserView;
     if ([scroller_ respondsToSelector:@selector(setScrollerIndicatorSubrect:)])
         [scroller_ setScrollerIndicatorSubrect:subrect];
 
-    [document_ setValue:[NSValue valueWithSize:NSMakeSize(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
+    [document_ setValue:[NSValue valueWithSize:CGSizeMake(subrect.size.width, subrect.size.height)] forGestureAttribute:UIGestureAttributeVisibleSize];
 
     CGSize size(size_);
     size.height += extra;
@@ -581,7 +608,7 @@ static Class $UIWebBrowserView;
 }
 
 - (void) _openMailToURL:(NSURL *)url {
-    [UIApp openURL:url];// asPanel:YES];
+    [[UIApplication sharedApplication] openURL:url];// asPanel:YES];
 }
 
 - (void) webView:(WebView *)sender willBeginEditingFormElement:(id)element {
@@ -675,7 +702,7 @@ static Class $UIWebBrowserView;
 
         WebView *webview([document_ webView]);
         if (frame == [webview mainFrame])
-            [UIApp openURL:[request URL]];
+            [[UIApplication sharedApplication] openURL:[request URL]];
     }
 }
 
@@ -728,7 +755,7 @@ static Class $UIWebBrowserView;
     )) {
         url = open;
       open:
-        [UIApp openURL:url];
+        [[UIApplication sharedApplication] openURL:url];
         goto ignore;
     }
 
@@ -1027,17 +1054,13 @@ static Class $UIWebBrowserView;
        [self _startLoading];
 }
 
-- (UINavigationButtonStyle) rightButtonStyle {
+- (UIBarButtonItemStyle) rightButtonStyle {
     if (style_ == nil) normal:
-        return UINavigationButtonStyleNormal;
+        return UIBarButtonItemStylePlain;
     else if ([style_ isEqualToString:@"Normal"])
-        return UINavigationButtonStyleNormal;
-    else if ([style_ isEqualToString:@"Back"])
-        return UINavigationButtonStyleBack;
+        return UIBarButtonItemStylePlain;
     else if ([style_ isEqualToString:@"Highlighted"])
-        return UINavigationButtonStyleHighlighted;
-    else if ([style_ isEqualToString:@"Destructive"])
-        return UINavigationButtonStyleDestructive;
+        return UIBarButtonItemStyleDone;
     else goto normal;
 }
 
@@ -1522,8 +1545,12 @@ static Class $UIWebBrowserView;
 
     WebView *webview([document_ webView]);
     WebFrame *frame([webview mainFrame]);
+    WebPreferences *preferences([webview preferences]);
+
+    bool maybe([preferences javaScriptCanOpenWindowsAutomatically]);
+    [preferences setJavaScriptCanOpenWindowsAutomatically:NO];
 
-    id _private(MSHookIvar<id>(webview, "_private"));
+    /*id _private(MSHookIvar<id>(webview, "_private"));
     WebCore::Page *page(_private == nil ? NULL : MSHookIvar<WebCore::Page *>(_private, "page"));
     WebCore::Settings *settings(page == NULL ? NULL : page->settings());
 
@@ -1533,7 +1560,7 @@ static Class $UIWebBrowserView;
     else {
         no = settings->JavaScriptCanOpenWindowsAutomatically();
         settings->setJavaScriptCanOpenWindowsAutomatically(true);
-    }
+    }*/
 
     if (UIWindow *window = [[self view] window])
         if (UIResponder *responder = [window firstResponder])
@@ -1543,8 +1570,10 @@ static Class $UIWebBrowserView;
     JSGlobalContextRef context([frame globalContext]);
     JSObjectCallAsFunction(context, object, NULL, 0, NULL, NULL);
 
-    if (settings != NULL)
-        settings->setJavaScriptCanOpenWindowsAutomatically(no);
+    /*if (settings != NULL)
+        settings->setJavaScriptCanOpenWindowsAutomatically(no);*/
+
+    [preferences setJavaScriptCanOpenWindowsAutomatically:maybe];
 
     WebThreadUnlock();
 }
index b605cc657fccad8ec1902dbe37a80f557b90816d..09b1baf5e56583f1abf6d21fa5d969d5def28c33 100644 (file)
@@ -2,10 +2,14 @@
 
 #import <UIKit/UIKit.h>
 
+@protocol HookProtocol
+- (void) didDismissModalViewController;
+@end
+
 @interface UCNavigationController : UINavigationController {
-       id hook_;
+       id<HookProtocol> hook_;
 }
-- (void) setHook:(id)hook;
+- (void) setHook:(id<HookProtocol>)hook;
 @end
 
 
index 2271cee78f6806156c1b557a9f8d7a3146c8b95a..ba201aeff34372e8eac087cb00a7c1c84523e2a2 100644 (file)
@@ -1,12 +1,6 @@
 #import "RVBook.h"
 
-#import <UIKit/UINavigationBar.h>
-#import <UIKit/UINavigationItem.h>
-
-#import <UIKit/UITransitionView.h>
-
-#import <UIKit/UIView-Geometry.h>
-#import <UIKit/UIView-Hierarchy.h>
+#import <UIKit/UIKit.h>
 
 #import <Foundation/Foundation.h>
 #import <CoreGraphics/CGGeometry.h>
index 270c248fbf298928f5ef31f3de4293addcecb94b..d2f84fa5c5be2db43b1d7f7448df8b88770c2aa5 100644 (file)
@@ -6,5 +6,6 @@
        id delegate_; 
 }
 - (void)setDelegate:(id)delegate;
+- (void) reloadData;
 @end
 
index 1f9259038029997f36628c5e7d0eb8b6a691228b..9f9fafbef3062269e78e9e4cc4b8c283a00fb9a8 100644 (file)
@@ -8,17 +8,7 @@
 - (void) clearView;
 @end
 
-@interface UITable (RVBook)
-- (void) resetViewAnimated:(BOOL)animated;
-- (void) clearView;
-@end
-
 @interface UITableView (RVBook)
 - (void) resetViewAnimated:(BOOL)animated;
 - (void) clearView;
 @end
-
-@interface UISectionList (RVBook)
-- (void) resetViewAnimated:(BOOL)animated;
-- (void) clearView;
-@end
index bd1c8ee8b82d253abe55c47979dd7dfa14a1c43d..ffdb0431d45f41efc79e7328ac84d8b520e64c0f 100644 (file)
 
 @end
 
-@implementation UITable (RVBook)
-
-- (void) resetViewAnimated:(BOOL)animated {
-    [self selectRow:-1 byExtendingSelection:NO withFade:animated];
-}
-
-- (void) clearView {
-    [self clearAllData];
-}
-
-@end
-
 @implementation UITableView (RVBook)
 
 - (void) resetViewAnimated:(BOOL)animated {
 }
 
 @end
-
-@implementation UISectionList (RVBook)
-
-- (void) resetViewAnimated:(BOOL)animated {
-    [[self table] resetViewAnimated:animated];
-}
-
-- (void) clearView {
-    [[self table] clearView];
-}
-
-@end
diff --git a/compiling.txt b/compiling.txt
new file mode 100644 (file)
index 0000000..411d0b1
--- /dev/null
@@ -0,0 +1,5 @@
+0) use a Mac (I'm sorry, I really am)
+1) install Cydia Substrate (in beta)
+2) install Fink (the only sane choice)
+3) activate Fink (. /sw/bin/init.sh)
+4) fink install bash ldid wget
diff --git a/iPhonePrivate.h b/iPhonePrivate.h
new file mode 100644 (file)
index 0000000..8e63ef1
--- /dev/null
@@ -0,0 +1,307 @@
+#ifndef CYDIA_UIKITPRIVATE_H
+
+#include <GraphicsServices/GraphicsServices.h>
+
+typedef enum {
+    UIGestureAttributeMinDegrees,                 /*float*/
+    UIGestureAttributeMaxDegrees,                 /*float*/
+    UIGestureAttributeMinScale,                   /*float*/
+    UIGestureAttributeMaxScale,                   /*float*/
+    UIGestureAttributeIsZoomRubberBandEnabled,    /*BOOL*/
+    UIGestureAttributeZoomsFromCurrentToMinOrMax, /*BOOL*/
+    UIGestureAttributeVisibleSize,                /*CGSize*/
+    UIGestureAttributeUpdatesScroller,            /*BOOL*/
+} UIGestureAttribute;
+
+typedef enum {
+    UINavigationButtonStyleNormal,
+    UINavigationButtonStyleBack,
+    UINavigationButtonStyleHighlighted,
+    UINavigationButtonStyleDestructive
+} UINavigationButtonStyle;
+
+typedef enum {
+    UIProgressIndicatorStyleLargeWhite,
+    UIProgressIndicatorStyleMediumWhite,
+    UIProgressIndicatorStyleMediumBrown,
+    UIProgressIndicatorStyleSmallWhite,
+    UIProgressIndicatorStyleSmallBlack,
+    UIProgressIndicatorStyleTinyWhite,
+} UIProgressIndicatorStyle;
+
+
+@class WebView;
+
+
+@interface NSString (Apple)
+- (void) drawAtPoint:(CGPoint)point forWidth:(float)width withFont:(UIFont *)font ellipsis:(BOOL)ellipsis;
+- (NSString *) stringByAddingPercentEscapes;
+- (NSString *) stringByReplacingCharacter:(UniChar)from withCharacter:(UniChar)to;
+@end
+
+@interface NSURL (Apple)
+- (BOOL) isGoogleMapsURL;
+- (BOOL) isSpringboardHandledURL;
+// XXX: make this an enum
+- (NSURL *) itmsURL:(NSInteger *)store;
+- (NSURL *) mapsURL;
+- (NSURL *) phobosURL;
+- (NSURL *) youTubeURL;
+@end
+
+@interface NSValue (Apple)
++ (NSValue *) valueWithSize:(CGSize)size;
+@end
+
+
+@interface UIActionSheet (Apple)
+- (NSString *) context;
+@end
+
+@interface UIAlertView (Apple)
+- (void) addTextFieldWithValue:(NSString *)value label:(NSString *)label;
+- (id) buttons;
+- (NSString *) context;
+- (void) setContext:(NSString *)context;
+- (void) setNumberOfRows:(int)rows;
+- (void) setRunsModal:(BOOL)modal;
+- (UITextField *) textField;
+- (UITextField *) textFieldAtIndex:(NSUInteger)index;
+- (void) _updateFrameForDisplay;
+@end
+
+@interface UIApplication (Apple)
+- (void) applicationSuspend:(GSEventRef)event;
+- (void) _animateSuspension:(BOOL)suspend duration:(double)duration startTime:(double)start scale:(float)scale;
+- (void) applicationOpenURL:(NSURL *)url;
+- (void) applicationWillResignActive:(UIApplication *)application;
+- (void) applicationWillSuspend;
+- (void) launchApplicationWithIdentifier:(NSString *)identifier suspended:(BOOL)suspended;
+- (void) removeApplicationBadge;
+- (void) setApplicationBadge:(NSString *)badge;
+- (void) setApplicationBadgeString:(NSString *)badge;
+- (void) setStatusBarShowsProgress:(BOOL)shows;
+- (void) _setSuspended:(BOOL)suspended;
+- (void) terminateWithSuccess;
+@end
+
+@interface UIBarButtonItem (Apple)
+- (UIView *) view;
+@end
+
+@interface UIColor (Apple)
++ (UIColor *) pinStripeColor;
+@end
+
+@interface UIControl (Apple)
+- (void) addTarget:(id)target action:(SEL)action forEvents:(NSInteger)events;
+@end
+
+@interface UIDevice (Apple)
+- (BOOL) isWildcat;
+@end
+
+@interface UIImage (Apple)
++ (UIImage *) applicationImageNamed:(NSString *)name;
++ (UIImage *) imageAtPath:(NSString *)path;
+@end
+
+@interface UINavigationBar (Apple)
++ (CGSize) defaultSize;
+- (UIBarStyle) _barStyle:(BOOL)style;
+@end
+
+@interface UISearchBar (Apple)
+- (UITextField *) searchField;
+@end
+
+@interface UITabBarItem (Apple)
+- (void) setAnimatedBadge:(BOOL)animated;
+@end
+
+@interface UITableViewCell (Apple)
+- (float) selectionPercent;
+@end
+
+@interface UITextField (Apple)
+- (UITextInputTraits *) textInputTraits;
+@end
+
+@interface UITextView (Apple)
+- (UIFont *) font;
+- (void) setAllowsRubberBanding:(BOOL)rubberbanding;
+- (void) setFont:(UIFont *)font;
+- (void) setMarginTop:(int)margin;
+- (void) setTextColor:(UIColor *)color;
+@end
+
+@interface UIView (Apple)
+- (void) setEnabledGestures:(NSInteger)gestures;
+- (void) setGestureDelegate:(id)delegate;
+- (void) setNeedsDisplayOnBoundsChange:(BOOL)needs;
+- (void) setValue:(NSValue *)value forGestureAttribute:(NSInteger)attribute;
+- (void) setZoomScale:(float)scale duration:(double)duration;
+- (void) _setZoomScale:(float)scale duration:(double)duration;
+@end
+
+@interface UIViewController (Apple)
+- (void) _updateLayoutForStatusBarAndInterfaceOrientation;
+@end
+
+@interface UIWindow (Apple)
+- (UIResponder *) firstResponder;
+- (void) makeKey:(UIApplication *)application;
+- (void) orderFront:(UIApplication *)application;
+@end
+
+
+@interface UIFormAssistant : UIView
++ (UIFormAssistant *) sharedFormAssistant;
+- (CGRect) peripheralFrame;
+@end
+
+@interface UIKeyboard : UIView
++ (void) initImplementationNow;
+@end
+
+@interface UIProgressBar : UIView
++ (CGSize) defaultSize;
+- (void) setProgress:(float)progress;
+- (void) setStyle:(NSInteger)style;
+@end
+
+@interface UIProgressHUD : UIView
+- (id) initWithWindow:(UIWindow *)window;
+- (void) setText:(NSString *)text;
+- (void) show:(BOOL)show;
+@end
+
+@interface UIProgressIndicator : UIView
++ (CGSize) defaultSizeForStyle:(NSUInteger)style;
+- (NSUInteger) activityIndicatorViewStyle;
+- (void) setStyle:(UIProgressIndicatorStyle)style;
+- (void) startAnimation;
+@end
+
+@interface UIScroller : UIView
+- (CGSize) contentSize;
+- (BOOL) releaseRubberBandIfNecessary;
+- (void) scrollPointVisibleAtTopLeft:(CGPoint)point;
+- (void) scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;
+- (void) setAdjustForContentSizeChange:(BOOL)adjust;
+- (void) setAllowsRubberBanding:(BOOL)allows;
+- (void) setBounces:(BOOL)bounces;
+- (void) setClipsSubviews:(BOOL)clips;
+- (void) setContentSize:(CGSize)size;
+- (void) setDelegate:(id)delegate;
+- (void) setDirectionalScrolling:(BOOL)directional;
+- (void) setEventMode:(NSInteger)mode;
+- (void) setFixedBackgroundPattern:(BOOL)fixed;
+- (void) setOffset:(CGPoint)offset;
+- (void) setScrollHysteresis:(float)hysteresis;
+- (void) setScrollerIndicatorSubrect:(CGRect)rect;
+- (void) setScrollingEnabled:(BOOL)enabled;
+- (void) setShowBackgroundShadow:(BOOL)shows;
+- (void) setThumbDetectionEnabled:(BOOL)enabled;
+@end
+
+@interface UITextLabel : UIView
+- (void) setCentersHorizontally:(BOOL)centers;
+- (void) setColor:(UIColor *)color;
+- (void) setFont:(UIFont *)font;
+- (void) setText:(NSString *)text;
+@end
+
+@interface UIWebDocumentView : UIView
+- (CGRect) documentBounds;
+- (void) enableReachability;
+- (void) loadRequest:(NSURLRequest *)request;
+- (void) redrawScaledDocument;
+- (UIScroller *) _scroller;
+- (void) setAllowsImageSheet:(BOOL)allows;
+- (void) setAllowsMessaging:(BOOL)allows;
+- (void) setAutoresizes:(BOOL)autoresizes;
+- (void) setContentsPosition:(NSInteger)position;
+- (void) setDataDetectorTypes:(NSUInteger)types;
+- (void) setDelegate:(id)delegate;
+- (void) setDetectsPhoneNumbers:(BOOL)detects;
+- (void) _setDocumentType:(NSInteger)type;
+- (void) setDrawsGrid:(BOOL)draws;
+- (void) setFormEditingDelegate:(id)delegate;
+- (void) setInitialScale:(float)scale forDocumentTypes:(NSInteger)types;
+- (void) setInteractionDelegate:(id)delegate;
+- (void) setLogsTilingChanges:(BOOL)logs;
+- (void) setMinimumScale:(float)scale forDocumentTypes:(NSInteger)types;
+- (void) setMinimumSize:(CGSize)size;
+- (void) setMaximumScale:(float)scale forDocumentTypes:(NSInteger)tpyes;
+- (void) setSmoothsFonts:(BOOL)smooths;
+- (void) setTileMinificationFilter:(NSString *)filter;
+- (void) setTileSize:(CGSize)size;
+- (void) setTilingEnabled:(BOOL)enabled;
+- (void) setViewportSize:(CGSize)size forDocumentTypes:(NSInteger)types;
+- (void) setZoomsFocusedFormControl:(BOOL)zooms;
+- (void) useSelectionAssistantWithMode:(NSInteger)mode;
+- (WebView *) webView;
+- (void) webView:(WebView *)view attachRootLayer:(id)layer;
+- (void) webView:(WebView *)view didCommitLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFailLoadWithError:(id)error forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFinishDocumentLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFinishLoadForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFirstLayoutInFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didHideFullScreenForPlugInView:(id)plugin;
+- (void) webView:(WebView *)view didObserveDeferredContentChange:(NSInteger)change forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didReceiveDocTypeForFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view didReceiveMessage:(id)message;
+- (void) webView:(WebView *)view didReceiveViewportArguments:(id)arguments forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view formStateDidBlurNode:(id)state;
+- (void) webView:(WebView *)view formStateDidFocusNode:(id)state;
+- (void) webView:(WebView *)view needsScrollNotifications:(id)notifications forFrame:(WebFrame *)frame;
+- (id) webView:(WebView *)view plugInViewWithArguments:(id)arguments fromPlugInPackage:(id)package;
+- (void) webView:(WebView *)view restoreStateFromHistoryItem:(id)item forFrame:(WebFrame *)frame force:(BOOL)force;
+- (void) webView:(WebView *)view saveStateToHistoryItem:(id)item forFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view willAddPlugInView:(id)plugin;
+- (void) webView:(WebView *)view willCloseFrame:(WebFrame *)frame;
+- (void) webView:(WebView *)view willShowFullScreenForPlugInView:(id)plugin;
+- (BOOL) webView:(WebView *)view shouldScrollToPoint:(CGPoint)point forFrame:(WebFrame *)frame;
+- (void) webViewDidLayout:(WebView *)view;
+- (void) webViewDidPreventDefaultForEvent:(WebView *)view;
+- (void) webViewFormEditedStatusHasChanged:(WebView *)changed;
+@end
+
+
+@interface UINavigationButton : UIButton
+- (id) initWithTitle:(NSString *)title style:(UINavigationButtonStyle)style;
+- (void) setBarStyle:(UIBarStyle)style;
+@end
+
+@interface UIPushButton : UIControl
+- (id) backgroundForState:(NSUInteger)state;
+- (void) setAutosizesToFit:(BOOL)autosizes;
+- (void) setBackground:(id)background forState:(NSUInteger)state;
+- (void) setDrawsShadow:(BOOL)draws;
+- (void) setStretchBackground:(BOOL)stretch;
+- (void) setTitle:(NSString *)title;
+- (void) setTitleFont:(UIFont *)font;
+@end
+
+@interface UIThreePartButton : UIPushButton
+@end
+
+
+@interface WebDefaultUIKitDelegate : NSObject
++ (WebDefaultUIKitDelegate *) sharedUIKitDelegate;
+@end
+
+
+extern "C" CFStringRef const kGSDisplayIdentifiersCapability;
+
+extern "C" float const UIWebViewGrowsAndShrinksToFitHeight;
+extern "C" float const UIWebViewScalesToFitScale;
+
+
+extern "C" UIImage *_UIImageWithName(NSString *name);
+extern "C" void UISetColor(CGColorRef color);
+
+
+#endif//CYDIA_UIKITPRIVATE_H
index e13ebfabc7190e8097d0073c9c2824cc4bbd6b3f..ddb9024a8fdba0d4f4468921ea8b76e57cb0c32f 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,42 +1,67 @@
-ifndef PKG_TARG
-target :=
-else
-target := $(PKG_TARG)-
-endif
+ios := 3.2
+
+flags := 
+link := 
+
+#dpkg := /Library/Cydia/bin/dpkg-deb -Zlzma
+dpkg := dpkg-deb
+
+flags += -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(ios).sdk/System/Library/PrivateFrameworks
+flags += -I. -isystem sysroot/usr/include -Lsysroot/usr/lib
+flags += -Wall -Werror -Wno-deprecated-declarations
+flags += -fmessage-length=0
+flags += -g0 -O2
+flags += -fobjc-call-cxx-cdtors -fobjc-exceptions
+
+link += -framework CoreFoundation
+link += -framework CoreGraphics
+link += -framework Foundation
+link += -framework GraphicsServices
+link += -framework IOKit
+link += -framework JavaScriptCore
+link += -framework QuartzCore
+link += -framework SystemConfiguration
+link += -framework UIKit
+link += -framework WebCore
+link += -framework WebKit
+
+link += -lapr-1
+link += -lapt-pkg
+link += -lpcre
+
+link += -multiply_defined suppress
 
 all: Cydia
 
 clean:
        rm -f Cydia
 
-Cydia: Cydia.mm UICaboodle/*.mm ../mobilesubstrate/*.h #makefile
-       $(target)g++ -march=armv6 -mcpu=arm1176jzf-s -mthumb -I. -I../mobilesubstrate -fobjc-call-cxx-cdtors -g0 -O2 -Wall -Werror -o $@ $(filter %.mm,$^) -framework UIKit -framework IOKit -framework CoreFoundation -framework Foundation -framework CoreGraphics -framework GraphicsServices -framework QuartzCore -framework JavaScriptCore -framework WebCore -framework WebKit -lobjc -lapt-pkg -lpcre -fobjc-exceptions -F"$${PKG_ROOT}"/System/Library/PrivateFrameworks -multiply_defined suppress -lapr-1
-
-sign: Cydia
-       CODESIGN_ALLOCATE=$$(which "$(target)codesign_allocate") ldid -Slaunch.xml Cydia
+Cydia: Cydia.mm Reachability.mm UICaboodle/*.mm
+       cycc -r4.2 -i$(ios) -o$@ -- $(filter %.mm,$^) $(flags) $(link)
 
-package: sign
+package: Cydia
        rm -rf _
        mkdir -p _/var/lib/cydia
        
        mkdir -p _/usr/libexec
-       svn export Library _/usr/libexec/cydia
-       cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia
+       cp -a Library _/usr/libexec/cydia
+       # XXX: fix du
+       #cp -a /apl/tel/dest/iphoneos-arm/coreutils/usr/bin/du _/usr/libexec/cydia
        
        mkdir -p _/System/Library
-       svn export LaunchDaemons _/System/Library/LaunchDaemons
+       cp -a LaunchDaemons _/System/Library/LaunchDaemons
        
        mkdir -p _/Applications
-       svn export Cydia.app _/Applications/Cydia.app
+       cp -a Cydia.app _/Applications/Cydia.app
        cp -a Cydia _/Applications/Cydia.app/Cydia_
        chmod 6755 _/Applications/Cydia.app/Cydia_
        
        mkdir -p _/System/Library/PreferenceBundles
-       svn export CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle
+       cp -a CydiaSettings.bundle _/System/Library/PreferenceBundles/CydiaSettings.bundle
        
        mkdir -p _/DEBIAN
        echo "$$(cat control)"$$'\nInstalled-Size: '"$$(du -s _ | cut -f 1)" > _/DEBIAN/control
        
-       dpkg-deb -Zlzma -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
+       $(dpkg) -b _ $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
 
 .PHONY: all clean sign
diff --git a/sysroot.sh b/sysroot.sh
new file mode 100755 (executable)
index 0000000..db06c10
--- /dev/null
@@ -0,0 +1,111 @@
+#!/usr/bin/env bash
+
+if [[ ${BASH_VERSION} != 4* ]]; then
+    echo "bash 4.0 required" 1>&2
+    exit 1
+fi
+
+shopt -s extglob
+shopt -s nullglob
+
+PATH=/Library/Cydia/bin:$PATH
+
+rm -rf sysroot
+mkdir sysroot
+cd sysroot
+
+repository=http://apt.saurik.com/
+distribution=tangelo
+component=main
+architecture=iphoneos-arm
+
+wget -qO- "${repository}dists/${distribution}/${component}/binary-${architecture}/Packages.bz2" | bzcat | {
+    regex='^([^ \t]*): *(.*)'
+    declare -A fields
+
+    while IFS= read -r line; do
+        if [[ ${line} == '' ]]; then
+            package=${fields[package]}
+            if [[ ${package} == *(apr|apr-lib|apt7|apt7-lib|mobilesubstrate|pcre) ]]; then
+                filename=${fields[filename]}
+                wget -O "${package}.deb" "${repository}${filename}"
+                dpkg-deb -x "${package}.deb" .
+            fi
+
+            unset fields
+            declare -A fields
+        elif [[ ${line} =~ ${regex} ]]; then
+            name=${BASH_REMATCH[1],,}
+            value=${BASH_REMATCH[2]}
+            fields[${name}]=${value}
+        fi
+    done
+}
+
+rm -f *.deb
+
+mkdir -p usr/include
+cd usr/include
+
+mkdir CoreFoundation
+wget -O CoreFoundation/CFBundlePriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFBundlePriv.h?txt"
+wget -O CoreFoundation/CFPriv.h "http://www.opensource.apple.com/source/CF/CF-550/CFPriv.h?txt"
+wget -O CoreFoundation/CFUniChar.h "http://www.opensource.apple.com/source/CF/CF-550/CFUniChar.h?txt"
+
+if true; then
+    mkdir -p WebCore
+    wget -O WebCore/WebCoreThread.h 'http://www.opensource.apple.com/source/WebCore/WebCore-658.28/wak/WebCoreThread.h?txt'
+else
+    wget -O WebCore.tgz http://www.opensource.apple.com/tarballs/WebCore/WebCore-658.28.tar.gz
+    tar -zx --transform 's@^[^/]*/@WebCore.d/@' -f WebCore.tgz
+
+    mkdir WebCore
+    cp -a WebCore.d/{*,rendering/style,platform/graphics/transforms}/*.h WebCore
+    cp -a WebCore.d/platform/{animation,graphics,network,text}/*.h WebCore
+    cp -a WebCore.d/{accessibility,platform{,/{graphics,network,text}}}/{cf,mac,iphone}/*.h WebCore
+    cp -a WebCore.d/bridge/objc/*.h WebCore
+
+    wget -O JavaScriptCore.tgz http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-554.1.tar.gz
+    #tar -zx --transform 's@^[^/]*/API/@JavaScriptCore/@' -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | grep '/API/[^/]*.h$')
+    tar -zx \
+        --transform 's@^[^/]*/@@' \
+        --transform 's@^icu/@@' \
+    -f JavaScriptCore.tgz $(tar -ztf JavaScriptCore.tgz | sed -e '
+        /\/icu\/unicode\/.*\.h$/ p;
+        /\/profiler\/.*\.h$/ p;
+        /\/runtime\/.*\.h$/ p;
+        /\/wtf\/.*\.h$/ p;
+        d;
+    ')
+fi
+
+for framework in ApplicationServices CoreServices IOKit IOSurface JavaScriptCore QuartzCore WebKit; do
+    ln -s /System/Library/Frameworks/"${framework}".framework/Headers "${framework}"
+done
+
+for framework in /System/Library/Frameworks/CoreServices.framework/Frameworks/*.framework; do
+    name=${framework}
+    name=${name%.framework}
+    name=${name##*/}
+    ln -s "${framework}/Headers" "${name}"
+done
+
+mkdir -p Cocoa
+cat >Cocoa/Cocoa.h <<EOF
+#define NSImage UIImage
+#define NSView UIView
+#define NSWindow UIWindow
+
+#define NSPoint CGPoint
+#define NSRect CGRect
+
+#define NSPasteboard UIPasteboard
+#define NSSelectionAffinity int
+@protocol NSUserInterfaceValidations;
+EOF
+
+mkdir -p GraphicsServices
+cat >GraphicsServices/GraphicsServices.h <<EOF
+typedef struct __GSEvent *GSEventRef;
+typedef struct __GSFont *GSFontRef;
+EOF