--- /dev/null
+var _assert = function (expr) {
+ if (!expr) {
+ var message = "_assert(" + expr + ")";
+ alert(message);
+ throw message;
+ }
+}
+
+// Compatibility {{{
+if (typeof Array.prototype.push != "function")
+ Array.prototype.push = function (value) {
+ this[this.length] = value;
+ };
+// }}}
+
+var $ = function (arg, doc) {
+ if (this.magic_ != $.prototype.magic_)
+ return new $(arg);
+
+ var type = $.type(arg);
+
+ if (type == "function")
+ $.ready(arg);
+ else if (type == "string") {
+ if (doc == undefined)
+ doc = document;
+ if (arg.charAt(0) == '#')
+ return new $([doc.getElementById(arg.substring(1))]);
+ else if (arg.charAt(0) == '.')
+ return new $(doc.getElementsByClassName(arg.substring(1)));
+ else
+ return $([doc]).descendants(arg);
+ } else {
+ _assert(doc == undefined);
+ this.set($.array(arg));
+ return this;
+ }
+};
+
+$.type = function (value) {
+ var type = typeof value;
+
+ if (
+ type == "function" &&
+ value.toString != null &&
+ value.toString().substring(0, 8) == "[object "
+ )
+ return "object";
+ else
+ return type;
+};
+
+(function () {
+ var ready_ = null;
+
+ $.ready = function (_function) {
+ if (ready_ == null) {
+ ready_ = [];
+
+ document.addEventListener("DOMContentLoaded", function () {
+ for (var i = 0; i != ready_.length; ++i)
+ ready_[i]();
+ }, false);
+ }
+
+ ready_.push(_function);
+ };
+})();
+
+/* XXX: verify arg3 overflow */
+$.each = function (values, _function, arg0, arg1, arg2) {
+ for (var i = 0, e = values.length; i != e; ++i)
+ _function(values[i], arg0, arg1, arg2);
+};
+
+/* XXX: verify arg3 overflow */
+$.map = function (values, _function, arg0, arg1, arg2) {
+ var mapped = [];
+ for (var i = 0, e = values.length; i != e; ++i)
+ mapped.push(_function(values[i], arg0, arg1, arg2));
+ return mapped;
+};
+
+$.array = function (values) {
+ if (values.constructor == Array)
+ return values;
+ var array = [];
+ for (var i = 0; i != values.length; ++i)
+ array.push(values[i]);
+ return array;
+};
+
+$.document = function (node) {
+ for (;;) {
+ var parent = node.parentNode;
+ if (parent == null)
+ return node;
+ node = parent;
+ }
+};
+
+$.prototype = {
+ magic_: 2041085062,
+
+ add: function (nodes) {
+ Array.prototype.push.apply(this, nodes);
+ },
+
+ set: function (nodes) {
+ this.length = 0;
+ this.add(nodes);
+ },
+
+ css: function (name, value) {
+ $.each(this, function (node) {
+ node.style[name] = value;
+ });
+ },
+
+ append: function (html) {
+ $.each(this, function (node) {
+ var doc = $.document(node);
+
+ // XXX: implement wrapper system
+ var div = doc.createElement("div");
+ div.innerHTML = html;
+
+ while (div.childNodes.length != 0) {
+ var child = div.childNodes[0];
+ node.appendChild(child);
+ }
+ });
+ },
+
+ descendants: function (expression) {
+ var descendants = $([]);
+
+ $.each(this, function (node) {
+ descendants.add(node.getElementsByTagName(expression));
+ });
+
+ return descendants;
+ },
+
+ remove: function () {
+ $.each(this, function (node) {
+ node.parentNode.removeChild(node);
+ });
+ },
+
+ parent: function () {
+ return $($.map(this, function (node) {
+ return node.parentNode;
+ }));
+ }
+};
+
+$.scroll = function (x, y) {
+ window.scrollTo(x, y);
+};
+
+// XXX: document.all?
+$.all = function (doc) {
+ if (doc == undefined)
+ doc = document;
+ return $(doc.getElementsByTagName("*"));
+};
+
+$.inject = function (a, b) {
+ if ($.type(a) == "string") {
+ $.prototype[a] = function (value) {
+ if (value == undefined)
+ return $.map(this, function (node) {
+ return b.get(node);
+ });
+ else
+ $.each(this, function (node, value) {
+ b.set(node, value);
+ }, value);
+ };
+ } else for (var name in a)
+ $.inject(name, a[name]);
+};
+
+$.inject({
+ html: {
+ get: function (node) {
+ return node.innerHTML;
+ },
+ set: function (node, value) {
+ node.innerHTML = value;
+ }
+ },
+
+ href: {
+ get: function (node) {
+ return node.href;
+ },
+ set: function (node, value) {
+ node.href = value;
+ }
+ },
+
+ value: {
+ get: function (node) {
+ return node.value;
+ },
+ set: function (node, value) {
+ node.value = value;
+ }
+ }
+});
+
+// Event Registration {{{
+// XXX: unable to remove registration
+$.prototype.event = function (event, _function) {
+ $.each(this, function (node) {
+ // XXX: smooth over this pointer ugliness
+ if (node.addEventListener)
+ node.addEventListener(event, _function, false);
+ else if (node.attachEvent)
+ node.attachEvent("on" + event, _function);
+ else
+ // XXX: multiple registration SNAFU
+ node["on" + event] = _function;
+ });
+};
+
+$.each([
+ "click", "load", "submit"
+], function (event) {
+ $.prototype[event] = function (_function) {
+ if (_function == undefined)
+ _assert(false);
+ else
+ this.event(event, _function);
+ };
+});
+// }}}
+// Timed Animation {{{
+$.interpolate = function (duration, event) {
+ var start = new Date();
+
+ var next = function () {
+ setTimeout(update, 0);
+ };
+
+ var update = function () {
+ var time = new Date() - start;
+
+ if (time >= duration)
+ event(1);
+ else {
+ event(time / duration);
+ next();
+ }
+ };
+
+ next();
+};
+// }}}
+// AJAX Requests {{{
+// XXX: abstract and implement other cases
+$.xhr = function (url, method, headers, data, events) {
+ var xhr = new XMLHttpRequest();
+ xhr.open(method, url, true);
+
+ for (var name in headers)
+ xhr.setRequestHeader(name.replace(/_/, "-"), headers[name]);
+
+ if (events == null)
+ events = {};
+
+ xhr.onreadystatechange = function () {
+ if (xhr.readyState == 4)
+ if (events.complete != null)
+ events.complete(xhr.responseText);
+ };
+
+ xhr.send(data);
+};
+
+$.call = function (url, post, onsuccess) {
+ var events = {};
+
+ if (onsuccess != null)
+ events.complete = function (text) {
+ onsuccess(eval(text));
+ };
+
+ if (post == null)
+ $.xhr(url, "POST", null, null, events);
+ else
+ $.xhr(url, "POST", {
+ Content_Type: "application/json"
+ }, $.json(post), events);
+};
+// }}}
+// WWW Form URL Encoder {{{
+$.form = function (parameters) {
+ var data = "";
+
+ var ampersand = false;
+ for (var name in parameters) {
+ if (!ampersand)
+ ampersand = true;
+ else
+ data += "&";
+
+ var value = parameters[name];
+
+ data += escape(name);
+ data += "=";
+ data += escape(value);
+ }
+
+ return data;
+};
+// }}}
+// JSON Serializer {{{
+$.json = function (value) {
+ if (value == null)
+ return "null";
+
+ var type = $.type(value);
+
+ if (type == "number")
+ return value;
+ else if (type == "string")
+ return "\"" + value
+ .replace(/\\/, "\\\\")
+ .replace(/\t/, "\\t")
+ .replace(/\r/, "\\r")
+ .replace(/\n/, "\\n")
+ .replace(/"/, "\\\"")
+ + "\"";
+ else if (value.constructor == Array) {
+ var json = "[";
+ var comma = false;
+
+ for (var i = 0; i != value.length; ++i) {
+ if (!comma)
+ comma = true;
+ else
+ json += ",";
+
+ json += $.json(value[i]);
+ }
+
+ return json + "]";
+ } else if (
+ value.constructor == Object &&
+ value.toString() == "[object Object]"
+ ) {
+ var json = "{";
+ var comma = false;
+
+ for (var name in value) {
+ if (!comma)
+ comma = true;
+ else
+ json += ",";
+
+ json += name + ":" + $.json(value[name]);
+ }
+ return json + "}";
+ } else {
+ return value;
+ }
+};
+// }}}
/* Mime Addresses {{{ */
@interface Address : NSObject {
NSString *name_;
- NSString *email_;
+ NSString *address_;
}
- (NSString *) name;
-- (NSString *) email;
+- (NSString *) address;
+ (Address *) addressWithString:(NSString *)string;
- (Address *) initWithString:(NSString *)string;
- (void) dealloc {
[name_ release];
- if (email_ != nil)
- [email_ release];
+ if (address_ != nil)
+ [address_ release];
[super dealloc];
}
return name_;
}
-- (NSString *) email {
- return email_;
+- (NSString *) address {
+ return address_;
}
+ (Address *) addressWithString:(NSString *)string {
return [[[Address alloc] initWithString:string] autorelease];
}
++ (NSArray *) _attributeKeys {
+ return [NSArray arrayWithObjects:@"address", @"name", nil];
+}
+
+- (NSArray *) attributeKeys {
+ return [[self class] _attributeKeys];
+}
+
++ (BOOL) isKeyExcludedFromWebScript:(const char *)name {
+ return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
+}
+
- (Address *) initWithString:(NSString *)string {
if ((self = [super init]) != nil) {
const char *data = [string UTF8String];
size_t size = [string length];
- static Pcre email_r("^\"?(.*)\"? <([^>]*)>$");
+ static Pcre address_r("^\"?(.*)\"? <([^>]*)>$");
- if (email_r(data, size)) {
- name_ = [email_r[1] retain];
- email_ = [email_r[2] retain];
+ if (address_r(data, size)) {
+ name_ = [address_r[1] retain];
+ address_ = [address_r[2] retain];
} else {
name_ = [[NSString alloc]
initWithBytes:data
encoding:kCFStringEncodingUTF8
];
- email_ = nil;
+ address_ = nil;
}
} return self;
}
static BOOL Sounds_Keyboard_;
static BOOL Advanced_;
-//static BOOL Loaded_;
+static BOOL Loaded_;
static BOOL Ignored_;
static UIFont *Font12_;
[super dealloc];
}
++ (NSArray *) _attributeKeys {
+ return [NSArray arrayWithObjects:@"description", @"distribution", @"host", @"key", @"label", @"name", @"origin", @"trusted", @"type", @"uri", @"version", nil];
+}
+
+- (NSArray *) attributeKeys {
+ return [[self class] _attributeKeys];
+}
+
++ (BOOL) isKeyExcludedFromWebScript:(const char *)name {
+ return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
+}
+
- (Source *) initWithMetaIndex:(metaIndex *)index {
if ((self = [super init]) != nil) {
trusted_ = index->IsTrusted();
NSString *name_;
NSString *tagline_;
NSString *icon_;
- NSString *website_;
+ NSString *homepage_;
Address *sponsor_;
Address *author_;
NSArray *tags_;
- (NSString *) name;
- (NSString *) tagline;
- (NSString *) icon;
-- (NSString *) website;
+- (NSString *) homepage;
- (Address *) author;
- (NSArray *) relationships;
[tagline_ release];
if (icon_ != nil)
[icon_ release];
- if (website_ != nil)
- [website_ release];
+ if (homepage_ != nil)
+ [homepage_ release];
if (sponsor_ != nil)
[sponsor_ release];
if (author_ != nil)
[super dealloc];
}
++ (NSArray *) _attributeKeys {
+ return [NSArray arrayWithObjects:@"author", @"description", @"essential", @"homepage", @"icon", @"id", @"installed", @"latest", @"maintainer", @"name", @"section", @"size", @"source", @"sponsor", @"tagline", nil];
+}
+
+- (NSArray *) attributeKeys {
+ return [[self class] _attributeKeys];
+}
+
++ (BOOL) isKeyExcludedFromWebScript:(const char *)name {
+ return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
+}
+
- (Package *) initWithIterator:(pkgCache::PkgIterator)iterator database:(Database *)database {
if ((self = [super init]) != nil) {
iterator_ = iterator;
icon_ = Scour("Icon", begin, end);
if (icon_ != nil)
icon_ = [icon_ retain];
- website_ = Scour("Homepage", begin, end);
- if (website_ == nil)
- website_ = Scour("Website", begin, end);
- if (website_ != nil)
- website_ = [website_ retain];
+ homepage_ = Scour("Homepage", begin, end);
+ if (homepage_ == nil)
+ homepage_ = Scour("Website", begin, end);
+ if (homepage_ != nil)
+ homepage_ = [homepage_ retain];
NSString *sponsor = Scour("Sponsor", begin, end);
if (sponsor != nil)
sponsor_ = [[Address addressWithString:sponsor] retain];
return icon_;
}
-- (NSString *) website {
- return website_;
+- (NSString *) homepage {
+ return homepage_;
}
- (Address *) sponsor {
@end
/* }}} */
/* Package View {{{ */
-@interface PackageView : RVPage {
- _transient Database *database_;
- UIPreferencesTable *table_;
+@interface PackageView : BrowserView {
Package *package_;
NSString *name_;
- UITextView *description_;
NSMutableArray *buttons_;
}
@implementation PackageView
- (void) dealloc {
- [table_ setDataSource:nil];
- [table_ setDelegate:nil];
-
if (package_ != nil)
[package_ release];
if (name_ != nil)
[name_ release];
- if (description_ != nil)
- [description_ release];
- [table_ release];
[buttons_ release];
[super dealloc];
}
-- (int) numberOfGroupsInPreferencesTable:(UIPreferencesTable *)table {
- int number = 2;
- if ([package_ installed] != nil)
- ++number;
- if ([package_ source] != nil)
- ++number;
- return number;
-}
-
-- (NSString *) preferencesTable:(UIPreferencesTable *)table titleForGroup:(int)group {
- if (group-- == 0)
- return nil;
- else if ([package_ installed] != nil && group-- == 0)
- return @"Installed Package";
- else if (group-- == 0)
- return @"Package Details";
- else if ([package_ source] != nil && group-- == 0)
- return @"Source Information";
- else _assert(false);
-}
-
-- (float) preferencesTable:(UIPreferencesTable *)table heightForRow:(int)row inGroup:(int)group withProposedHeight:(float)proposed {
- if (description_ == nil || group != 0 || row != ([package_ author] == nil ? 1 : 2))
- return proposed;
- else
- return [description_ visibleTextRect].size.height + TextViewOffset_;
-}
-
-- (int) preferencesTable:(UIPreferencesTable *)table numberOfRowsInGroup:(int)group {
- if (group-- == 0) {
- int number = 1;
- if ([package_ author] != nil)
- ++number;
- if (description_ != nil)
- ++number;
- if ([package_ website] != nil)
- ++number;
- return number;
- } else if ([package_ installed] != nil && group-- == 0)
- return 2;
- else if (group-- == 0) {
- int number = 2;
- if ([package_ size] != 0)
- ++number;
- if ([package_ maintainer] != nil)
- ++number;
- if ([package_ sponsor] != nil)
- ++number;
- if ([package_ relationships] != nil)
- ++number;
- if ([[package_ source] trusted])
- ++number;
- return number;
- } else if ([package_ source] != nil && group-- == 0) {
- Source *source = [package_ source];
- NSString *description = [source description];
- int number = 1;
- if (description != nil && ![description isEqualToString:[source label]])
- ++number;
- if ([source origin] != nil)
- ++number;
- return number;
- } else _assert(false);
-}
-
-- (UIPreferencesTableCell *) preferencesTable:(UIPreferencesTable *)table cellForRow:(int)row inGroup:(int)group {
- UIPreferencesTableCell *cell = [[[UIPreferencesTableCell alloc] init] autorelease];
- [cell setShowSelection:NO];
-
- if (group-- == 0) {
- if (false) {
- } else if (row-- == 0) {
- [cell setTitle:[package_ name]];
- [cell setValue:[package_ latest]];
- } else if ([package_ author] != nil && row-- == 0) {
- [cell setTitle:@"Author"];
- [cell setValue:[[package_ author] name]];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else if (description_ != nil && row-- == 0) {
- [cell addSubview:description_];
- } else if ([package_ website] != nil && row-- == 0) {
- [cell setTitle:@"More Information"];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else _assert(false);
- } else if ([package_ installed] != nil && group-- == 0) {
- if (false) {
- } else if (row-- == 0) {
- [cell setTitle:@"Version"];
- NSString *installed([package_ installed]);
- [cell setValue:(installed == nil ? @"n/a" : installed)];
- } else if (row-- == 0) {
- [cell setTitle:@"Filesystem Content"];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else _assert(false);
- } else if (group-- == 0) {
- if (false) {
- } else if (row-- == 0) {
- [cell setTitle:@"Identifier"];
- [cell setValue:[package_ id]];
- } else if (row-- == 0) {
- [cell setTitle:@"Section"];
- NSString *section([package_ section]);
- [cell setValue:(section == nil ? @"n/a" : section)];
- } else if ([package_ size] != 0 && row-- == 0) {
- [cell setTitle:@"Expanded Size"];
- [cell setValue:SizeString([package_ size])];
- } else if ([package_ maintainer] != nil && row-- == 0) {
- [cell setTitle:@"Maintainer"];
- [cell setValue:[[package_ maintainer] name]];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else if ([package_ sponsor] != nil && row-- == 0) {
- [cell setTitle:@"Sponsor"];
- [cell setValue:[[package_ sponsor] name]];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else if ([package_ relationships] != nil && row-- == 0) {
- [cell setTitle:@"Package Relationships"];
- [cell setShowDisclosure:YES];
- [cell setShowSelection:YES];
- } else if ([[package_ source] trusted] && row-- == 0) {
- [cell setIcon:[UIImage applicationImageNamed:@"trusted.png"]];
- [cell setValue:@"This package has been signed."];
- } else _assert(false);
- } else if ([package_ source] != nil && group-- == 0) {
- Source *source = [package_ source];
- NSString *description = [source description];
-
- if (false) {
- } else if (row-- == 0) {
- NSString *label = [source label];
- if (label == nil)
- label = [source uri];
- [cell setTitle:label];
- [cell setValue:[source version]];
- } else if (description != nil && ![description isEqualToString:[source label]] && row-- == 0) {
- [cell setValue:description];
- } else if ([source origin] != nil && row-- == 0) {
- [cell setTitle:@"Origin"];
- [cell setValue:[source origin]];
- } else _assert(false);
- } else _assert(false);
-
- return cell;
-}
-
-- (BOOL) canSelectRow:(int)row {
- return YES;
-}
-
-- (void) tableRowSelected:(NSNotification *)notification {
- int row = [table_ selectedRow];
- if (row == INT_MAX)
- return;
-
- #define _else else goto _label; return; } _label:
-
- if (true) {
- if (row-- == 0) {
- } else if (row-- == 0) {
- } else if ([package_ author] != nil && row-- == 0) {
- [delegate_ openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=%@",
- [[package_ author] email],
- [[NSString stringWithFormat:@"regarding apt package \"%@\"",
- [package_ name]
- ] stringByAddingPercentEscapes]
- ]]];
- } else if (description_ != nil && row-- == 0) {
- } else if ([package_ website] != nil && row-- == 0) {
- NSURL *url = [NSURL URLWithString:[package_ website]];
- BrowserView *browser = [[[BrowserView alloc] initWithBook:book_ database:database_] autorelease];
- [browser setDelegate:delegate_];
- [book_ pushPage:browser];
- [browser loadURL:url];
- } _else if ([package_ installed] != nil) {
- if (row-- == 0) {
- } else if (row-- == 0) {
- } else if (row-- == 0) {
- FileTable *files = [[[FileTable alloc] initWithBook:book_ database:database_] autorelease];
- [files setDelegate:delegate_];
- [files setPackage:package_];
- [book_ pushPage:files];
- } _else if (true) {
- if (row-- == 0) {
- } else if (row-- == 0) {
- } else if (row-- == 0) {
- } else if ([package_ size] != 0 && row-- == 0) {
- } else if ([package_ maintainer] != nil && row-- == 0) {
- [delegate_ openURL:[NSURL URLWithString:[NSString stringWithFormat:@"mailto:%@?subject=%@",
- [[package_ maintainer] email],
- [[NSString stringWithFormat:@"regarding apt package \"%@\"",
- [package_ name]
- ] stringByAddingPercentEscapes]
- ]]];
- } else if ([package_ sponsor] != nil && row-- == 0) {
- NSURL *url = [NSURL URLWithString:[[package_ sponsor] email]];
- BrowserView *browser = [[[BrowserView alloc] initWithBook:book_ database:database_] autorelease];
- [browser setDelegate:delegate_];
- [book_ pushPage:browser];
- [browser loadURL:url];
- } else if ([package_ relationships] != nil && row-- == 0) {
- } else if ([[package_ source] trusted] && row-- == 0) {
- } _else if ([package_ source] != nil) {
- Source *source = [package_ source];
- NSString *description = [source description];
-
- if (row-- == 0) {
- } else if (row-- == 0) {
- } else if (description != nil && ![description isEqualToString:[source label]] && row-- == 0) {
- } else if ([source origin] != nil && row-- == 0) {
- } _else _assert(false);
-
- #undef _else
-}
-
- (void) _clickButtonWithName:(NSString *)name {
if ([name isEqualToString:@"Install"])
[delegate_ installPackage:package_];
[sheet dismiss];
}
+- (void) webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)window forFrame:(WebFrame *)frame {
+ _trace();
+ NSLog(@"%@", package_);
+ [window setValue:package_ forKey:@"package"];
+}
+
- (void) _rightButtonClicked {
+ /*[super _rightButtonClicked];
+ return;*/
+
int count = [buttons_ count];
_assert(count != 0);
}
}
-- (NSString *) rightButtonTitle {
+- (NSString *) _rightButtonTitle {
int count = [buttons_ count];
return count == 0 ? nil : count != 1 ? @"Modify" : [buttons_ objectAtIndex:0];
}
}
- (id) initWithBook:(RVBook *)book database:(Database *)database {
- if ((self = [super initWithBook:book]) != nil) {
+ if ((self = [super initWithBook:book database:database]) != nil) {
database_ = database;
-
- table_ = [[UIPreferencesTable alloc] initWithFrame:[self bounds]];
- [self addSubview:table_];
-
- [table_ setDataSource:self];
- [table_ setDelegate:self];
-
buttons_ = [[NSMutableArray alloc] initWithCapacity:4];
} return self;
}
name_ = nil;
}
- if (description_ != nil) {
- [description_ release];
- description_ = nil;
- }
-
[buttons_ removeAllObjects];
if (package != nil) {
package_ = [package retain];
name_ = [[package id] retain];
- NSString *description([package description]);
- if (description == nil)
- description = [package tagline];
- if (description != nil) {
- description_ = [GetTextView(description, 12, true) retain];
- [description_ setTextColor:Black_];
- }
-
- [table_ reloadData];
+ [self loadURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"package" ofType:@"html"]]];
if ([package_ source] == nil);
else if ([package_ upgradableAndEssential:NO])
}
}
-- (void) resetViewAnimated:(BOOL)animated {
- [table_ resetViewAnimated:animated];
-}
-
- (void) reloadData {
[self setPackage:[database_ packageWithName:name_]];
[self reloadButtons];
return @"Settings";
}
-- (NSString *) rightButtonTitle {
+- (NSString *) _rightButtonTitle {
return nil;
}
page = [[[SourceTable alloc] initWithBook:book_ database:database_] autorelease];
else if ([href isEqualToString:@"cydia://packages"])
page = [[[InstalledView alloc] initWithBook:book_ database:database_] autorelease];
- else if ([href hasPrefix:@"apptapp://package/"]) {
+ else if ([href hasPrefix:@"cydia://files/"]) {
+ NSString *name = [href substringFromIndex:14];
+
+ if (Package *package = [database_ packageWithName:name]) {
+ FileTable *files = [[[FileTable alloc] initWithBook:book_ database:database_] autorelease];
+ [files setPackage:package];
+ page = files;
+ }
+ } else if ([href hasPrefix:@"apptapp://package/"]) {
NSString *name = [href substringFromIndex:18];
if (Package *package = [database_ packageWithName:name]) {
[self reloadURL];
}
+- (NSString *) _rightButtonTitle {
+ return @"Reload";
+}
+
- (NSString *) rightButtonTitle {
- return loading_ ? @"" : @"Reload";
+ return loading_ ? @"" : [self _rightButtonTitle];
}
- (NSString *) title {
[self updateData];
- /*if ([packages count] == 0);
- else if (Loaded_)*/
+ if ([packages count] == 0);
+ else if (Loaded_)
[self _loaded];
- /*else {
+ else {
Loaded_ = YES;
[book_ update];
- }*/
+ }
/*[hud show:NO];
[hud removeFromSuperview];*/