From ba9e5fc5c311e756c6a1e1e7294d2c719d5b4709 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 12 Apr 2010 13:48:05 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Export=20compressed=20mysql=20dump=20-=20fi?= =?UTF-8?q?rst=20fixes=20to=20support=20sql.gz=20extension=20better=20in?= =?UTF-8?q?=20the=20NSSavePanel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/TableDump.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Source/TableDump.m') diff --git a/Source/TableDump.m b/Source/TableDump.m index 8d56a1d7..d74eacea 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -169,7 +169,7 @@ [self reloadTables:self]; [sqlCompressionSwitch setState:[prefs boolForKey:SPSQLExportUseCompression]?NSOnState:NSOffState]; if ([prefs boolForKey:SPSQLExportUseCompression]) { - [currentExportPanel setRequiredFileType:@"gz"]; + [currentExportPanel setRequiredFileType:@"sql.gz"]; } else { [currentExportPanel setRequiredFileType:@"sql"]; } @@ -265,6 +265,18 @@ [currentExportPanel beginSheetForDirectory:[prefs objectForKey:@"savePath"] file:file modalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo]; + + + // Wait for the SavePanel and check for '.sql.gz' extension; if so - select only the path name without any extensions + while(![currentExportPanel isVisible]) { usleep(100); } + if([[currentExportPanel firstResponder] isKindOfClass:[NSTextView class]]) { + NSTextView *filenameTextView = (NSTextView *)[currentExportPanel firstResponder]; + if([filenameTextView selectedRange].length > 4 && [[filenameTextView string] hasSuffix:@".sql.gz"]) { + NSRange selRange = [filenameTextView selectedRange]; + selRange.length -= 4; + [filenameTextView setSelectedRange:selRange]; + } + } } /** @@ -3151,7 +3163,7 @@ { if (exportMode == SPExportingSQL) { if ([sender state] == NSOnState) { - [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObject:@"gz"]]; + [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObjects:@"sql.gz", @"gz", nil]]; } else { [currentExportPanel setAllowedFileTypes:[NSArray arrayWithObject:@"sql"]]; } -- cgit v1.2.3