aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.h4
-rw-r--r--Source/SPAppController.m32
-rw-r--r--Source/SPContentFilterManager.m2
-rw-r--r--Source/SPDatabaseDocument.h3
-rw-r--r--Source/SPDatabaseDocument.m84
-rw-r--r--Source/SPEditSheetTextView.m3
-rw-r--r--Source/SPExportController.m2
-rw-r--r--Source/SPExportInitializer.m2
-rw-r--r--Source/SPQueryFavoriteManager.m4
-rw-r--r--Source/SPTextView.m2
-rw-r--r--Source/SPWindowController.m6
-rw-r--r--Source/TableDump.m10
12 files changed, 115 insertions, 39 deletions
diff --git a/Source/SPAppController.h b/Source/SPAppController.h
index 9d9a5564..999f5202 100644
--- a/Source/SPAppController.h
+++ b/Source/SPAppController.h
@@ -38,6 +38,8 @@
id encodingPopUp;
NSURL *_sessionURL;
+ NSMutableDictionary *_spfSessionDocData;
+
}
// Window management
@@ -67,8 +69,10 @@
- (NSArray *)orderedDatabaseConnectionWindows;
- (SPDatabaseDocument *)frontDocument;
- (NSURL *)sessionURL;
+- (NSDictionary *)spfSessionDocData;
- (void)setSessionURL:(NSString *)urlString;
+- (void)setSpfSessionDocData:(NSDictionary *)data;
// Feedback controller delegate methods
- (NSMutableDictionary*) anonymizePreferencesForFeedbackReport:(NSMutableDictionary *)preferences;
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 45deeff9..405cdc01 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -44,6 +44,8 @@
{
if ((self = [super init])) {
_sessionURL = nil;
+ _spfSessionDocData = [[NSMutableDictionary alloc] init];
+
[NSApp setDelegate:self];
}
@@ -117,7 +119,7 @@
- (void)panelSelectionDidChange:(id)sender
{
if ([sender isKindOfClass:[NSOpenPanel class]]) {
- if([[[[sender filename] pathExtension] lowercaseString] isEqualToString:@"sql"]) {
+ if([[[[sender filename] pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]) {
[encodingPopUp setEnabled:YES];
} else {
[encodingPopUp setEnabled:NO];
@@ -159,14 +161,14 @@
if ([self frontDocumentWindow]) {
[panel beginSheetForDirectory:nil
file:@""
- types:[NSArray arrayWithObjects:@"spf", @"sql", nil]
+ types:[NSArray arrayWithObjects:SPFileExtensionDefault, SPFileExtensionSQL, nil]
modalForWindow:[self frontDocumentWindow]
modalDelegate:self
didEndSelector:@selector(openConnectionPanelDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
else {
- NSInteger returnCode = [panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"spf", @"sql", nil]];
+ NSInteger returnCode = [panel runModalForDirectory:nil file:nil types:[NSArray arrayWithObjects:SPFileExtensionDefault, SPFileExtensionSQL, nil]];
if (returnCode) [self application:nil openFiles:[panel filenames]];
@@ -196,7 +198,7 @@
for (NSString *filename in filenames)
{
// Opens a sql file and insert its content into the Custom Query editor
- if([[[filename pathExtension] lowercaseString] isEqualToString:@"sql"]) {
+ if([[[filename pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]) {
// Check size and NSFileType
NSDictionary *attr = [[NSFileManager defaultManager] fileAttributesAtPath:filename traverseLink:YES];
@@ -274,7 +276,7 @@
break; // open only the first SQL file
}
- else if([[[filename pathExtension] lowercaseString] isEqualToString:@"spf"]) {
+ else if([[[filename pathExtension] lowercaseString] isEqualToString:SPFileExtensionDefault]) {
SPWindowController *frontController = nil;
@@ -453,7 +455,20 @@
- (void)setSessionURL:(NSString *)urlString
{
if(_sessionURL) [_sessionURL release], _sessionURL = nil;
- _sessionURL = [[NSURL fileURLWithPath:urlString] retain];
+ if(urlString)
+ _sessionURL = [[NSURL fileURLWithPath:urlString] retain];
+}
+
+- (NSDictionary *)spfSessionDocData
+{
+ return _spfSessionDocData;
+}
+
+- (void)setSpfSessionDocData:(NSDictionary *)data
+{
+ [_spfSessionDocData removeAllObjects];
+ if(data)
+ [_spfSessionDocData addEntriesFromDictionary:data];
}
#pragma mark -
@@ -636,7 +651,7 @@
// UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
if( [result hasPrefix:@"text/plain"]
- || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"]
+ || [[[aPath pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]
|| [[[aPath pathExtension] lowercaseString] isEqualToString:@"txt"]
|| [result hasPrefix:@"audio/mpeg"]
|| [result hasPrefix:@"application/octet-stream"]
@@ -783,10 +798,11 @@
#pragma mark -
/**
- * Deallocate prefs controller
+ * Deallocate
*/
- (void)dealloc
{
+ if(_spfSessionDocData) [_spfSessionDocData release], _spfSessionDocData = nil;
[prefsController release], prefsController = nil;
[aboutController release], aboutController = nil;
if(_sessionURL) [_sessionURL release], _sessionURL = nil;
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index 1edb8416..f8bbbe27 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -767,7 +767,7 @@
NSDictionary *spf = nil;
- if([[[filename pathExtension] lowercaseString] isEqualToString:@"spf"]) {
+ if([[[filename pathExtension] lowercaseString] isEqualToString:SPFileExtensionDefault]) {
NSData *pData = [NSData dataWithContentsOfFile:filename options:NSUncachedRead error:&readError];
spf = [[NSPropertyListSerialization propertyListFromData:pData
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 8e93a884..e16a6b5c 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -146,6 +146,7 @@
BOOL _mainNibLoaded;
BOOL databaseListIsSelectable;
NSInteger _queryMode;
+ BOOL _isSavedInBundle;
NSWindow *taskProgressWindow;
BOOL taskDisplayIsIndeterminate;
@@ -275,6 +276,7 @@
- (IBAction)backForwardInHistory:(id)sender;
- (IBAction)showUserManager:(id)sender;
- (IBAction)copyChecksumFromSheet:(id)sender;
+- (void)setIsSavedInBundle:(BOOL)savedInBundle;
- (void)showConsole:(id)sender;
- (IBAction)showNavigator:(id)sender;
@@ -292,6 +294,7 @@
- (NSString *)keyChainID;
- (NSString *)connectionID;
- (NSString *)tabTitleForTooltip;
+- (BOOL)isSaveInBundle;
// Notification center methods
- (void)willPerformQuery:(NSNotification *)notification;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 8857924b..85cc2bfb 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -86,6 +86,7 @@
_encoding = [[NSString alloc] initWithString:@"utf8"];
_isConnected = NO;
_isWorkingLevel = 0;
+ _isSavedInBundle = NO;
databaseListIsSelectable = YES;
_queryMode = SPInterfaceQueryMode;
chooseDatabaseButton = nil;
@@ -2278,7 +2279,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:@"sql"];
+ [panel setRequiredFileType:SPFileExtensionSQL];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
@@ -2486,7 +2487,7 @@
*/
- (BOOL)isUntitled
{
- return ([self fileURL] && [[self fileURL] isFileURL]) ? NO : YES;
+ return (!_isSavedInBundle && [self fileURL] && [[self fileURL] isFileURL]) ? NO : YES;
}
/**
@@ -2670,6 +2671,11 @@
return keyChainID;
}
+- (BOOL)isSaveInBundle
+{
+ return _isSavedInBundle;
+}
+
#pragma mark -
#pragma mark Notification center methods
@@ -2734,7 +2740,7 @@
[panel setAccessoryView:[SPEncodingPopupAccessory encodingAccessory:[prefs integerForKey:SPLastSQLFileEncoding]
includeDefaultEntry:NO encodingPopUp:&encodingPopUp]];
// [panel setMessage:NSLocalizedString(@"Save SQL file", @"Save SQL file")];
- [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"sql", nil]];
+ [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPFileExtensionSQL, nil]];
if(![prefs stringForKey:@"lastSqlFileName"]) {
[prefs setObject:@"" forKey:@"lastSqlFileName"];
[prefs synchronize];
@@ -2769,7 +2775,7 @@
}
// Save current session (open connection windows as SPF file)
- [panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]];
+ [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPFileExtensionDefault, nil]];
//Restore accessory view settings if possible
if([spfDocData objectForKey:@"save_password"])
@@ -2807,6 +2813,13 @@
// Save Session or Save Session As…
else if (sender == nil || [sender tag] == 1020 || [sender tag] == 1021)
{
+
+ // Save As Session
+ if([sender tag] == 1020 && [[NSApp delegate] sessionURL]) {
+ [self saveConnectionPanelDidEnd:panel returnCode:1 contextInfo:@"saveAsSession"];
+ return;
+ }
+
// Load accessory nib each time.
// Note that the top-level objects aren't released automatically, but are released when the panel ends.
if(![NSBundle loadNibNamed:@"SaveSPFAccessory" owner:self]) {
@@ -2910,12 +2923,17 @@
}
// Save all open windows including all tabs as session
- else if(contextInfo == @"saveSession") {
+ else if(contextInfo == @"saveSession" || contextInfo == @"saveAsSession") {
// Sub-folder 'Contents' will contain all untitled connection as single window or tab.
// info.plist will contain the opened structure (windows and tabs for each window). Each connection
// is linked to a saved spf file either in 'Contents' for unTitled ones or already saved spf files.
+ if(contextInfo == @"saveAsSession" && [[NSApp delegate] sessionURL])
+ fileName = [[[NSApp delegate] sessionURL] path];
+
+ if(!fileName || ![fileName length]) return;
+
NSFileManager *fileManager = [NSFileManager defaultManager];
// If bundle exists remove it
@@ -2949,32 +2967,45 @@
// retrieve save panel data for passing them to each doc
NSMutableDictionary *spfDocData_temp = [NSMutableDictionary dictionary];
- [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionEncrypt state]==NSOnState) ? YES : NO ] forKey:@"encrypted"];
- if([[spfDocData_temp objectForKey:@"encrypted"] boolValue])
- [spfDocData_temp setObject:[saveConnectionEncryptString stringValue] forKey:@"e_string"];
- [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionAutoConnect state]==NSOnState) ? YES : NO ] forKey:@"auto_connect"];
- [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionSavePassword state]==NSOnState) ? YES : NO ] forKey:@"save_password"];
- [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeData state]==NSOnState) ? YES : NO ] forKey:@"include_session"];
- [spfDocData_temp setObject:[NSNumber numberWithBool:NO] forKey:@"save_editor_content"];
- if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length])
- [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeQuery state]==NSOnState) ? YES : NO ] forKey:@"save_editor_content"];
+ if(contextInfo == @"saveAsSession") {
+ [spfDocData_temp addEntriesFromDictionary:[[NSApp delegate] spfSessionDocData]];
+ } else {
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionEncrypt state]==NSOnState) ? YES : NO ] forKey:@"encrypted"];
+ if([[spfDocData_temp objectForKey:@"encrypted"] boolValue])
+ [spfDocData_temp setObject:[saveConnectionEncryptString stringValue] forKey:@"e_string"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionAutoConnect state]==NSOnState) ? YES : NO ] forKey:@"auto_connect"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionSavePassword state]==NSOnState) ? YES : NO ] forKey:@"save_password"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeData state]==NSOnState) ? YES : NO ] forKey:@"include_session"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:NO] forKey:@"save_editor_content"];
+ if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length])
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeQuery state]==NSOnState) ? YES : NO ] forKey:@"save_editor_content"];
+
+ // Save the session's accessory view settings
+ [[NSApp delegate] setSpfSessionDocData:spfDocData_temp];
+
+ }
// Loop through all windows
for(NSWindow *window in [[NSApp delegate] orderedDatabaseConnectionWindows]) {
+ // First window is always the currently key window
+
NSMutableArray *tabs = [NSMutableArray array];
NSMutableDictionary *win = [NSMutableDictionary dictionary];
// Loop through all tabs of a given window
+ NSInteger tabCount = 0;
+ NSInteger selectedTabItem = 0;
for(SPDatabaseDocument *doc in [[window windowController] documents]) {
NSMutableDictionary *tabData = [NSMutableDictionary dictionary];
if([doc isUntitled]) {
// new bundle file name for untitled docs
- NSString *newName = [NSString stringWithFormat:@"%@.spf", [NSString stringWithNewUUID]];
+ NSString *newName = [NSString stringWithFormat:@"%@.%@", [NSString stringWithNewUUID], SPFileExtensionDefault];
// internal bundle path to store the doc
NSString *filePath = [NSString stringWithFormat:@"%@/Contents/%@", fileName, newName];
// save it as temporary spf file inside the bundle with save panel options spfDocData_temp
[doc saveDocumentWithFilePath:filePath inBackground:NO onlyPreferences:NO contextInfo:[NSDictionary dictionaryWithDictionary:spfDocData_temp]];
+ [doc setIsSavedInBundle:YES];
[tabData setObject:[NSNumber numberWithBool:NO] forKey:@"isAbsolutePath"];
[tabData setObject:newName forKey:@"path"];
} else {
@@ -2984,8 +3015,12 @@
[tabData setObject:[[doc fileURL] path] forKey:@"path"];
}
[tabs addObject:tabData];
+ if([[window windowController] selectedTableDocument] == doc)
+ selectedTabItem = tabCount;
+ tabCount++;
}
[win setObject:tabs forKey:@"tabs"];
+ [win setObject:[NSNumber numberWithInteger:selectedTabItem] forKey:@"selectedTabIndex"];
[windows addObject:win];
}
[info setObject:windows forKey:@"windows"];
@@ -3017,6 +3052,10 @@
[[NSApp delegate] setSessionURL:fileName];
+ // Register spfs bundle in Recent Files
+ [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:fileName]];
+
+
}
}
}
@@ -3075,14 +3114,16 @@
if(!spf || ![spf count] || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
defaultButton:NSLocalizedString(@"OK", @"OK button")
- alternateButton:nil
+ alternateButton:NSLocalizedString(@"Ignore", @"ignore button")
otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Connection data file couldn't be read. Please try to save the document under a different name.", @"message error while reading connection data file and suggesting to save it under a differnet name")];
+ informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"Connection data file “%@” couldn't be read. Please try to save the document under a different name.", @"message error while reading connection data file and suggesting to save it under a differnet name"), [fileName lastPathComponent]]];
[alert setAlertStyle:NSCriticalAlertStyle];
- [alert runModal];
+ NSInteger returnCode = [alert runModal];
if (spf) [spf release];
- // [self close];
+ if(returnCode == NSAlertAlternateReturn)
+ return YES;
+
return NO;
}
@@ -4473,6 +4514,11 @@
}
}
+- (void)setIsSavedInBundle:(BOOL)savedInBundle
+{
+ _isSavedInBundle = savedInBundle;
+}
+
#pragma mark -
/**
diff --git a/Source/SPEditSheetTextView.m b/Source/SPEditSheetTextView.m
index 3e22614d..9e0c597f 100644
--- a/Source/SPEditSheetTextView.m
+++ b/Source/SPEditSheetTextView.m
@@ -25,6 +25,7 @@
#import "SPEditSheetTextView.h"
#import "SPTextViewAdditions.h"
#import "SPFieldEditorController.h"
+#import "SPConstants.h"
@implementation SPEditSheetTextView
@@ -259,7 +260,7 @@
// UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
if( [result hasPrefix:@"text/plain"]
- || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"]
+ || [[[aPath pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]
|| [[[aPath pathExtension] lowercaseString] isEqualToString:@"txt"]
|| [result hasPrefix:@"audio/mpeg"]
|| [result hasPrefix:@"application/octet-stream"]
diff --git a/Source/SPExportController.m b/Source/SPExportController.m
index 03b4a669..6dd289cd 100644
--- a/Source/SPExportController.m
+++ b/Source/SPExportController.m
@@ -707,7 +707,7 @@
switch (exportType) {
case SPSQLExport:
- extension = ([exportCompressOutputFile state]) ? @"sql.gz" : @"sql";
+ extension = ([exportCompressOutputFile state]) ? [NSString stringWithFormat:@"%@.gz", SPFileExtensionSQL] : SPFileExtensionSQL;
break;
case SPXMLExport:
extension = @"xml";
diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m
index e41d4a44..d30d3a9f 100644
--- a/Source/SPExportInitializer.m
+++ b/Source/SPExportInitializer.m
@@ -294,7 +294,7 @@
// Create custom filename if required
[exportFilename setString:(createCustomFilename) ? [self expandCustomFilenameFormatFromString:[exportCustomFilenameTokenField stringValue] usingTableName:nil] : [NSString stringWithFormat:@"%@_%@", [tableDocumentInstance database], [[NSDate date] descriptionWithCalendarFormat:@"%Y-%m-%d" timeZone:nil locale:nil]]];
- [exportFilename setString:[exportFilename stringByAppendingPathExtension:([exportCompressOutputFile state]) ? @"sql.gz" : @"sql"]];
+ [exportFilename setString:[exportFilename stringByAppendingPathExtension:([exportCompressOutputFile state]) ? [NSString stringWithFormat:@"%@.gz", SPFileExtensionSQL] : SPFileExtensionSQL]];
SPFileHandle *fileHandle = [self getFileHandleForFilePath:[[exportPathField stringValue] stringByAppendingPathComponent:exportFilename]];
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m
index 3840bd1e..875be7ca 100644
--- a/Source/SPQueryFavoriteManager.m
+++ b/Source/SPQueryFavoriteManager.m
@@ -329,7 +329,7 @@
[panel beginSheetForDirectory:nil
file:@""
- types:[NSArray arrayWithObjects:@"spf", @"sql", nil]
+ types:[NSArray arrayWithObjects:SPFileExtensionDefault, SPFileExtensionSQL, nil]
modalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(importPanelDidEnd:returnCode:contextInfo:)
@@ -748,7 +748,7 @@
NSDictionary *spf = nil;
- if([[[filename pathExtension] lowercaseString] isEqualToString:@"spf"]) {
+ if([[[filename pathExtension] lowercaseString] isEqualToString:SPFileExtensionDefault]) {
NSData *pData = [NSData dataWithContentsOfFile:filename options:NSUncachedRead error:&readError];
spf = [[NSPropertyListSerialization propertyListFromData:pData
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index c2ede0bf..df66149f 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -3219,7 +3219,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// UTF16/32 files are detected as application/octet-stream resp. audio/mpeg
if( [result hasPrefix:@"text/plain"]
- || [[[aPath pathExtension] lowercaseString] isEqualToString:@"sql"]
+ || [[[aPath pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]
|| [[[aPath pathExtension] lowercaseString] isEqualToString:@"txt"]
|| [result hasPrefix:@"audio/mpeg"]
|| [result hasPrefix:@"application/octet-stream"]
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index da23113b..89879b0f 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -541,6 +541,12 @@
if (![eachDocument parentTabShouldClose]) return NO;
}
+ // Remove global session data if the last window of a session will be closed
+ if([[NSApp delegate] sessionURL] && [[[NSApp delegate] orderedDatabaseConnectionWindows] count] == 1) {
+ [[NSApp delegate] setSessionURL:nil];
+ [[NSApp delegate] setSpfSessionDocData:nil];
+ }
+
return YES;
}
diff --git a/Source/TableDump.m b/Source/TableDump.m
index 4ea1255e..45c5c711 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -170,9 +170,9 @@
[self reloadTables:self];
[sqlCompressionSwitch setState:[prefs boolForKey:SPSQLExportUseCompression]?NSOnState:NSOffState];
if ([prefs boolForKey:SPSQLExportUseCompression]) {
- [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:@"sql.gz", @"gz", nil]];
+ [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:[NSString stringWithFormat:@"%@.gz", SPFileExtensionSQL], @"gz", nil]];
} else {
- [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:@"sql", nil]];
+ [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:SPFileExtensionSQL, nil]];
}
file = [NSString stringWithFormat:@"%@_%@.%@", [tableDocumentInstance database], currentDate, [currentExportPanel requiredFileType]];
[currentExportPanel setAccessoryView:exportDumpView];
@@ -3151,12 +3151,12 @@
{
if (exportMode == SPExportingSQL) {
if ([sender state] == NSOnState) {
- [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:@"sql.gz", @"gz", nil]];
+ [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:[NSString stringWithFormat:@"%@.gz", SPFileExtensionSQL], @"gz", nil]];
// if file name text view is the first responder re-select the path name only without '.sql.gz'
if([[currentExportPanel firstResponder] isKindOfClass:[NSTextView class]]) {
NSTextView *filenameTextView = (NSTextView *)[currentExportPanel firstResponder];
- if([filenameTextView selectedRange].length > 4 && [[filenameTextView string] hasSuffix:@".sql.gz"]) {
+ if([filenameTextView selectedRange].length > 4 && [[filenameTextView string] hasSuffix:[NSString stringWithFormat:@".%@.gz", SPFileExtensionSQL]]) {
NSRange selRange = [filenameTextView selectedRange];
selRange.length -= 4;
[filenameTextView setSelectedRange:selRange];
@@ -3164,7 +3164,7 @@
}
} else {
- [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObject:@"sql"]];
+ [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]];
}
[prefs setBool:([sender state] == NSOnState) forKey:SPSQLExportUseCompression];
}