• R/O
  • HTTP
  • SSH
  • HTTPS

提交

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

BathyScapheのthreadファイルをSpotlightを用いて検索する


Commit MetaInfo

修订版ce173f62094fb727c99037025dce44f09166ef71 (tree)
时间2009-04-18 23:17:18
作者masakih <masakih@user...>
Commitermasakih

Log Message

NSPredicateの条件を見直し。

git-svn-id: svn+ssh://macmini/usr/local/svnrepos/BSSpotlighter/BSSpotlighter@6 349e1e32-f012-47ec-a20f-05ec029f004b

更改概述

差异

--- a/BSSpotlighter.h
+++ b/BSSpotlighter.h
@@ -23,4 +23,6 @@
2323
2424 - (void)openThread:(id)path;
2525
26+- (id) metadataQuery;
27+- (void) setMatadataQuery: (id) newValue;
2628 @end
--- a/BSSpotlighter.m
+++ b/BSSpotlighter.m
@@ -17,7 +17,7 @@ enum {
1717 };
1818
1919 @interface BSSpotlighter(HMPrivate)
20-- (NSMetadataQuery *)createQuery;
20+-(NSArray *)bsDocumentDirectory;
2121 - (NSPredicate *)createPredicate;
2222
2323 - (void)setCurrentPredicateForMenuItem:(id)item;
@@ -88,6 +88,27 @@ static NSString *CustomTableViewStateKey = @"CustomTableViewState";
8888 }
8989
9090 #pragma mark## Key Value Coding ##
91+- (id) metadataQuery
92+{
93+ if(mQuery) return mQuery;
94+
95+// [self willChangeValueForKey:@"mQuery"];
96+
97+ mQuery = [[NSMetadataQuery alloc] init];
98+ if(!mQuery) return nil;
99+
100+ [mQuery setSearchScopes:[self bsDocumentDirectory]];
101+
102+// [self didChangeValueForKey:@"mQuery"];
103+
104+ return mQuery;
105+}
106+
107+- (void) setMatadataQuery: (id) newValue
108+{
109+ [mQuery autorelease];
110+ mQuery = [newValue retain];
111+}
91112 - (NSArray *)currentKeys
92113 {
93114 return mCurrentKeys;
@@ -363,21 +384,6 @@ static NSString *CustomTableViewStateKey = @"CustomTableViewState";
363384 }
364385
365386 #pragma mark -
366-- (NSMetadataQuery *)createQuery
367-{
368- if(mQuery) return mQuery;
369-
370- [self willChangeValueForKey:@"mQuery"];
371-
372- mQuery = [[NSMetadataQuery alloc] init];
373- if(!mQuery) return nil;
374-
375- [mQuery setSearchScopes:[self bsDocumentDirectory]];
376-
377- [self didChangeValueForKey:@"mQuery"];
378-
379- return mQuery;
380-}
381387 - (NSPredicate *)createPredicate
382388 {
383389 NSPredicate *predicate;
@@ -412,16 +418,13 @@ static NSString *CustomTableViewStateKey = @"CustomTableViewState";
412418 predicate02 = [array componentsJoinedByString:@" || "];
413419 }
414420
415- predicate02 = [NSString stringWithFormat:@"kMDItemContentType == \"jp.tsawada2.bathyscaphe.thread\" && (%@)", predicate02];
421+ predicate02 = [NSString stringWithFormat:@"kMDItemContentType = \"jp.tsawada2.bathyscaphe.thread\" && (%@)", predicate02];
416422 predicate = [NSPredicate predicateWithFormat:predicate02];
417423 BSSLog(@"Tokens -> %@", predicate);
418424
419- if(!mQuery) {
420- [self createQuery];
421- }
422- [mQuery setPredicate:predicate];
423- if(![mQuery isStarted]) {
424- [mQuery startQuery];
425+ [[self metadataQuery] setPredicate:predicate];
426+ if(![[self metadataQuery] isStarted]) {
427+ [[self metadataQuery] startQuery];
425428 }
426429
427430 return predicate;