Revision: 7464 http://skim-app.svn.sourceforge.net/skim-app/?rev=7464&view=rev Author: hofman Date: 2011-08-31 15:15:56 +0000 (Wed, 31 Aug 2011) Log Message: ----------- hide rtfd template type determination behind method
Modified Paths: -------------- trunk/NSDocument_SKExtensions.m trunk/SKMainDocument.m trunk/SKNotesDocument.m trunk/SKTemplateManager.h trunk/SKTemplateManager.m Modified: trunk/NSDocument_SKExtensions.m =================================================================== --- trunk/NSDocument_SKExtensions.m 2011-08-31 11:08:58 UTC (rev 7463) +++ trunk/NSDocument_SKExtensions.m 2011-08-31 15:15:56 UTC (rev 7464) @@ -177,7 +177,7 @@ - (NSFileWrapper *)notesFileWrapperForTemplateType:(NSString *)typeName { NSFileWrapper *fileWrapper = nil; - if ([[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"]) { + if ([[SKTemplateManager sharedManager] isPackageTemplateType:typeName]) { NSString *templatePath = [[SKTemplateManager sharedManager] pathForTemplateType:typeName]; NSDictionary *docAttributes = nil; NSAttributedString *templateAttrString = [[NSAttributedString alloc] initWithPath:templatePath documentAttributes:&docAttributes]; Modified: trunk/SKMainDocument.m =================================================================== --- trunk/SKMainDocument.m 2011-08-31 11:08:58 UTC (rev 7463) +++ trunk/SKMainDocument.m 2011-08-31 15:15:56 UTC (rev 7464) @@ -589,7 +589,7 @@ didWrite = [data writeToURL:absoluteURL options:0 error:&error]; else error = [NSError writeFileErrorWithLocalizedDescription:NSLocalizedString(@"Unable to write notes as FDF", @"Error description")]; - } else if ([[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"]) { + } else if ([[SKTemplateManager sharedManager] isPackageTemplateType:typeName]) { NSFileWrapper *fileWrapper = [self notesFileWrapperForTemplateType:typeName]; if (fileWrapper) didWrite = [fileWrapper writeToFile:[absoluteURL path] atomically:NO updateFilenames:NO]; Modified: trunk/SKNotesDocument.m =================================================================== --- trunk/SKNotesDocument.m 2011-08-31 11:08:58 UTC (rev 7463) +++ trunk/SKNotesDocument.m 2011-08-31 15:15:56 UTC (rev 7464) @@ -244,7 +244,7 @@ if ([typeName isEqualToString:SKNotesRTFDocumentType]) fileWrapper = [self notesRTFDFileWrapper]; - else if ([typeName isEqualToString:SKNotesDocumentType] || [typeName isEqualToString:SKNotesTextDocumentType] || [typeName isEqualToString:SKNotesRTFDocumentType] || [typeName isEqualToString:SKNotesFDFDocumentType] || [[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"] == NO) + else if ([typeName isEqualToString:SKNotesDocumentType] || [typeName isEqualToString:SKNotesTextDocumentType] || [typeName isEqualToString:SKNotesRTFDocumentType] || [typeName isEqualToString:SKNotesFDFDocumentType] || [[SKTemplateManager sharedManager] isPackageTemplateType:typeName] == NO) fileWrapper = [super fileWrapperOfType:typeName error:outError]; else fileWrapper = [self notesFileWrapperForTemplateType:typeName]; Modified: trunk/SKTemplateManager.h =================================================================== --- trunk/SKTemplateManager.h 2011-08-31 11:08:58 UTC (rev 7463) +++ trunk/SKTemplateManager.h 2011-08-31 15:15:56 UTC (rev 7464) @@ -49,10 +49,12 @@ - (void)resetCustomTemplateTypes; - (NSString *)pathForTemplateType:(NSString *)typeName; + - (NSString *)fileNameExtensionForTemplateType:(NSString *)typeName; - (NSString *)displayNameForTemplateType:(NSString *)typeName; - (NSString *)templateTypeForDisplayName:(NSString *)name; - (BOOL)isRichTextTemplateType:(NSString *)typeName; +- (BOOL)isPackageTemplateType:(NSString *)typeName; @end Modified: trunk/SKTemplateManager.m =================================================================== --- trunk/SKTemplateManager.m 2011-08-31 11:08:58 UTC (rev 7463) +++ trunk/SKTemplateManager.m 2011-08-31 15:15:56 UTC (rev 7464) @@ -38,6 +38,7 @@ #import "SKTemplateManager.h" #import "NSFileManager_SKExtensions.h" +#import "NSString_SKExtensions.h" #define TEMPLATES_DIRECTORY @"Templates" @@ -118,4 +119,8 @@ return [types containsObject:[[isRichTextTemplateFile pathExtension] lowercaseString]]; } +- (BOOL)isPackageTemplateType:(NSString *)typeName { + return [[typeName pathExtension] isCaseInsensitiveEqual:@"rtfd"]; +} + @end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit