diff options
author | sqlprodev <sqlprodev@northofthree.com> | 2011-04-14 19:57:45 +0000 |
---|---|---|
committer | sqlprodev <sqlprodev@northofthree.com> | 2011-04-14 19:57:45 +0000 |
commit | 8c2e3126426c0c4c9e5bc2392879a850d3373641 (patch) | |
tree | 8a6963b5efd578e8586bd808d5f204a81a85c6dc /Source/SPCustomQuery.m | |
parent | ad7328e56541556d23f527303deddaefd4253ef2 (diff) | |
download | sequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.tar.gz sequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.tar.bz2 sequelpro-8c2e3126426c0c4c9e5bc2392879a850d3373641.zip |
SP_REFACTOR: Workaround for naming conflict with postNotificationOnMainThread: which also exists in TCMPortMapper.framework; NSUserDefaults access now permitted in SP_REFACTOR blocks for a few prefs keys
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r-- | Source/SPCustomQuery.m | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 91570d14..8c2b4f43 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -584,7 +584,11 @@ #endif // Notify listeners that a query has started +#ifndef SP_REFACTOR [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance]; +#else + [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance]; +#endif #ifndef SP_REFACTOR /* growl */ // Start the notification timer to allow notifications to be shown even if frontmost for long queries @@ -851,7 +855,11 @@ [customQueryView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES]; // Notify any listeners that the query has completed +#ifndef SP_REFACTOR [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; +#else + [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; +#endif #ifndef SP_REFACTOR /* growl */ // Perform the Growl notification for query completion @@ -884,7 +892,11 @@ } //query finished +#ifndef SP_REFACTOR [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; +#else + [[NSNotificationCenter defaultCenter] sequelProPostNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance]; +#endif #ifndef SP_REFACTOR /* growl */ // Query finished Growl notification @@ -1156,7 +1168,7 @@ } /* - * Add or remove "⁄* *⁄" for each line in the current query + * Add or remove "‚ÅÑ* *‚ÅÑ" for each line in the current query * a given selection */ - (void)commentOutCurrentQueryTakingSelection:(BOOL)takeSelection @@ -1209,8 +1221,8 @@ /* * Add or remove "-- " for each line in the current query or selection, - * if the selection is in-line wrap selection into ⁄* block comments and - * place the caret after ⁄* to allow to enter !xxxxxx e.g. + * if the selection is in-line wrap selection into ‚ÅÑ* block comments and + * place the caret after ‚ÅÑ* to allow to enter !xxxxxx e.g. */ - (void)commentOut { @@ -1582,7 +1594,7 @@ [[dataCell formatter] setFieldType:[columnDefinition objectForKey:@"type"]]; [theCol setDataCell:dataCell]; [[theCol headerCell] setStringValue:[columnDefinition objectForKey:@"name"]]; - [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@", [columnDefinition objectForKey:@"name"], [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"char_length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"char_length"]] : @""]]; + [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ ‚Äì %@%@", [columnDefinition objectForKey:@"name"], [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"char_length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"char_length"]] : @""]]; #ifndef SP_REFACTOR // Set the width of this column to saved value if exists and maps to a real column @@ -1951,11 +1963,7 @@ return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]]; if ([theValue isNSNull]) -#ifndef SP_REFACTOR return [prefs objectForKey:SPNullValue]; -#else - return @"NULL"; -#endif if ([theValue isKindOfClass:[MCPGeometryData class]]) return [theValue wktString]; @@ -2010,13 +2018,7 @@ } else { if ( [[anObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) { newObject = @"CURRENT_TIMESTAMP"; - } else if([anObject isEqualToString: -#ifndef SP_REFACTOR - [prefs stringForKey:SPNullValue] -#else - @"NULL" -#endif - ]) { + } else if([anObject isEqualToString:[prefs stringForKey:SPNullValue]]) { newObject = @"NULL"; } else if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"geometry"]) { newObject = [(NSString*)anObject getGeomFromTextString]; @@ -2043,7 +2045,7 @@ return; } - // This shouldn't happen – for safety reasons + // This shouldn't happen ‚Äì for safety reasons if ( ![mySQLConnection affectedRows] ) { #ifndef SP_REFACTOR if ( [prefs boolForKey:SPShowNoAffectedRowsError] ) { @@ -2441,11 +2443,7 @@ id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]]; if ([originalData isNSNull]) -#ifndef SP_REFACTOR originalData = [NSString stringWithString:[prefs objectForKey:SPNullValue]]; -#else - originalData = [NSString stringWithString:@"NULL"]; -#endif [fieldEditor editWithObject:originalData fieldName:[columnDefinition objectForKey:@"name"] @@ -3147,7 +3145,7 @@ aRange = [desc rangeOfRegex:@"\\[HELP ([^ ]*?)\\]" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length+53, [desc length]-53-aRange.location-aRange.length) capture:1 error:&err1]; if(aRange.location != NSNotFound) { aUrl = [[desc substringWithRange:aRange] stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; - [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]]; + [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ ‚Äú%@‚Äù' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]]; } else break; @@ -3162,7 +3160,7 @@ // aRange = [desc rangeOfRegex:@"(?<!\\w)([A-Z_]{2,}( [A-Z_]{2,})?)" options:RKLNoOptions inRange:NSMakeRange(aRange.location+aRange.length, [desc length]-aRange.location-aRange.length) capture:1 error:&err1]; // if(aRange.location != NSNotFound) { // aUrl = [desc substringWithRange:aRange]; - // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ “%@”' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]]; + // [desc replaceCharactersInRange:aRange withString:[NSString stringWithFormat:@"<a title='%@ ‚Äú%@‚Äù' href='%@' class='internallink'>%@</a>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), aUrl, aUrl, aUrl]]; // } // else // break; @@ -3186,16 +3184,16 @@ if (r) [theResult dataSeek:0]; // check if HELP 'contents' is called if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING]) - [theHelp appendFormat:@"<br><i>%@ “%@”</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]; + [theHelp appendFormat:@"<br><i>%@ ‚Äú%@‚Äù</i><br>", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]; else - [theHelp appendFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]; + [theHelp appendFormat:@"<br><b>%@:</b><br>", NSLocalizedString(@"MySQL Help ‚Äì Categories", @"mysql help categories"), searchString]; // iterate through all found rows and print them as HTML ul/li list [theHelp appendString:@"<ul>"]; for ( i = 0 ; i < r ; i++ ) { NSArray *anArray = [theResult fetchRowAsArray]; NSString *topic = [anArray objectAtIndex:[anArray count]-2]; - [theHelp appendFormat:@"<li><a title='%@ “%@”' href='%@' class='internallink'>%@</a></li>", + [theHelp appendFormat:@"<li><a title='%@ ‚Äú%@‚Äù' href='%@' class='internallink'>%@</a></li>", NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]; } [theHelp appendString:@"</ul>"]; @@ -3377,7 +3375,7 @@ [[[[tableDocumentInstance fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent] action:NULL keyEquivalent:@""]; [headerMenuItem setTag:SP_FAVORITE_HEADER_MENUITEM_TAG]; - [headerMenuItem setToolTip:[NSString stringWithFormat:@"‘%@’ based favorites", + [headerMenuItem setToolTip:[NSString stringWithFormat:@"‚Äò%@‚Äô based favorites", [[[[tableDocumentInstance fileURL] absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent]]]; [headerMenuItem setIndentationLevel:0]; [menu addItem:headerMenuItem]; @@ -3389,7 +3387,7 @@ [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] - initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] + initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@‚á•", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] attributes:attributes] autorelease]; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""]; [item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]]; @@ -3414,7 +3412,7 @@ [paraStyle addTabStop:[[[NSTextTab alloc] initWithType:NSRightTabStopType location:190.0f] autorelease]]; NSDictionary *attributes = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:paraStyle, [NSFont systemFontOfSize:11], nil] forKeys:[NSArray arrayWithObjects:NSParagraphStyleAttributeName, NSFontAttributeName, nil]]; NSAttributedString *titleString = [[[NSAttributedString alloc] - initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@⇥", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] + initWithString:([favorite objectForKey:@"tabtrigger"] && [(NSString*)[favorite objectForKey:@"tabtrigger"] length]) ? [NSString stringWithFormat:@"%@\t%@‚á•", [favorite objectForKey:@"name"], [favorite objectForKey:@"tabtrigger"]] : [favorite objectForKey:@"name"] attributes:attributes] autorelease]; NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"" action:NULL keyEquivalent:@""]; [item setToolTip:[NSString stringWithString:[favorite objectForKey:@"query"]]]; @@ -3516,7 +3514,7 @@ // Result Table Font preference changed else if ([keyPath isEqualToString:SPGlobalResultTableFont]) { NSFont *tableFont = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; - [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{ǞṶḹÜ∑zgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; + [customQueryView setRowHeight:2.0f+NSSizeToCGSize([[NSString stringWithString:@"{«û·π∂·∏π√ú‚àëzgyf"] sizeWithAttributes:[NSDictionary dictionaryWithObject:tableFont forKey:NSFontAttributeName]]).height]; [customQueryView setFont:tableFont]; [customQueryView reloadData]; } @@ -3643,7 +3641,7 @@ [menuItem setToolTip:NSLocalizedString(@"Clear the global history list", @"clear the global history list tooltip message")]; #ifndef SP_REFACTOR /* if ( [tableDocumentInstance isUntitled] ) */ } else { - [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Clear History for “%@”", @"clear history for “%@” menu title"), [tableDocumentInstance displayName]]]; + [menuItem setTitle:[NSString stringWithFormat:NSLocalizedString(@"Clear History for ‚Äú%@‚Äù", @"clear history for ‚Äú%@‚Äù menu title"), [tableDocumentInstance displayName]]]; [menuItem setToolTip:NSLocalizedString(@"Clear the document-based history list", @"clear the document-based history list tooltip message")]; } #endif @@ -3728,7 +3726,7 @@ // an error occurred while reading if (helpHTMLTemplate == nil) { - NSLog(@"%@", [NSString stringWithFormat:@"Error reading “%@.html”!<br>%@", SPHTMLHelpTemplate, [error localizedFailureReason]]); + NSLog(@"%@", [NSString stringWithFormat:@"Error reading ‚Äú%@.html‚Äù!<br>%@", SPHTMLHelpTemplate, [error localizedFailureReason]]); NSBeep(); } @@ -3747,9 +3745,7 @@ queryLoadTimer = nil; -#ifndef SP_REFACTOR prefs = [NSUserDefaults standardUserDefaults]; -#endif kCellEditorErrorNoMatch = NSLocalizedString(@"Field is not editable. No matching record found.\nReload data, check encoding, or try to add\na primary key field or more fields\nin your SELECT statement for table '%@'\nto identify field origin unambiguously.", @"Custom Query result editing error - could not identify original row"); kCellEditorErrorNoMultiTabDb = NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database"); |