Created
          February 7, 2010 18:09 
        
      - 
      
- 
        Save jxpx777/297568 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // | |
| // NSMetadataItem+JPIKImageBrowserItem.m | |
| // Created by Jamie Phelps on 10/20/09. | |
| // | |
| // Licensed under the Don't Be A Dick License | |
| // | |
| @interface NSMetadataItem (JPIKImageBrowserItem) | |
| -(NSString *)imageUID; | |
| -(NSString *)imageRepresentationType; | |
| -(id)imageRepresentation; | |
| -(NSString *)imageTitle; | |
| -(NSString *)imageSubtitle; | |
| -(BOOL)isSelectable; | |
| @end | |
| #import <Quartz/Quartz.h> | |
| #import <QuartzCore/QuartzCore.h> | |
| @implementation NSMetadataItem (JPIKImageBrowserItem) | |
| - (NSString *)imageUID;{ | |
| return (NSString *)[self valueForAttribute:@"kMDItemPath"]; | |
| } | |
| - (NSString *)imageRepresentationType;{ | |
| return IKImageBrowserQuickLookPathRepresentationType; | |
| } | |
| - (id)imageRepresentation;{ | |
| return [self valueForAttribute:@"kMDItemPath"]; | |
| } | |
| - (NSString *)imageTitle;{ | |
| return (NSString *)[self valueForAttribute:@"kMDItemDisplayName"]; | |
| } | |
| - (NSString *)imageSubtitle;{ | |
| return [NSDateFormatter localizedStringFromDate:(NSDate *)[self valueForAttribute:@"kMDItemFSContentChangeDate"] | |
| dateStyle:NSDateFormatterMediumStyle | |
| timeStyle:NSDateFormatterNoStyle]; | |
| } | |
| - (BOOL)isSelectable;{ | |
| return [[NSFileManager defaultManager] isReadableFileAtPath:[self valueForAttribute:@"kMDItemPath"]]; | |
| } | |
| @end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment