Skip to content

Instantly share code, notes, and snippets.

@jxpx777
Created February 7, 2010 18:09
Show Gist options
  • Save jxpx777/297568 to your computer and use it in GitHub Desktop.
Save jxpx777/297568 to your computer and use it in GitHub Desktop.
//
// 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