diff options
author | stuconnolly <stuart02@gmail.com> | 2011-04-22 17:44:57 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-04-22 17:44:57 +0000 |
commit | 4611475c5b255eed9202474dd3bdee147e932946 (patch) | |
tree | 39bdc50e046f802265950c6e2607ca9ebda453be /Source/SPQueryFavoriteManager.m | |
parent | 3ed8b33deeadcc98185911f41bc6bcb4e53b4719 (diff) | |
download | sequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.gz sequelpro-4611475c5b255eed9202474dd3bdee147e932946.tar.bz2 sequelpro-4611475c5b255eed9202474dd3bdee147e932946.zip |
Bring outline view branch up to date with trunk (r3234:3277).
Diffstat (limited to 'Source/SPQueryFavoriteManager.m')
-rw-r--r-- | Source/SPQueryFavoriteManager.m | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 9316c5ec..7fe5797f 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -30,7 +30,9 @@ #import "SPConnectionController.h" #import "RegexKitLite.h" #import "SPTextView.h" +#ifndef SP_REFACTOR #import <BWToolkitFramework/BWAnchoredButtonBar.h> +#endif #define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]") #define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]") @@ -50,7 +52,9 @@ { if ((self = [super initWithWindowNibName:@"QueryFavoriteManager"])) { +#ifndef SP_REFACTOR prefs = [NSUserDefaults standardUserDefaults]; +#endif favorites = [[NSMutableArray alloc] init]; @@ -95,12 +99,14 @@ @"", @"query", nil]]; +#ifndef SP_REFACTOR // Build data source for global queryFavorites (as mutable copy! otherwise each // change will be stored in the prefs at once) if([prefs objectForKey:SPQueryFavorites]) { for(id fav in [prefs objectForKey:SPQueryFavorites]) [favorites addObject:[[fav mutableCopy] autorelease]]; } +#endif [favorites addObject:[NSDictionary dictionaryWithObjectsAndKeys: [[[delegatesFileURL absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] lastPathComponent], @"name", @@ -131,8 +137,10 @@ // Set Remove button state [removeButton setEnabled:([favoritesTableView numberOfSelectedRows] > 0)]; +#ifndef SP_REFACTOR /* split view delegate */ // Set the button bar delegate [splitViewButtonBar setSplitViewDelegate:self]; +#endif } #pragma mark - @@ -297,7 +305,9 @@ [panel setCanSelectHiddenExtension:YES]; [panel setCanCreateDirectories:YES]; +#ifndef SP_REFACTOR [panel setAccessoryView:[SPEncodingPopupAccessory encodingAccessory:[prefs integerForKey:SPLastSQLFileEncoding] includeDefaultEntry:NO encodingPopUp:&encodingPopUp]]; +#endif [encodingPopUp setEnabled:YES]; @@ -379,8 +389,10 @@ [[SPQueryController sharedQueryController] replaceFavoritesByArray: [self queryFavoritesForFileURL:delegatesFileURL] forFileURL:delegatesFileURL]; +#ifndef SP_REFACTOR // Update global preferences' list [prefs setObject:[self queryFavoritesForFileURL:nil] forKey:SPQueryFavorites]; +#endif // Inform all opened documents to update the query favorites list for(id doc in [[NSApp delegate] orderedDocuments]) @@ -756,7 +768,7 @@ mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")] + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithString:NSLocalizedString(@"Error while reading data file", @"error while reading data file")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil @@ -784,7 +796,7 @@ [favoritesTableView reloadData]; [spf release]; } else { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")] + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithString:NSLocalizedString(@"Error while reading data file", @"error while reading data file")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil @@ -810,8 +822,10 @@ if (returnCode == NSOKButton) { NSError *error = nil; +#ifndef SP_REFACTOR [prefs setInteger:[[encodingPopUp selectedItem] tag] forKey:SPLastSQLFileEncoding]; [prefs synchronize]; +#endif [[favoriteQueryTextView string] writeToFile:[panel filename] atomically:YES encoding:[[encodingPopUp selectedItem] tag] error:&error]; @@ -846,7 +860,7 @@ errorDescription:&err]; if(err != nil) { - NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while converting query favorite data", @"error while converting query favorite data")] + NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithString:NSLocalizedString(@"Error while converting query favorite data", @"error while converting query favorite data")] defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil |