diff options
author | rowanbeentje <rowan@beent.je> | 2012-02-08 01:42:21 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-02-08 01:42:21 +0000 |
commit | 700d4e71f39e7e10f6838543f8f9f2fda81a8eba (patch) | |
tree | 7f3e75b6842ceaa46dee26842c4e8bc7c4de35f2 /Source/SPFieldEditorController.m | |
parent | 36c061403637d5fefc1473ac3b668e54b1341871 (diff) | |
download | sequelpro-700d4e71f39e7e10f6838543f8f9f2fda81a8eba.tar.gz sequelpro-700d4e71f39e7e10f6838543f8f9f2fda81a8eba.tar.bz2 sequelpro-700d4e71f39e7e10f6838543f8f9f2fda81a8eba.zip |
- Cleanup: improve compatibility with 10.7 SDK to reduce compiler warnings
Diffstat (limited to 'Source/SPFieldEditorController.m')
-rw-r--r-- | Source/SPFieldEditorController.m | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 7c8a960c..2df24c24 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -548,7 +548,7 @@ NSString *fileDefault = @""; if([editSheetSegmentControl selectedSegment] == 1 && [sheetEditData isKindOfClass:[MCPGeometryData class]]) { - [panel setRequiredFileType:@"pdf"]; + [panel setAllowedFileTypes:[NSArray arrayWithObject:@"pdf"]]; [panel setAllowsOtherFileTypes:NO]; } else { [panel setAllowsOtherFileTypes:YES]; @@ -642,7 +642,6 @@ - (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo { if (returnCode == NSOKButton) { - NSString *fileName = [panel filename]; NSString *contents = nil; editSheetWillBeInitialized = YES; @@ -655,7 +654,7 @@ } // load new data/images - sheetEditData = [[NSData alloc] initWithContentsOfFile:fileName]; + sheetEditData = [[NSData alloc] initWithContentsOfURL:[panel URL]]; NSImage *image = [[NSImage alloc] initWithData:sheetEditData]; contents = [[NSString alloc] initWithData:sheetEditData encoding:encoding]; @@ -710,37 +709,37 @@ [editSheetProgressBar startAnimation:self]; - NSString *fileName = [panel filename]; + NSURL *fileURL = [panel URL]; // Write binary field types directly to the file if ( [sheetEditData isKindOfClass:[NSData class]] ) { - [sheetEditData writeToFile:fileName atomically:YES]; + [sheetEditData writeToURL:fileURL atomically:YES]; } else if ( [sheetEditData isKindOfClass:[MCPGeometryData class]] ) { if ( [editSheetSegmentControl selectedSegment] == 0 || editImage == nil ) { - [[editTextView string] writeToFile:fileName - atomically:YES - encoding:encoding - error:NULL]; + [[editTextView string] writeToURL:fileURL + atomically:YES + encoding:encoding + error:NULL]; } else if (editImage != nil){ SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0f] autorelease]; NSData *pdf = [v pdfData]; if(pdf) - [pdf writeToFile:fileName atomically:YES]; + [pdf writeToURL:fileURL atomically:YES]; } } // Write other field types' representations to the file via the current encoding else { - [[sheetEditData description] writeToFile:fileName - atomically:YES - encoding:encoding - error:NULL]; + [[sheetEditData description] writeToURL:fileURL + atomically:YES + encoding:encoding + error:NULL]; } [editSheetProgressBar stopAnimation:self]; |