Moved StringToURLTransformer to its own file.
parent
facdea9b7e
commit
7bb24f5179
|
@ -9,9 +9,6 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
@class SpotlightWindowController;
|
||||
|
||||
@interface StringToURLTransformer: NSValueTransformer {}
|
||||
@end
|
||||
|
||||
@interface PausingQueryTransformer: NSValueTransformer {
|
||||
NSArray *oldResults;
|
||||
}
|
||||
|
|
|
@ -9,25 +9,6 @@
|
|||
#import "SpotlightTransformers.h"
|
||||
#import "SpotlightWindowController.h"
|
||||
|
||||
@implementation StringToURLTransformer
|
||||
+ (Class)transformedValueClass { return [NSURL class]; }
|
||||
+ (BOOL)allowsReverseTransformation { return YES; }
|
||||
|
||||
// Convert from string to NSURL
|
||||
- (id)transformedValue:(id)value {
|
||||
if (value == nil) return nil;
|
||||
|
||||
return [NSURL URLWithString:value];
|
||||
}
|
||||
|
||||
// Convert from NSURL to string
|
||||
- (id)reverseTransformedValue:(id)value {
|
||||
if (value == nil) return nil;
|
||||
|
||||
return [value absoluteString];
|
||||
}
|
||||
@end
|
||||
|
||||
// This is what we use instead of an outlet for PausingQueryTransformer
|
||||
static SpotlightWindowController * searchController;
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// StringToURLTransformer.h
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 2/17/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface StringToURLTransformer: NSValueTransformer {}
|
||||
@end
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// StringToURLTransformer.m
|
||||
// Cog
|
||||
//
|
||||
// Created by Vincent Spader on 2/17/08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "StringToURLTransformer.h"
|
||||
|
||||
@implementation StringToURLTransformer
|
||||
+ (Class)transformedValueClass { return [NSURL class]; }
|
||||
+ (BOOL)allowsReverseTransformation { return YES; }
|
||||
|
||||
// Convert from string to NSURL
|
||||
- (id)transformedValue:(id)value {
|
||||
if (value == nil) return nil;
|
||||
|
||||
return [NSURL URLWithString:value];
|
||||
}
|
||||
|
||||
// Convert from NSURL to string
|
||||
- (id)reverseTransformedValue:(id)value {
|
||||
if (value == nil) return nil;
|
||||
|
||||
return [value absoluteString];
|
||||
}
|
||||
@end
|
Loading…
Reference in New Issue