From 096e25d8941176c2be1ac8bdb02a221386a2e8e7 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 24 Mar 2011 07:22:36 -0700 Subject: Factor out -[SearchController termsForQuery:]. --- MobileCydia.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'MobileCydia.mm') 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]; -- cgit v1.2.3