Revision: 6906
http://skim-app.svn.sourceforge.net/skim-app/?rev=6906&view=rev
Author: hofman
Date: 2010-11-28 12:58:25 +0000 (Sun, 28 Nov 2010)
Log Message:
-----------
remove functions to check for document types, just compare the strings, as we
don't support UTI document types
Modified Paths:
--------------
trunk/SKBookmarkController.m
trunk/SKDocumentController.h
trunk/SKDocumentController.m
trunk/SKMainDocument.m
trunk/SKNotesDocument.m
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2010-11-28 12:36:07 UTC (rev 6905)
+++ trunk/SKBookmarkController.m 2010-11-28 12:58:25 UTC (rev 6906)
@@ -246,7 +246,7 @@
NSString *fileType = [dc typeForContentsOfURL:[NSURL
fileURLWithPath:path] error:NULL];
Class docClass;
SKBookmark *bookmark;
- if (SKIsFolderDocumentType(fileType)) {
+ if ([fileType isEqualToString:SKFolderDocumentType]) {
if (bookmark = [SKBookmark bookmarkFolderWithLabel:[fm
displayNameAtPath:path]]) {
[folder insertObject:bookmark
inChildrenAtIndex:insertIndex++];
[self addBookmarksForPaths:[fm
contentsOfDirectoryAtPath:path error:NULL] basePath:path toFolder:bookmark
atIndex:0];
Modified: trunk/SKDocumentController.h
===================================================================
--- trunk/SKDocumentController.h 2010-11-28 12:36:07 UTC (rev 6905)
+++ trunk/SKDocumentController.h 2010-11-28 12:58:25 UTC (rev 6906)
@@ -38,25 +38,6 @@
#import <Cocoa/Cocoa.h>
-// these functions are compatible for 10.4 and 10.5
-
-extern BOOL SKIsPDFDocumentType(NSString *docType);
-extern BOOL SKIsPDFBundleDocumentType(NSString *docType);
-extern BOOL SKIsEmbeddedPDFDocumentType(NSString *docType);
-extern BOOL SKIsBarePDFDocumentType(NSString *docType);
-extern BOOL SKIsNotesDocumentType(NSString *docType);
-extern BOOL SKIsNotesTextDocumentType(NSString *docType);
-extern BOOL SKIsNotesRTFDocumentType(NSString *docType);
-extern BOOL SKIsNotesRTFDDocumentType(NSString *docType);
-extern BOOL SKIsNotesFDFDocumentType(NSString *docType);
-extern BOOL SKIsPostScriptDocumentType(NSString *docType);
-extern BOOL SKIsBarePostScriptDocumentType(NSString *docType);
-extern BOOL SKIsDVIDocumentType(NSString *docType);
-extern BOOL SKIsBareDVIDocumentType(NSString *docType);
-extern BOOL SKIsXDVDocumentType(NSString *docType);
-extern BOOL SKIsBareXDVDocumentType(NSString *docType);
-extern BOOL SKIsFolderDocumentType(NSString *docType);
-
extern NSString *SKPDFDocumentType;
extern NSString *SKPDFBundleDocumentType;
extern NSString *SKEmbeddedPDFDocumentType;
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2010-11-28 12:36:07 UTC (rev 6905)
+++ trunk/SKDocumentController.m 2010-11-28 12:58:25 UTC (rev 6906)
@@ -68,25 +68,6 @@
NSString *SKBareXDVDocumentType = @"XDV Without Notes";
NSString *SKFolderDocumentType = @"Folder";
-#define DEFINE_IS_DOCUMENT_TYPE(name) BOOL SKIs##name##DocumentType(NSString
*docType) { return [docType isEqualToString:SK##name##DocumentType]; }
-
-DEFINE_IS_DOCUMENT_TYPE(PDF)
-DEFINE_IS_DOCUMENT_TYPE(PDFBundle)
-DEFINE_IS_DOCUMENT_TYPE(Notes)
-DEFINE_IS_DOCUMENT_TYPE(PostScript)
-DEFINE_IS_DOCUMENT_TYPE(DVI)
-DEFINE_IS_DOCUMENT_TYPE(XDV)
-DEFINE_IS_DOCUMENT_TYPE(EmbeddedPDF)
-DEFINE_IS_DOCUMENT_TYPE(BarePDF)
-DEFINE_IS_DOCUMENT_TYPE(NotesText)
-DEFINE_IS_DOCUMENT_TYPE(NotesRTF)
-DEFINE_IS_DOCUMENT_TYPE(NotesRTFD)
-DEFINE_IS_DOCUMENT_TYPE(NotesFDF)
-DEFINE_IS_DOCUMENT_TYPE(BarePostScript)
-DEFINE_IS_DOCUMENT_TYPE(BareDVI)
-DEFINE_IS_DOCUMENT_TYPE(BareXDV)
-DEFINE_IS_DOCUMENT_TYPE(Folder)
-
NSString *SKDocumentSetupAliasKey = @"_BDAlias";
NSString *SKDocumentSetupFileNameKey = @"fileName";
@@ -166,7 +147,7 @@
}
if (type == nil && outError)
*outError = error;
- } else if (SKIsNotesFDFDocumentType(type)) {
+ } else if ([type isEqualToString:SKNotesFDFDocumentType]) {
// Springer sometimes sends PDF files with an .fdf extension for
review, huh?
NSString *fileName = [inAbsoluteURL path];
NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:fileName];
@@ -313,7 +294,7 @@
- (id)openDocumentWithContentsOfURL:(NSURL *)absoluteURL
display:(BOOL)displayDocument error:(NSError **)outError {
NSString *type = [self typeForContentsOfURL:absoluteURL error:NULL];
- if (SKIsNotesDocumentType(type)) {
+ if ([type isEqualToString:SKNotesDocumentType]) {
NSAppleEventDescriptor *event = [[NSAppleEventManager
sharedAppleEventManager] currentAppleEvent];
if ([event eventID] == kAEOpenDocuments && [event
descriptorForKeyword:keyAESearchText]) {
NSString *pdfFile = [absoluteURL
pathReplacingPathExtension:@"pdf"];
@@ -321,7 +302,7 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:pdfFile
isDirectory:&isDir] && isDir == NO)
absoluteURL = [NSURL fileURLWithPath:pdfFile];
}
- } else if (SKIsFolderDocumentType(type)) {
+ } else if ([type isEqualToString:SKFolderDocumentType]) {
NSDocument *doc = nil;
NSError *error = nil;
NSString *basePath = [absoluteURL path];
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2010-11-28 12:36:07 UTC (rev 6905)
+++ trunk/SKMainDocument.m 2010-11-28 12:58:25 UTC (rev 6906)
@@ -286,15 +286,15 @@
- (NSArray *)writableTypesForSaveOperation:(NSSaveOperationType)saveOperation {
NSMutableArray *writableTypes = [[[super
writableTypesForSaveOperation:saveOperation] mutableCopy] autorelease];
- if (SKIsPostScriptDocumentType([self fileType]) == NO) {
+ if ([[self fileType] isEqualToString:SKPostScriptDocumentType] == NO) {
[writableTypes removeObject:SKPostScriptDocumentType];
[writableTypes removeObject:SKBarePostScriptDocumentType];
}
- if (SKIsDVIDocumentType([self fileType]) == NO) {
+ if ([[self fileType] isEqualToString:SKDVIDocumentType] == NO) {
[writableTypes removeObject:SKDVIDocumentType];
[writableTypes removeObject:SKBareDVIDocumentType];
}
- if (SKIsXDVDocumentType([self fileType]) == NO) {
+ if ([[self fileType] isEqualToString:SKXDVDocumentType] == NO) {
[writableTypes removeObject:SKXDVDocumentType];
[writableTypes removeObject:SKBareXDVDocumentType];
}
@@ -418,10 +418,10 @@
NSURL *absoluteURL = [info objectForKey:URL_KEY];
NSString *typeName = [info objectForKey:TYPE_KEY];
- if (SKIsPDFDocumentType(typeName) ||
SKIsPostScriptDocumentType(typeName) || SKIsDVIDocumentType(typeName) ||
SKIsXDVDocumentType(typeName)) {
+ if ([typeName isEqualToString:SKPDFDocumentType] || [typeName
isEqualToString:SKPostScriptDocumentType] || [typeName
isEqualToString:SKDVIDocumentType] || [typeName
isEqualToString:SKXDVDocumentType]) {
// we check for notes and may save a .skim as well:
[self saveNotesToURL:absoluteURL ofType:typeName
forSaveOperation:saveOperation];
- } else if (SKIsPDFBundleDocumentType(typeName) && tmpPath) {
+ } else if ([typeName isEqualToString:SKPDFBundleDocumentType] &&
tmpPath) {
// move extra package content like version info to the new location
NSFileManager *fm = [NSFileManager defaultManager];
NSString *path = [absoluteURL path];
@@ -476,7 +476,7 @@
[info setObject:invocation forKey:CALLBACK_KEY];
}
- if (SKIsPDFBundleDocumentType(typeName) && SKIsPDFBundleDocumentType([self
fileType]) && [self fileURL] && saveOperation != NSSaveToOperation) {
+ if ([typeName isEqualToString:SKPDFBundleDocumentType] && [[self fileType]
isEqualToString:SKPDFBundleDocumentType] && [self fileURL] && saveOperation !=
NSSaveToOperation) {
NSFileManager *fm = [NSFileManager defaultManager];
NSString *path = [[self fileURL] path];
NSString *tmpPath = nil;
@@ -499,22 +499,22 @@
- (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName
error:(NSError **)outError{
BOOL didWrite = NO;
NSError *error = nil;
- if (SKIsEmbeddedPDFDocumentType(typeName)) {
+ if ([typeName isEqualToString:SKEmbeddedPDFDocumentType]) {
// this must be checked before PDF, as we check for comformance to the
UTI
[[self mainWindowController] removeTemporaryAnnotations];
didWrite = [[self pdfDocument] writeToURL:absoluteURL];
- } else if (SKIsPDFDocumentType(typeName) ||
SKIsBarePDFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKPDFDocumentType] || [typeName
isEqualToString:SKBarePDFDocumentType]) {
didWrite = [pdfData writeToURL:absoluteURL options:0 error:&error];
- } else if (SKIsPostScriptDocumentType(typeName) ||
SKIsBarePostScriptDocumentType(typeName)) {
- if (SKIsPostScriptDocumentType([self fileType]))
+ } else if ([typeName isEqualToString:SKPostScriptDocumentType] ||
[typeName isEqualToString:SKBarePostScriptDocumentType]) {
+ if ([[self fileType] isEqualToString:SKPostScriptDocumentType])
didWrite = [psOrDviData writeToURL:absoluteURL options:0
error:&error];
- } else if (SKIsDVIDocumentType(typeName) ||
SKIsBareDVIDocumentType(typeName)) {
- if (SKIsDVIDocumentType([self fileType]))
+ } else if ([typeName isEqualToString:SKDVIDocumentType] || [typeName
isEqualToString:SKBareDVIDocumentType]) {
+ if ([[self fileType] isEqualToString:SKDVIDocumentType])
didWrite = [psOrDviData writeToURL:absoluteURL options:0
error:&error];
- } else if (SKIsXDVDocumentType(typeName) ||
SKIsBareXDVDocumentType(typeName)) {
- if (SKIsXDVDocumentType([self fileType]))
+ } else if ([typeName isEqualToString:SKXDVDocumentType] || [typeName
isEqualToString:SKBareXDVDocumentType]) {
+ if ([[self fileType] isEqualToString:SKXDVDocumentType])
didWrite = [psOrDviData writeToURL:absoluteURL options:0
error:&error];
- } else if (SKIsPDFBundleDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKPDFBundleDocumentType]) {
NSString *name = [[[absoluteURL path] lastPathComponent]
stringByDeletingPathExtension];
if ([name caseInsensitiveCompare:BUNDLE_DATA_FILENAME] ==
NSOrderedSame)
name = [name stringByAppendingString:@"1"];
@@ -543,30 +543,30 @@
}
didWrite = [fileWrapper writeToFile:[absoluteURL path] atomically:NO
updateFilenames:NO];
[fileWrapper release];
- } else if (SKIsNotesDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesDocumentType]) {
didWrite = [[NSFileManager defaultManager] writeSkimNotes:[[self
notes] valueForKey:@"SkimNoteProperties"] toSkimFileAtURL:absoluteURL
error:&error];
- } else if (SKIsNotesRTFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesRTFDocumentType]) {
NSData *data = [self notesRTFData];
if (data)
didWrite = [data writeToURL:absoluteURL options:0 error:&error];
else
error = [NSError errorWithDomain:SKDocumentErrorDomain
code:SKWriteFileError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write notes as RTF",
@"Error description"), NSLocalizedDescriptionKey, nil]];
- } else if (SKIsNotesRTFDDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesRTFDDocumentType]) {
NSFileWrapper *fileWrapper = [self notesRTFDFileWrapper];
if (fileWrapper)
didWrite = [fileWrapper writeToFile:[absoluteURL path]
atomically:NO updateFilenames:NO];
else
error = [NSError errorWithDomain:SKDocumentErrorDomain
code:SKWriteFileError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write notes as
RTFD", @"Error description"), NSLocalizedDescriptionKey, nil]];
- } else if (SKIsNotesTextDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesTextDocumentType]) {
NSString *string = [self notesString];
if (string)
didWrite = [string writeToURL:absoluteURL atomically:YES
encoding:NSUTF8StringEncoding error:&error];
else
error = [NSError errorWithDomain:SKDocumentErrorDomain
code:SKWriteFileError userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:NSLocalizedString(@"Unable to write notes as
text", @"Error description"), NSLocalizedDescriptionKey, nil]];
- } else if (SKIsNotesFDFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesFDFDocumentType]) {
NSString *filePath = [[self fileURL] path];
NSString *filename = [filePath lastPathComponent];
- if (filename && SKIsPDFBundleDocumentType([self fileType]))
+ if (filename && [[self fileType]
isEqualToString:SKPDFBundleDocumentType])
filename = [[NSFileManager defaultManager]
bundledFileWithExtension:@"pdf" inPDFBundleAtPath:filePath error:NULL];
NSData *data = [self notesFDFDataForFile:filename fileIDStrings:[self
fileIDStrings]];
if (data)
@@ -597,21 +597,21 @@
NSMutableDictionary *dict = [[[super
fileAttributesToWriteToURL:absoluteURL ofType:typeName
forSaveOperation:saveOperation originalContentsURL:absoluteOriginalContentsURL
error:outError] mutableCopy] autorelease];
// only set the creator code for our native types
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldSetCreatorCodeKey] && (SKIsPDFDocumentType(typeName) ||
SKIsPDFBundleDocumentType(typeName) || SKIsPostScriptDocumentType(typeName) ||
SKIsDVIDocumentType(typeName) || SKIsXDVDocumentType(typeName) ||
SKIsNotesDocumentType(typeName)))
+ if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldSetCreatorCodeKey] && ([typeName
isEqualToString:SKPDFDocumentType] || [typeName
isEqualToString:SKPDFBundleDocumentType] || [typeName
isEqualToString:SKPostScriptDocumentType] || [typeName
isEqualToString:SKDVIDocumentType] || [typeName
isEqualToString:SKXDVDocumentType] || [typeName
isEqualToString:SKNotesDocumentType]))
[dict setObject:[NSNumber numberWithUnsignedInt:'SKim']
forKey:NSFileHFSCreatorCode];
if ([[[absoluteURL path] pathExtension] isEqualToString:@"pdf"] ||
- SKIsPDFDocumentType(typeName) || SKIsEmbeddedPDFDocumentType(typeName)
|| SKIsBarePDFDocumentType(typeName))
+ [typeName isEqualToString:SKPDFDocumentType] || [typeName
isEqualToString:SKEmbeddedPDFDocumentType] || [typeName
isEqualToString:SKBarePDFDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'PDF ']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"pdfd"] ||
SKIsPDFBundleDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"pdfd"] ||
[typeName isEqualToString:SKPDFBundleDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'PDFD']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"skim"] ||
SKIsNotesDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"skim"] ||
[typeName isEqualToString:SKNotesDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'SKNT']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"fdf"] ||
SKIsNotesFDFDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"fdf"] ||
[typeName isEqualToString:SKNotesFDFDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'FDF ']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"rtf"] ||
SKIsNotesRTFDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"rtf"] ||
[typeName isEqualToString:SKNotesRTFDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'RTF ']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"txt"] ||
SKIsNotesTextDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"txt"] ||
[typeName isEqualToString:SKNotesTextDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'TEXT']
forKey:NSFileHFSTypeCode];
return dict;
@@ -644,7 +644,7 @@
[tmpData release];
tmpData = [[SKTemporaryData alloc] init];
- if (SKIsPostScriptDocumentType(docType)) {
+ if ([docType isEqualToString:SKPostScriptDocumentType]) {
[self setPSOrDVIData:data];
data = [SKConversionProgressController PDFDataWithPostScriptData:data];
}
@@ -683,7 +683,7 @@
[tmpData release];
tmpData = [[SKTemporaryData alloc] init];
- if (SKIsPDFBundleDocumentType(docType)) {
+ if ([docType isEqualToString:SKPDFBundleDocumentType]) {
NSString *path = [absoluteURL path];
NSString *pdfFile = [[NSFileManager defaultManager]
bundledFileWithExtension:@"pdf" inPDFBundleAtPath:path error:&error];
if (pdfFile) {
@@ -710,16 +710,16 @@
}
} else {
if (fileData = [[NSData alloc] initWithContentsOfURL:absoluteURL
options:NSUncachedRead error:&error]) {
- if (SKIsPDFDocumentType(docType)) {
+ if ([docType isEqualToString:SKPDFDocumentType]) {
if (data = [fileData retain])
pdfDoc = [[SKPDFDocument alloc] initWithURL:absoluteURL];
- } else if (SKIsPostScriptDocumentType(docType)) {
+ } else if ([docType isEqualToString:SKPostScriptDocumentType]) {
if (data = [[SKConversionProgressController
PDFDataWithPostScriptData:fileData] retain])
pdfDoc = [[SKPDFDocument alloc] initWithData:data];
- } else if (SKIsDVIDocumentType(docType)) {
+ } else if ([docType isEqualToString:SKDVIDocumentType]) {
if (data = [[SKConversionProgressController
PDFDataWithDVIFile:[absoluteURL path]] retain])
pdfDoc = [[SKPDFDocument alloc] initWithData:data];
- } else if (SKIsXDVDocumentType(docType)) {
+ } else if ([docType isEqualToString:SKXDVDocumentType]) {
if (data = [[SKConversionProgressController
PDFDataWithXDVFile:[absoluteURL path]] retain])
pdfDoc = [[SKPDFDocument alloc] initWithData:data];
}
@@ -775,7 +775,7 @@
didRead = YES;
[self setPDFData:data];
[tmpData setPdfDocument:pdfDoc];
- if (SKIsPostScriptDocumentType(docType) ||
SKIsDVIDocumentType(docType) || SKIsXDVDocumentType(docType))
+ if ([docType isEqualToString:SKPostScriptDocumentType] || [docType
isEqualToString:SKDVIDocumentType] || [docType
isEqualToString:SKXDVDocumentType])
[self setPSOrDVIData:fileData];
[pdfDoc release];
docFlags.fileChangedOnDisk = NO;
@@ -785,7 +785,7 @@
NSDictionary *dictionary = nil;
NSArray *array = nil;
NSNumber *number = nil;
- if (SKIsPDFBundleDocumentType(docType)) {
+ if ([docType isEqualToString:SKPDFBundleDocumentType]) {
NSData *infoData = [NSData
dataWithContentsOfFile:[[[absoluteURL path]
stringByAppendingPathComponent:BUNDLE_DATA_FILENAME]
stringByAppendingPathExtension:@"plist"]];
if (infoData) {
NSString *errorString = nil;
@@ -1022,7 +1022,7 @@
}
- (IBAction)convertNotes:(id)sender {
- if (SKIsPDFDocumentType([self fileType]) == NO &&
SKIsPDFBundleDocumentType([self fileType]) == NO) {
+ if ([[self fileType] isEqualToString:SKPDFDocumentType] == NO && [[self
fileType] isEqualToString:SKPDFBundleDocumentType] == NO) {
NSBeep();
return;
}
@@ -1248,7 +1248,7 @@
} else if ([anItem action] == @selector(printDocument:)) {
return [[self pdfDocument] allowsPrinting];
} else if ([anItem action] == @selector(convertNotes:)) {
- return SKIsPDFDocumentType([self fileType]) && [[self pdfDocument]
isLocked] == NO;
+ return [[self fileType] isEqualToString:SKPDFDocumentType] && [[self
pdfDocument] isLocked] == NO;
} else if ([anItem action] == @selector(saveArchive:) || [anItem action]
== @selector(saveDiskImage:) || [anItem action] == @selector(emailArchive:) ||
[anItem action] == @selector(emailDiskImage:)) {
NSString *path = [[self fileURL] path];
return path && [[NSFileManager defaultManager] fileExistsAtPath:path]
&& [self isDocumentEdited] == NO;
@@ -2133,7 +2133,7 @@
}
- (void)handleConvertNotesScriptCommand:(NSScriptCommand *)command {
- if (SKIsPDFDocumentType([self fileType]) ||
SKIsPDFBundleDocumentType([self fileType]))
+ if ([[self fileType] isEqualToString:SKPDFDocumentType] || [[self
fileType] isEqualToString:SKPDFBundleDocumentType])
[self convertNotesSheetDidEnd:nil returnCode:NSAlertDefaultReturn
contextInfo:NULL];
else
[command setScriptErrorNumber:NSArgumentsWrongScriptError];
@@ -2147,7 +2147,7 @@
} else {
NSNumber *replaceNumber = [args objectForKey:@"Replace"];
NSString *fileType = [[NSDocumentController sharedDocumentController]
typeForContentsOfURL:notesURL error:NULL];
- if (SKIsNotesDocumentType(fileType) ||
SKIsNotesFDFDocumentType(fileType))
+ if ([fileType isEqualToString:SKNotesDocumentType] || [fileType
isEqualToString:SKNotesFDFDocumentType])
[self readNotesFromURL:notesURL replace:(replaceNumber ?
[replaceNumber boolValue] : YES)];
else
[command setScriptErrorNumber:NSArgumentsWrongScriptError];
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2010-11-28 12:36:07 UTC (rev 6905)
+++ trunk/SKNotesDocument.m 2010-11-28 12:58:25 UTC (rev 6906)
@@ -213,9 +213,9 @@
- (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError
**)outError {
NSFileWrapper *fileWrapper = nil;
- if (SKIsNotesDocumentType(typeName) || SKIsNotesTextDocumentType(typeName)
|| SKIsNotesRTFDocumentType(typeName) || SKIsNotesFDFDocumentType(typeName) ||
[[typeName pathExtension] caseInsensitiveCompare:@"rtfd"] != NSOrderedSame) {
+ if ([typeName isEqualToString:SKNotesDocumentType] || [typeName
isEqualToString:SKNotesTextDocumentType] || [typeName
isEqualToString:SKNotesRTFDocumentType] || [typeName
isEqualToString:SKNotesFDFDocumentType] || [[typeName pathExtension]
caseInsensitiveCompare:@"rtfd"] != NSOrderedSame) {
fileWrapper = [super fileWrapperOfType:typeName error:outError];
- } else if (SKIsNotesRTFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesRTFDocumentType]) {
fileWrapper = [self notesRTFDFileWrapper];
} else {
fileWrapper = [self notesFileWrapperUsingTemplateFile:typeName];
@@ -230,13 +230,13 @@
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {
NSData *data = nil;
- if (SKIsNotesDocumentType(typeName)) {
+ if ([typeName isEqualToString:SKNotesDocumentType]) {
data = [self notesData];
- } else if (SKIsNotesTextDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesTextDocumentType]) {
data = [[self notesString] dataUsingEncoding:NSUTF8StringEncoding];
- } else if (SKIsNotesRTFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesRTFDocumentType]) {
data = [self notesRTFData];
- } else if (SKIsNotesFDFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesFDFDocumentType]) {
NSString *filename = [[self fileURL]
pathReplacingPathExtension:@"pdf"];
if ([[NSFileManager defaultManager] fileExistsAtPath:filename])
filename = [filename lastPathComponent];
@@ -257,9 +257,9 @@
BOOL didRead = NO;
NSArray *array = nil;
- if (SKIsNotesDocumentType(typeName)) {
+ if ([typeName isEqualToString:SKNotesDocumentType]) {
array = [NSKeyedUnarchiver unarchiveObjectWithData:data];
- } else if (SKIsNotesFDFDocumentType(typeName)) {
+ } else if ([typeName isEqualToString:SKNotesFDFDocumentType]) {
array = [SKFDFParser noteDictionariesFromFDFData:data];
}
@@ -306,14 +306,14 @@
NSMutableDictionary *dict = [[[super
fileAttributesToWriteToURL:absoluteURL ofType:typeName
forSaveOperation:saveOperation originalContentsURL:absoluteOriginalContentsURL
error:outError] mutableCopy] autorelease];
// only set the creator code for our native types
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldSetCreatorCodeKey] && SKIsNotesDocumentType(typeName))
+ if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKShouldSetCreatorCodeKey] && [typeName
isEqualToString:SKNotesDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'SKim']
forKey:NSFileHFSCreatorCode];
- if ([[[absoluteURL path] pathExtension] isEqualToString:@"skim"] ||
SKIsNotesDocumentType(typeName))
+ if ([[[absoluteURL path] pathExtension] isEqualToString:@"skim"] ||
[typeName isEqualToString:SKNotesDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'SKNT']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"rtf"] ||
SKIsNotesRTFDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"rtf"] ||
[typeName isEqualToString:SKNotesRTFDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'RTF ']
forKey:NSFileHFSTypeCode];
- else if ([[[absoluteURL path] pathExtension] isEqualToString:@"txt"] ||
SKIsNotesTextDocumentType(typeName))
+ else if ([[[absoluteURL path] pathExtension] isEqualToString:@"txt"] ||
[typeName isEqualToString:SKNotesTextDocumentType])
[dict setObject:[NSNumber numberWithUnsignedInt:'TEXT']
forKey:NSFileHFSTypeCode];
return dict;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit