// // P4MenuLocalFile.m // SCMMenuExtra // // Created by Michael Bishop on 5/9/11. // Copyright 2011 Numerical Garden LLC. All rights reserved. // #import "P4MenuLocalFile.h" #import "NGAUtilities.h" #import "P4Client.h" #import "P4Response.h" #import "P4ErrorCodes.h" #import "P4Connection.h" #import "P4LocalFileManager.h" //#define CALC_DIGESTS @interface P4MenuLocalFile () //-(NSDictionary*)P4_connectionContext; @property (nonatomic, readwrite, copy) NSString * localFilepath; @property (nonatomic, readwrite, assign) BOOL canOpenForAdd; @end @implementation P4MenuLocalFile @synthesize localFilepath ,canOpenForAdd ; - (id)initWithLocalFilepath:(NSString*)path { if ((self = [super init]) == nil ) return nil; if (!path) { [self autorelease]; return nil; } self.localFilepath = path; return self; } - (id)init { return [self initWithLocalFilepath:nil]; } +(id)localFileWithLocalFilepath:(NSString*)path { return [[[P4MenuLocalFile alloc] initWithLocalFilepath:path] autorelease]; } - (void)dealloc { RELEASE( localFilepath ); [super dealloc]; } +(NSSet*)keyPathsForValuesAffectingFilename { return [NSSet setWithObject:@"localFilepath"]; } -(NSString*)filename { return [self.localFilepath lastPathComponent]; } +(NSSet*)keyPathsForValuesAffectingIcon { return [NSSet setWithObject:@"localFilepath"]; } -(NSImage*)icon { if ( !self.localFilepath ) return nil; return [[NSWorkspace sharedWorkspace] iconForFile:self.localFilepath]; } @end