diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-09-27 13:26:47 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-09-27 13:26:47 +0000 |
commit | 2183eeefefb81846c2cc2c6b4bf68b12167f2b24 (patch) | |
tree | dedc18dc550106e3d889c26fe263b3319f896c06 | |
parent | 572b761e971c732585ef5f0fcf852e1842d44e31 (diff) | |
download | sequelpro-2183eeefefb81846c2cc2c6b4bf68b12167f2b24.tar.gz sequelpro-2183eeefefb81846c2cc2c6b4bf68b12167f2b24.tar.bz2 sequelpro-2183eeefefb81846c2cc2c6b4bf68b12167f2b24.zip |
• marked 'sequel-pro-print-template.html' as localizable
• outsourced default QuickLook types into a localizable plist
- prepared SP preferences and SP code to allow the user to add own QL types
• prepared a localizable 'ContentFilter.plist' [not yet implemented fully]
- this plist will held the default filter operators
- this approach will give the user the chance to add own filters
• removed three tiny memory leaks
Note: In MCPResult.m variable 'MCPYear0000' was stored retained. Why?
I removed it and couldn't encounter any problems.
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPResult.m | 2 | ||||
-rw-r--r-- | Resources/English.lproj/ContentFilters.plist | 7 | ||||
-rw-r--r-- | Resources/English.lproj/EditorQuickLookTypes.plist | 89 | ||||
-rw-r--r-- | Resources/English.lproj/sequel-pro-print-template.html (renamed from Resources/sequel-pro-print-template.html) | 0 | ||||
-rw-r--r-- | Resources/PreferenceDefaults.plist | 85 | ||||
-rw-r--r-- | Source/CustomQuery.m | 2 | ||||
-rw-r--r-- | Source/SPFieldEditorController.h | 2 | ||||
-rw-r--r-- | Source/SPFieldEditorController.m | 37 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 40 |
9 files changed, 171 insertions, 93 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m index bb7bef5e..9d49bda3 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPResult.m @@ -228,7 +228,7 @@ const OUR_CHARSET our_charsets60[] = { if (self = [MCPResult class]) { [self setVersion:030001]; // Ma.Mi.Re -> MaMiRe - MCPYear0000 = [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0] retain]; + MCPYear0000 = [NSCalendarDate dateWithTimeIntervalSinceReferenceDate:-63146822400.0]; [MCPYear0000 setCalendarFormat:@"%Y"]; } } diff --git a/Resources/English.lproj/ContentFilters.plist b/Resources/English.lproj/ContentFilters.plist new file mode 100644 index 00000000..4768f16b --- /dev/null +++ b/Resources/English.lproj/ContentFilters.plist @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + + </dict> +</plist> diff --git a/Resources/English.lproj/EditorQuickLookTypes.plist b/Resources/English.lproj/EditorQuickLookTypes.plist new file mode 100644 index 00000000..011124b8 --- /dev/null +++ b/Resources/English.lproj/EditorQuickLookTypes.plist @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>QuickLookTypes</key> + <array> + <dict> + <key>MenuLabel</key> + <string>Image</string> + <key>Extension</key> + <string>icns</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (m4a)</string> + <key>Extension</key> + <string>m4a</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (mp3)</string> + <key>Extension</key> + <string>mp3</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Sound (linear)</string> + <key>Extension</key> + <string>wav</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Movie (mov)</string> + <key>Extension</key> + <string>mov</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>PDF</string> + <key>Extension</key> + <string>pdf</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>HTML</string> + <key>Extension</key> + <string>html</string> + <key>treatAsText</key> + <true/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Word Document</string> + <key>Extension</key> + <string>doc</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>Word Document (xml)</string> + <key>Extension</key> + <string>docx</string> + <key>treatAsText</key> + <false/> + </dict> + <dict> + <key>MenuLabel</key> + <string>RTF</string> + <key>Extension</key> + <string>rtf</string> + <key>treatAsText</key> + <false/> + </dict> + </array> + </dict> +</plist> diff --git a/Resources/sequel-pro-print-template.html b/Resources/English.lproj/sequel-pro-print-template.html index 9dd2f624..9dd2f624 100644 --- a/Resources/sequel-pro-print-template.html +++ b/Resources/English.lproj/sequel-pro-print-template.html diff --git a/Resources/PreferenceDefaults.plist b/Resources/PreferenceDefaults.plist index 825a093d..33964fbb 100644 --- a/Resources/PreferenceDefaults.plist +++ b/Resources/PreferenceDefaults.plist @@ -107,87 +107,8 @@ <key>PrintImagePreviews</key> <true/> <key>QuickLookTypes</key> - <array> - <dict> - <key>MenuLabel</key> - <string>Image</string> - <key>Extension</key> - <string>icns</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Sound (m4a)</string> - <key>Extension</key> - <string>m4a</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Sound (mp3)</string> - <key>Extension</key> - <string>mp3</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Sound (linear)</string> - <key>Extension</key> - <string>wav</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Movie (mov)</string> - <key>Extension</key> - <string>mov</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>PDF</string> - <key>Extension</key> - <string>pdf</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>HTML</string> - <key>Extension</key> - <string>html</string> - <key>treatAsText</key> - <true/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Word Document</string> - <key>Extension</key> - <string>doc</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>Word Document (xml)</string> - <key>Extension</key> - <string>docx</string> - <key>treatAsText</key> - <false/> - </dict> - <dict> - <key>MenuLabel</key> - <string>RTF</string> - <key>Extension</key> - <string>rtf</string> - <key>treatAsText</key> - <false/> - </dict> - </array> + <array/> + <key>ContentFilters</key> + <array/> </dict> </plist> diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m index f393dc45..3f2afc2f 100644 --- a/Source/CustomQuery.m +++ b/Source/CustomQuery.m @@ -2626,6 +2626,8 @@ [usedQuery release]; [fullResult release]; [favoritesManager release]; + if (helpHTMLTemplate) [helpHTMLTemplate release]; + if (mySQLversion) [mySQLversion release]; if (sortField) [sortField release]; [super dealloc]; diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h index 56b7a2bd..6349f568 100644 --- a/Source/SPFieldEditorController.h +++ b/Source/SPFieldEditorController.h @@ -60,6 +60,8 @@ NSUserDefaults *prefs; + NSDictionary *qlTypes; + int editSheetReturnCode; NSUndoManager *esUndoManager; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index 2234681f..bdb78726 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -65,6 +65,32 @@ [menu addItem:item]; [item release]; NSUInteger tag = 2; + + // Load default QL types + NSMutableArray *qlTypesItems = [[NSMutableArray alloc] init]; + NSError *readError = nil; + NSString *convError = nil; + NSPropertyListFormat format; + + NSData *defaultTypeData = [NSData dataWithContentsOfFile:[NSBundle pathForResource:@"EditorQuickLookTypes.plist" ofType:nil inDirectory:[[NSBundle mainBundle] bundlePath]] + options:NSMappedRead error:&readError]; + + NSDictionary *defaultQLTypes = [NSPropertyListSerialization propertyListFromData:defaultTypeData + mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError]; + if(defaultQLTypes == nil || readError != nil || convError != nil) + NSLog(@"Error while reading 'EditorQuickLookTypes.plist':\n%@\n%@", [readError localizedDescription], convError); + if(defaultQLTypes != nil && [defaultQLTypes objectForKey:@"QuickLookTypes"]) { + for(id type in [defaultQLTypes objectForKey:@"QuickLookTypes"]) { + NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""]; + [item setTag:tag]; + [item setAction:@selector(quickLookFormatButton:)]; + [menu addItem:item]; + [item release]; + tag++; + [qlTypesItems addObject:type]; + } + } + // Load user-defined QL types if([prefs objectForKey:@"QuickLookTypes"]) { for(id type in [prefs objectForKey:@"QuickLookTypes"]) { NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithString:[type objectForKey:@"MenuLabel"]] action:NULL keyEquivalent:@""]; @@ -73,9 +99,11 @@ [menu addItem:item]; [item release]; tag++; + [qlTypesItems addObject:type]; } } - + qlTypes = [NSDictionary dictionaryWithObject:[qlTypesItems retain] forKey:@"QuickLookTypes"]; + [qlTypesItems release]; } return self; @@ -510,11 +538,8 @@ - (IBAction)quickLookFormatButton:(id)sender { - - id types = [prefs objectForKey:@"QuickLookTypes"]; - - if(types != nil && [types isKindOfClass:[NSArray class]] && [types count] > [sender tag] - 2) { - NSDictionary *type = [types objectAtIndex:[sender tag] - 2]; + if(qlTypes != nil && [[qlTypes objectForKey:@"QuickLookTypes"] count] > [sender tag] - 2) { + NSDictionary *type = [[qlTypes objectForKey:@"QuickLookTypes"] objectAtIndex:[sender tag] - 2]; [self invokeQuickLookOfType:[type objectForKey:@"Extension"] treatAsText:([[type objectForKey:@"treatAsText"] intValue])]; } } diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index 54069256..9b886ce9 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -119,7 +119,6 @@ 296DC8BB0F909194002A3258 /* NSDictionary_DeepMutableCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8B10F909194002A3258 /* NSDictionary_DeepMutableCopy.m */; }; 296DC8BC0F909194002A3258 /* MGTemplateStandardFilters.m in Sources */ = {isa = PBXBuildFile; fileRef = 296DC8B40F909194002A3258 /* MGTemplateStandardFilters.m */; }; 296DC8BF0F9091DF002A3258 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 296DC8BE0F9091DF002A3258 /* libicucore.dylib */; }; - 296DC8D20F90950C002A3258 /* sequel-pro-print-template.html in Resources */ = {isa = PBXBuildFile; fileRef = 296DC8D10F90950C002A3258 /* sequel-pro-print-template.html */; }; 29A1B7E50FD1293A000B88E8 /* SPPrintAccessory.m in Sources */ = {isa = PBXBuildFile; fileRef = 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */; }; 380F4EF50FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4EF40FC0B68F00B0BFD7 /* stringCategoryAdditionsTest.m */; }; 380F4F250FC0C3D300B0BFD7 /* mcpKitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 380F4F240FC0C3D300B0BFD7 /* mcpKitTest.m */; }; @@ -232,6 +231,9 @@ BC9F0881100FCF2C00A80D32 /* SPFieldEditorController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9F0880100FCF2C00A80D32 /* SPFieldEditorController.m */; }; BCA6271C1031B9D40047E5D5 /* SPTooltip.m in Sources */ = {isa = PBXBuildFile; fileRef = BCA6271B1031B9D40047E5D5 /* SPTooltip.m */; }; BCA6F631100FA7D700E80253 /* FieldEditorSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCA6F62F100FA7D700E80253 /* FieldEditorSheet.xib */; }; + BCB56193106F88EC00167321 /* sequel-pro-print-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BCB56192106F88EC00167321 /* sequel-pro-print-template.html */; }; + BCB56197106F893F00167321 /* ContentFilters.plist in Resources */ = {isa = PBXBuildFile; fileRef = BCB56196106F893F00167321 /* ContentFilters.plist */; }; + BCB5619B106F8A1B00167321 /* EditorQuickLookTypes.plist in Resources */ = {isa = PBXBuildFile; fileRef = BCB5619A106F8A1B00167321 /* EditorQuickLookTypes.plist */; }; BCC5CC3C103EEE49007CE557 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 17B7B593101602D200F057DE /* libz.dylib */; }; BCCBD7FC104408B000D4C50A /* SaveSPFAccessory.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */; }; BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; }; @@ -485,7 +487,6 @@ 296DC8B40F909194002A3258 /* MGTemplateStandardFilters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGTemplateStandardFilters.m; sourceTree = "<group>"; }; 296DC8B50F909194002A3258 /* MGTemplateStandardFilters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGTemplateStandardFilters.h; sourceTree = "<group>"; }; 296DC8BE0F9091DF002A3258 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; - 296DC8D10F90950C002A3258 /* sequel-pro-print-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-print-template.html"; sourceTree = "<group>"; }; 29A1B7E30FD1293A000B88E8 /* SPPrintAccessory.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = SPPrintAccessory.h; sourceTree = "<group>"; }; 29A1B7E40FD1293A000B88E8 /* SPPrintAccessory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPPrintAccessory.m; sourceTree = "<group>"; wrapsLines = 1; }; 29A1B7EA0FD12E55000B88E8 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/PrintAccessory.xib; sourceTree = "<group>"; }; @@ -624,6 +625,9 @@ BCA6271A1031B9D40047E5D5 /* SPTooltip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTooltip.h; sourceTree = "<group>"; }; BCA6271B1031B9D40047E5D5 /* SPTooltip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTooltip.m; sourceTree = "<group>"; }; BCA6F630100FA7D700E80253 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/FieldEditorSheet.xib; sourceTree = "<group>"; }; + BCB56190106F88E300167321 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = English; path = "English.lproj/sequel-pro-print-template.html"; sourceTree = "<group>"; }; + BCB56194106F893700167321 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/ContentFilters.plist; sourceTree = "<group>"; }; + BCB56198106F8A1600167321 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = English; path = English.lproj/EditorQuickLookTypes.plist; sourceTree = "<group>"; }; BCCBD7FB104408B000D4C50A /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SaveSPFAccessory.xib; sourceTree = "<group>"; }; BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPSQLTokenizer.l; sourceTree = "<group>"; }; BCD0AD4A0FBBFC480066EA5C /* SPSQLTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSQLTokenizer.h; sourceTree = "<group>"; }; @@ -751,7 +755,7 @@ 1740F8350FC3069700CF3699 /* Templates */ = { isa = PBXGroup; children = ( - 296DC8D10F90950C002A3258 /* sequel-pro-print-template.html */, + BCB56192106F88EC00167321 /* sequel-pro-print-template.html */, BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */, ); name = Templates; @@ -774,6 +778,8 @@ 17DA04EA0FC1A7DA00D66140 /* Unit Tests-Info.plist */, B58731270F838C9E00087794 /* PreferenceDefaults.plist */, 17B7B58B1016022C00F057DE /* MCPKit-Info.plist */, + BCB56196106F893F00167321 /* ContentFilters.plist */, + BCB5619A106F8A1B00167321 /* EditorQuickLookTypes.plist */, ); name = Plists; sourceTree = "<group>"; @@ -1520,7 +1526,6 @@ B58730EB0F8381A600087794 /* toolbar-preferences-autoupdate.tiff in Resources */, B58731280F838C9E00087794 /* PreferenceDefaults.plist in Resources */, B52460DB0F8EF93B00171639 /* Console.xib in Resources */, - 296DC8D20F90950C002A3258 /* sequel-pro-print-template.html in Resources */, B508B5DA0F9837A200E03A69 /* button_edit.tiff in Resources */, B53857340F9CC3B600EB2354 /* button_clear.tiff in Resources */, BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */, @@ -1555,6 +1560,9 @@ BC8B0DAF104004F900FC02EC /* EncodingPopupView.xib in Resources */, BCCBD7FC104408B000D4C50A /* SaveSPFAccessory.xib in Resources */, 173C4362104455CA001F3A30 /* QueryFavoriteManager.xib in Resources */, + BCB56193106F88EC00167321 /* sequel-pro-print-template.html in Resources */, + BCB56197106F893F00167321 /* ContentFilters.plist in Resources */, + BCB5619B106F8A1B00167321 /* EditorQuickLookTypes.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1864,6 +1872,30 @@ name = FieldEditorSheet.xib; sourceTree = "<group>"; }; + BCB56192106F88EC00167321 /* sequel-pro-print-template.html */ = { + isa = PBXVariantGroup; + children = ( + BCB56190106F88E300167321 /* English */, + ); + name = "sequel-pro-print-template.html"; + sourceTree = "<group>"; + }; + BCB56196106F893F00167321 /* ContentFilters.plist */ = { + isa = PBXVariantGroup; + children = ( + BCB56194106F893700167321 /* English */, + ); + name = ContentFilters.plist; + sourceTree = "<group>"; + }; + BCB5619A106F8A1B00167321 /* EditorQuickLookTypes.plist */ = { + isa = PBXVariantGroup; + children = ( + BCB56198106F8A1600167321 /* English */, + ); + name = EditorQuickLookTypes.plist; + sourceTree = "<group>"; + }; BCCBD7FA104408B000D4C50A /* SaveSPFAccessory.xib */ = { isa = PBXVariantGroup; children = ( |