summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-03-24 07:22:36 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-03-24 07:22:36 -0700
commit096e25d8941176c2be1ac8bdb02a221386a2e8e7 (patch)
tree87b1c77c28676389b334a2a2336b3f8bfac2f122
parent0517651feffa64f36d11e5047d607490987508d0 (diff)
Factor out -[SearchController termsForQuery:].
-rw-r--r--MobileCydia.mm10
1 files changed, 7 insertions, 3 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 3472933..e922636 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -7978,8 +7978,12 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
return [NSURL URLWithString:[NSString stringWithFormat:@"cydia://search/%@", [[search_ text] stringByAddingPercentEscapesIncludingReserved]]];
}
+- (NSArray *) termsForQuery:(NSString *)query {
+ return [query componentsSeparatedByString:@" "];
+}
+
- (void) useSearch {
- [self setObject:[[search_ text] componentsSeparatedByString:@" "] forFilter:@selector(isUnfilteredAndSearchedForBy:)];
+ [self setObject:[self termsForQuery:[search_ text]] forFilter:@selector(isUnfilteredAndSearchedForBy:)];
[self clearData];
[self reloadData];
}
@@ -8040,7 +8044,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
}
- (id) initWithDatabase:(Database *)database query:(NSString *)query {
- if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:[query componentsSeparatedByString:@" "]])) {
+ if ((self = [super initWithDatabase:database title:UCLocalize("SEARCH") filter:@selector(isUnfilteredAndSearchedForBy:) with:[self termsForQuery:query]])) {
search_ = [[[UISearchBar alloc] init] autorelease];
[search_ setDelegate:self];
@@ -8073,7 +8077,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi
- (void) reloadData {
id object([search_ text]);
if ([self filter] == @selector(isUnfilteredAndSearchedForBy:))
- object = [object componentsSeparatedByString:@" "];
+ object = [self termsForQuery:object];
[self setObject:object];
[self resetCursor];