diff options
-rw-r--r-- | MobileCydia.app/manage.html | 2 | ||||
-rw-r--r-- | MobileCydia.app/package.js | 2 | ||||
-rw-r--r-- | MobileCydia.mm | 108 | ||||
-rw-r--r-- | UICaboodle/BrowserView.mm | 4 |
4 files changed, 70 insertions, 46 deletions
diff --git a/MobileCydia.app/manage.html b/MobileCydia.app/manage.html index e240b54..55e7462 100644 --- a/MobileCydia.app/manage.html +++ b/MobileCydia.app/manage.html @@ -71,7 +71,7 @@ <div class="dialog"> <div class="panel"> -<a href="cydia://sections/all" class="giant-button"> +<a href="cydia://installed" class="giant-button"> <img src="packages.png"/> <div class="contents"> <label localize="PACKAGES"></label> diff --git a/MobileCydia.app/package.js b/MobileCydia.app/package.js index 2eaeb4a..0e2566b 100644 --- a/MobileCydia.app/package.js +++ b/MobileCydia.app/package.js @@ -224,7 +224,7 @@ $(function () { $(".installed").addClass("deleted"); else { $("#installed").html($.xml(installed)); - $("#files-href").href("cydia://files/" + idc); + $("#files-href").href("cydia://package/" + idc + "/files"); } space("#id", $.xml(id), 220); diff --git a/MobileCydia.mm b/MobileCydia.mm index 2b64440..1b0e37d 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1179,12 +1179,12 @@ bool isSectionVisible(NSString *section) { - (void) setConfigurationData:(NSString *)data; @end -@class PackageController; +@class CYPackageController; @protocol CydiaDelegate - (void) retainNetworkActivityIndicator; - (void) releaseNetworkActivityIndicator; -- (void) setPackageController:(PackageController *)view; +- (void) setPackageController:(CYPackageController *)view; - (void) clearPackage:(Package *)package; - (void) installPackage:(Package *)package; - (void) installPackages:(NSArray *)packages; @@ -1199,7 +1199,6 @@ bool isSectionVisible(NSString *section) { - (UIProgressHUD *) addProgressHUD; - (void) removeProgressHUD:(UIProgressHUD *)hud; - (CYViewController *) pageForPackage:(NSString *)name; -- (PackageController *) packageController; - (void) showActionSheet:(UIActionSheet *)sheet fromItem:(UIBarButtonItem *)item; @end @@ -5379,7 +5378,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ /* Package Controller {{{ */ -@interface PackageController : CYBrowserController < +@interface CYPackageController : CYBrowserController < UIActionSheetDelegate > { _transient Database *database_; @@ -5395,7 +5394,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end -@implementation PackageController +@implementation CYPackageController - (void) dealloc { if (package_ != nil) @@ -5914,7 +5913,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) didSelectPackage:(Package *)package { - PackageController *view([delegate_ packageController]); + CYPackageController *view([[[CYPackageController alloc] initWithDatabase:database_] autorelease]); [view setPackage:package]; [view setDelegate:delegate_]; [[self navigationController] pushViewController:view animated:YES]; @@ -6580,11 +6579,50 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @end /* }}} */ +/* Section Controller {{{ */ +@interface CYSectionController : FilteredPackageController { +} + +- (id) initWithDatabase:(Database *)database section:(NSString *)section; + +@end + +@implementation CYSectionController + +- (void) dealloc { + [super dealloc]; +} + +- (id) initWithDatabase:(Database *)database section:(NSString *)name { + NSString *title; + + if (name == nil) { + title = UCLocalize("ALL_PACKAGES"); + } else if (![name isEqual:@""]) { + title = [[NSBundle mainBundle] localizedStringForKey:Simplify(name) value:nil table:@"Sections"]; + } else { + title = UCLocalize("NO_SECTION"); + } + + if ((self = [super initWithDatabase:database title:title filter:@selector(isVisibleInSection:) with:name]) != nil) { + } return self; +} + +- (void) reloadData { + [packages_ reloadData]; +} + +- (void) setDelegate:(id)delegate { + [super setDelegate:delegate]; + [packages_ setDelegate:delegate]; +} + +@end +/* }}} */ /* Home Controller {{{ */ @interface HomeController : CYBrowserController { } - @end @implementation HomeController @@ -6858,9 +6896,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { @implementation CYTabBarController -/* XXX: some logic should probably go here related to -freeing the view controllers on tab change */ - - (void) reloadData { size_t count([[self viewControllers] count]); for (size_t i(0); i != count; ++i) { @@ -7391,8 +7426,6 @@ freeing the view controllers on tab change */ [[self navigationController] pushViewController:controller animated:YES]; } -- (NSString *) title { return UCLocalize("SECTIONS"); } - - (id) initWithDatabase:(Database *)database { if ((self = [super init]) != nil) { database_ = database; @@ -7581,7 +7614,7 @@ freeing the view controllers on tab change */ - (NSIndexPath *) tableView:(UITableView *)table willSelectRowAtIndexPath:(NSIndexPath *)path { Package *package([self packageAtIndexPath:path]); - PackageController *view([delegate_ packageController]); + CYPackageController *view([[[CYPackageController alloc] initWithDatabase:database_] autorelease]); [view setDelegate:delegate_]; [view setPackage:package]; [[self navigationController] pushViewController:view animated:YES]; @@ -7757,6 +7790,10 @@ freeing the view controllers on tab change */ [super dealloc]; } +- (void) setSearchTerm:(NSString *)searchTerm { + [search_ setText:searchTerm]; +} + - (void) searchBarSearchButtonClicked:(UISearchBar *)searchBar { [packages_ setObject:[search_ text] forFilter:@selector(isUnfilteredAndSearchedForBy:)]; [search_ resignFirstResponder]; @@ -7768,12 +7805,6 @@ freeing the view controllers on tab change */ [self reloadData]; } -- (void) setSearchTerm:(NSString *)term { - [search_ setText:term]; -} - -- (NSString *) title { return nil; } - - (id) initWithDatabase:(Database *)database { return [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:nil]; } @@ -7864,6 +7895,10 @@ freeing the view controllers on tab change */ return 2; } +- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + return UCLocalize("CHANGE_PACKAGE_SETTINGS"); +} + - (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { return UCLocalize("SHOW_ALL_CHANGES_EX"); } @@ -7914,6 +7949,8 @@ freeing the view controllers on tab change */ ignoredSwitch_ = [[UISwitch alloc] initWithFrame:CGRectMake(0, 0, 50, 20)]; [ignoredSwitch_ setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin]; [ignoredSwitch_ addTarget:self action:@selector(onIgnored:) forEvents:UIControlEventValueChanged]; + // Disable this switch, since it only reflects (not modifies) the ignored state. + [ignoredSwitch_ setUserInteractionEnabled:NO]; subscribedCell_ = [[UITableViewCell alloc] init]; [subscribedCell_ setText:UCLocalize("SHOW_ALL_CHANGES")]; @@ -8326,12 +8363,11 @@ freeing the view controllers on tab change */ - (void) _updateData { [self _saveConfig]; - for (CYNavigationController *controller in [tabbar_ viewControllers]) - [controller reloadData]; + [tabbar_ reloadData]; CYNavigationController *navigation = [self queueNavigationController]; - id queuedelegate = nil; + id queuedelegate = nil; if ([[navigation viewControllers] count] > 0) queuedelegate = [[navigation viewControllers] objectAtIndex:0]; @@ -8656,20 +8692,12 @@ freeing the view controllers on tab change */ [self setNetworkActivityIndicatorVisible:NO]; } -- (void) setPackageController:(PackageController *)view { +- (void) setPackageController:(CYPackageController *)view { WebThreadLock(); [view setPackage:nil]; WebThreadUnlock(); } -- (PackageController *) _packageController { - return [[[PackageController alloc] initWithDatabase:database_] autorelease]; -} - -- (PackageController *) packageController { - return [self _packageController]; -} - - (void) cancelAndClear:(bool)clear { @synchronized (self) { if (clear) { @@ -8791,15 +8819,15 @@ freeing the view controllers on tab change */ - (CYViewController *) pageForPackage:(NSString *)name { if (Package *package = [database_ packageWithName:name]) { - PackageController *view([self packageController]); + CYPackageController *view = [[[CYPackageController alloc] initWithDatabase:database_] autorelease]; [view setPackage:package]; return view; } else { NSURL *url([NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"unknown" ofType:@"html"]]); url = [NSURL URLWithString:[[url absoluteString] stringByAppendingString:[NSString stringWithFormat:@"?%@", name]]]; - CYBrowserController *controller = [[[CYBrowserController alloc] init] autorelease]; - [controller loadURL:url]; - return controller; + CYBrowserController *browser = [[[CYBrowserController alloc] init] autorelease]; + [browser loadURL:url]; + return browser; } } @@ -8918,12 +8946,12 @@ freeing the view controllers on tab change */ } - (BOOL) openCydiaURL:(NSURL *)url { - CYViewController *page = nil; + CYViewController *page([self pageForURL:url]); - if ((page = [self pageForURL:url])) + if (page != nil) [self setPage:page]; - return !!page; + return page != nil; } - (void) applicationOpenURL:(NSURL *)url { @@ -8993,17 +9021,15 @@ freeing the view controllers on tab change */ } NSMutableArray *controllers([NSMutableArray array]); - for (UITabBarItem *item in items) { CYNavigationController *controller([[[CYNavigationController alloc] initWithDatabase:database_] autorelease]); [controller setTabBarItem:item]; [controllers addObject:controller]; } - [tabbar_ setViewControllers:controllers]; + [tabbar_ setUpdateDelegate:self]; [window_ addSubview:[tabbar_ view]]; - } - (void)showEmulatedLoadingControllerInView:(UIView *)view { diff --git a/UICaboodle/BrowserView.mm b/UICaboodle/BrowserView.mm index 2a88537..2abc02e 100644 --- a/UICaboodle/BrowserView.mm +++ b/UICaboodle/BrowserView.mm @@ -653,13 +653,11 @@ static void $UIWebViewWebViewDelegate$webViewClose$(UIWebViewWebViewDelegate *se [[self navigationController] pushViewController:page animated:YES]; } else { - UCNavigationController *navigation([[[UCNavigationController alloc] init] autorelease]); + UCNavigationController *navigation([[[UCNavigationController alloc] initWithRootViewController:page] autorelease]); [navigation setHook:indirect_]; [navigation setDelegate:delegate_]; - [navigation setViewControllers:[NSArray arrayWithObject:page]]; - [[page navigationItem] setLeftBarButtonItem:[[[UIBarButtonItem alloc] initWithTitle:UCLocalize("CLOSE") style:UIBarButtonItemStylePlain |