aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-15 13:55:29 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-15 13:55:29 +0000
commit1fddbf3316c6d9b61952426f285d8ed4765cee45 (patch)
tree314b179265fd861af44314b546b294999ad1ca59 /Source
parent89c1a27700dff50d7c8c1cf76196abbec69f9024 (diff)
downloadsequelpro-1fddbf3316c6d9b61952426f285d8ed4765cee45.tar.gz
sequelpro-1fddbf3316c6d9b61952426f285d8ed4765cee45.tar.bz2
sequelpro-1fddbf3316c6d9b61952426f285d8ed4765cee45.zip
• Quicklook - some minor corrections
- note : still some sql files can be opened only sometimes - reason can't pin down so far
Diffstat (limited to 'Source')
-rw-r--r--Source/GeneratePreviewForURL.m30
1 files changed, 15 insertions, 15 deletions
diff --git a/Source/GeneratePreviewForURL.m b/Source/GeneratePreviewForURL.m
index d31c8a55..cef1e4ad 100644
--- a/Source/GeneratePreviewForURL.m
+++ b/Source/GeneratePreviewForURL.m
@@ -60,24 +60,14 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
NSError *templateReadError = nil;
- if (QLPreviewRequestIsCancelled(preview)) {
- if(pool) [pool release], pool = nil;
- return noErr;
- }
-
NSString *html = @"";
NSString *template = nil;
- if (QLPreviewRequestIsCancelled(preview)) {
- if(pool) [pool release], pool = nil;
- return noErr;
- }
-
NSInteger previewHeight = 280;
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[myURL path] error:nil];
- // Dispatch different fiel extensions
+ // Dispatch different file extensions
if([urlExtension isEqualToString:@"spf"]) {
NSError *readError = nil;
@@ -429,6 +419,15 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
else
[sqlHTML appendFormat:@"<font color=%@>%@</font>", tokenColor, [[sqlText substringWithRange:tokenRange] HTMLEscapeString]];
+ if (QLPreviewRequestIsCancelled(preview)) {
+ if(sqlHTML) [sqlHTML release], sqlHTML = nil;
+ if(truncatedString) [truncatedString release], sqlHTML = nil;
+ if(sqlText) [sqlText release], sqlHTML = nil;
+ if(pool) [pool release], pool = nil;
+ return noErr;
+ }
+
+
}
[sqlHTML appendString:truncatedString];
[sqlText release];
@@ -470,10 +469,10 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
else
iconImage = [iconImages objectAtIndex:0];
- image = [[iconImage TIFFRepresentation] retain];
+ image = [iconImage TIFFRepresentation];
- props = [[NSMutableDictionary alloc] init];
- imgProps = [[NSMutableDictionary alloc] init];
+ props = [[NSMutableDictionary alloc] initWithCapacity:6];
+ imgProps = [[NSMutableDictionary alloc] initWithCapacity:2];
[props setObject:[NSNumber numberWithInt:previewHeight] forKey:(NSString *)kQLPreviewPropertyHeightKey];
[props setObject:[NSNumber numberWithInt:600] forKey:(NSString *)kQLPreviewPropertyWidthKey];
@@ -485,6 +484,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
[props setObject:[NSDictionary dictionaryWithObject:imgProps forKey:@"icon.tiff"] forKey:(NSString *)kQLPreviewPropertyAttachmentsKey];
[props setObject:@"UTF-8" forKey:(NSString *)kQLPreviewPropertyTextEncodingNameKey];
+ [props setObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:(NSString *)kQLPreviewPropertyStringEncodingKey];
[props setObject:@"text/html" forKey:(NSString *)kQLPreviewPropertyMIMETypeKey];
QLPreviewRequestSetDataRepresentation(preview,
@@ -495,7 +495,7 @@ OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview,
[props release];
[imgProps release];
- if(image) [image release], image = nil;
+
[pool release];
return noErr;