aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m2
-rw-r--r--Source/SPBundleEditorController.m4
-rw-r--r--Source/SPBundleHTMLOutputController.m4
-rw-r--r--Source/SPContentFilterManager.m9
-rw-r--r--Source/SPCopyTable.h4
-rw-r--r--Source/SPCopyTable.m42
-rw-r--r--Source/SPCustomQuery.m10
-rw-r--r--Source/SPDataImport.m2
-rw-r--r--Source/SPDatabaseDocument.m6
-rw-r--r--Source/SPEditorPreferencePane.m4
-rw-r--r--Source/SPFieldEditorController.m27
-rw-r--r--Source/SPIndexesController.h3
-rw-r--r--Source/SPNavigatorController.m2
-rw-r--r--Source/SPNotLoaded.m2
-rw-r--r--Source/SPProcessListController.m2
-rw-r--r--Source/SPQueryConsoleDataSource.m2
-rw-r--r--Source/SPQueryController.m41
-rw-r--r--Source/SPQueryFavoriteManager.m8
-rw-r--r--Source/SPServerVariablesController.m6
-rw-r--r--Source/SPTableContent.h6
-rw-r--r--Source/SPTableContent.m20
-rw-r--r--Source/SPTableStructure.h26
-rw-r--r--Source/SPTableStructure.m73
-rw-r--r--Source/SPTableStructureDelegate.m4
24 files changed, 193 insertions, 116 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 332bbbef..7bdef1a2 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -171,7 +171,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
- (void)panelSelectionDidChange:(id)sender
{
if ([sender isKindOfClass:[NSOpenPanel class]]) {
- if([[[[sender filename] pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]) {
+ if([[[[[sender URL] path] pathExtension] lowercaseString] isEqualToString:SPFileExtensionSQL]) {
[encodingPopUp setEnabled:YES];
} else {
[encodingPopUp setEnabled:NO];
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index 44768479..387bfcf1 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -773,7 +773,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPUserBundleFileExtension];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPUserBundleFileExtension]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:NO];
@@ -1065,7 +1065,7 @@
NSString *bundleFileName = [aBundle objectForKey:kBundleNameKey];
NSString *possibleExisitingBundleFilePath = [NSString stringWithFormat:@"%@/%@.%@", bundlePath, bundleFileName, SPUserBundleFileExtension];
- NSString *savePath = [sheet filename];
+ NSString *savePath = [[sheet URL] path];
BOOL isDir;
BOOL copyingWasSuccessful = YES;
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m
index e49cce11..1b37be2e 100644
--- a/Source/SPBundleHTMLOutputController.m
+++ b/Source/SPBundleHTMLOutputController.m
@@ -185,7 +185,7 @@
if (returnCode == NSOKButton) {
NSString *sourceCode = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('html')[0].outerHTML"];
NSError *err = nil;
- [sourceCode writeToFile:[sheet filename]
+ [sourceCode writeToURL:[sheet URL]
atomically:YES
encoding:NSUTF8StringEncoding
error:&err];
@@ -265,7 +265,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:@"html"];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:@"html"]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index 0d4b7c18..7c6213b2 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -309,7 +309,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionDefault];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionDefault]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:NO];
@@ -773,12 +773,11 @@
SEL action = [menuItem action];
- if ( (action == @selector(duplicateContentFilter:)))
+ if (action == @selector(duplicateContentFilter:))
{
return ([contentFilterTableView numberOfSelectedRows] == 1);
}
- else if ( (action == @selector(removeContentFilter:)) ||
- ( action == @selector(exportFavorites:)))
+ else if ( (action == @selector(removeContentFilter:)) || (action == @selector(exportFavorites:)) )
{
return ([contentFilterTableView numberOfSelectedRows] > 0);
}
@@ -937,7 +936,7 @@
}
NSError *error = nil;
- [plist writeToFile:[panel filename] options:NSAtomicWrite error:&error];
+ [plist writeToURL:[panel URL] options:NSAtomicWrite error:&error];
if (error) [[NSAlert alertWithError:error] runModal];
}
diff --git a/Source/SPCopyTable.h b/Source/SPCopyTable.h
index a8a80d09..6e9187f5 100644
--- a/Source/SPCopyTable.h
+++ b/Source/SPCopyTable.h
@@ -49,11 +49,11 @@
NSUserDefaults *prefs;
NSRange fieldEditorSelectedRange;
- NSString *copyBlobFileDirectory;
+ NSString *tmpBlobFileDirectory;
}
-@property(readwrite,assign) NSString *copyBlobFileDirectory;
+@property(readwrite,assign) NSString *tmpBlobFileDirectory;
@property(readwrite,assign) NSRange fieldEditorSelectedRange;
diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m
index 36f1f6b3..e13ae61e 100644
--- a/Source/SPCopyTable.m
+++ b/Source/SPCopyTable.m
@@ -59,7 +59,7 @@ NSInteger kBlobAsImageFile = 4;
* selection in the field editor's editTextView
*/
@synthesize fieldEditorSelectedRange;
-@synthesize copyBlobFileDirectory;
+@synthesize tmpBlobFileDirectory;
/**
* Cell editing in SPCustomQuery or for views in SPTableContent
@@ -169,10 +169,10 @@ NSInteger kBlobAsImageFile = 4;
Class mcpGeometryData = [MCPGeometryData class];
NSUInteger rowCounter = 0;
- if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
+ if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
NSFileManager *fm = [NSFileManager defaultManager];
- [fm removeItemAtPath:copyBlobFileDirectory error:nil];
- [fm createDirectoryAtPath:copyBlobFileDirectory withIntermediateDirectories:YES attributes:nil error:nil];
+ [fm removeItemAtPath:tmpBlobFileDirectory error:nil];
+ [fm createDirectoryAtPath:tmpBlobFileDirectory withIntermediateDirectories:YES attributes:nil error:nil];
}
while ( rowIndex != NSNotFound )
@@ -196,13 +196,13 @@ NSInteger kBlobAsImageFile = 4;
[displayString release];
}
}
- else if(withBlobHandling == kBlobAsFile && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.dat", copyBlobFileDirectory, rowCounter, c];
+ else if(withBlobHandling == kBlobAsFile && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.dat", tmpBlobFileDirectory, rowCounter, c];
[cellData writeToFile:fp atomically:NO];
[result appendFormat:@"%@\t", fp];
}
- else if(withBlobHandling == kBlobAsImageFile && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.tif", copyBlobFileDirectory, rowCounter, c];
+ else if(withBlobHandling == kBlobAsImageFile && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.tif", tmpBlobFileDirectory, rowCounter, c];
NSImage *image = [[NSImage alloc] initWithData:cellData];
if (image) {
NSData *d = [[NSData alloc] initWithData:[image TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1]];
@@ -220,8 +220,8 @@ NSInteger kBlobAsImageFile = 4;
}
}
else if ([cellData isKindOfClass:mcpGeometryData]) {
- if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.pdf", copyBlobFileDirectory, rowCounter, c];
+ if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.pdf", tmpBlobFileDirectory, rowCounter, c];
SPGeometryDataView *v = [[SPGeometryDataView alloc] initWithCoordinates:[cellData coordinates]];
NSData *thePDF = [v pdfData];
if(thePDF) {
@@ -308,10 +308,10 @@ NSInteger kBlobAsImageFile = 4;
NSUInteger rowCounter = 0;
- if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
+ if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
NSFileManager *fm = [NSFileManager defaultManager];
- [fm removeItemAtPath:copyBlobFileDirectory error:nil];
- [fm createDirectoryAtPath:copyBlobFileDirectory withIntermediateDirectories:YES attributes:nil error:nil];
+ [fm removeItemAtPath:tmpBlobFileDirectory error:nil];
+ [fm createDirectoryAtPath:tmpBlobFileDirectory withIntermediateDirectories:YES attributes:nil error:nil];
}
while ( rowIndex != NSNotFound )
@@ -335,13 +335,13 @@ NSInteger kBlobAsImageFile = 4;
[displayString release];
}
}
- else if(withBlobHandling == kBlobAsFile && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.dat", copyBlobFileDirectory, rowCounter, c];
+ else if(withBlobHandling == kBlobAsFile && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.dat", tmpBlobFileDirectory, rowCounter, c];
[cellData writeToFile:fp atomically:NO];
[result appendFormat:@"\"%@\",", fp];
}
- else if(withBlobHandling == kBlobAsImageFile && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.tif", copyBlobFileDirectory, rowCounter, c];
+ else if(withBlobHandling == kBlobAsImageFile && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.tif", tmpBlobFileDirectory, rowCounter, c];
NSImage *image = [[NSImage alloc] initWithData:cellData];
if (image) {
NSData *d = [[NSData alloc] initWithData:[image TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1]];
@@ -359,8 +359,8 @@ NSInteger kBlobAsImageFile = 4;
}
}
else if ([cellData isKindOfClass:mcpGeometryData]) {
- if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && copyBlobFileDirectory && [copyBlobFileDirectory length]) {
- NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.pdf", copyBlobFileDirectory, rowCounter, c];
+ if((withBlobHandling == kBlobAsFile || withBlobHandling == kBlobAsImageFile) && tmpBlobFileDirectory && [tmpBlobFileDirectory length]) {
+ NSString *fp = [NSString stringWithFormat:@"%@/%ld_%ld.pdf", tmpBlobFileDirectory, rowCounter, c];
SPGeometryDataView *v = [[SPGeometryDataView alloc] initWithCoordinates:[cellData coordinates]];
NSData *thePDF = [v pdfData];
if(thePDF) {
@@ -1294,9 +1294,9 @@ NSInteger kBlobAsImageFile = 4;
if(blobHandling != kBlobExclude) {
NSString *bundleBlobFilePath = [NSString stringWithFormat:@"%@_%@", SPBundleTaskCopyBlobFileDirectory, uuid];
[env setObject:bundleBlobFilePath forKey:SPBundleShellVariableBlobFileDirectory];
- [self setCopyBlobFileDirectory:bundleBlobFilePath];
+ [self setTmpBlobFileDirectory:bundleBlobFilePath];
} else {
- [self setCopyBlobFileDirectory:@""];
+ [self setTmpBlobFileDirectory:@""];
}
if([inputAction isEqualToString:SPBundleInputSourceSelectedTableRowsAsTab]) {
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 272c0ebf..307e5c9a 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -464,7 +464,7 @@
#ifndef SP_REFACTOR
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionSQL];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
@@ -3582,10 +3582,10 @@
[prefs synchronize];
#endif
- [[self buildHistoryString] writeToFile:[panel filename]
- atomically:YES
- encoding:[[encodingPopUp selectedItem] tag]
- error:&error];
+ [[self buildHistoryString] writeToURL:[panel URL]
+ atomically:YES
+ encoding:[[encodingPopUp selectedItem] tag]
+ error:&error];
if (error) [[NSAlert alertWithError:error] runModal];
}
diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m
index 606906f4..794c8fbf 100644
--- a/Source/SPDataImport.m
+++ b/Source/SPDataImport.m
@@ -315,7 +315,7 @@
progressCancelled = NO;
if(lastFilename) [lastFilename release]; lastFilename = nil;
- lastFilename = [[NSString stringWithString:[(NSOpenPanel*)sheet filename]] retain];
+ lastFilename = [[NSString stringWithString:[[(NSOpenPanel*)sheet URL] path]] retain];
NSString *importFileName = [NSString stringWithString:lastFilename];
if (lastFilename == nil || ![lastFilename length]) {
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index a70089eb..f29727b3 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2186,7 +2186,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionSQL];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
@@ -2818,7 +2818,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
{
if ( returnCode ) {
- NSString *fileName = [panel filename];
+ NSString *fileName = [[panel URL] path];
NSError *error = nil;
// Save file as SQL file by using the chosen encoding
@@ -3487,7 +3487,7 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax";
if ([createSyntax length] > 0) {
NSString *output = [NSString stringWithFormat:@"-- %@ '%@'\n\n%@\n", NSLocalizedString(@"Create syntax for", @"create syntax for table comment"), [self table], createSyntax];
- [output writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ [output writeToURL:[sheet URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}
}
}
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index 08e91936..f2802180 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -128,7 +128,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPColorThemeFileExtension];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPColorThemeFileExtension]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:NO];
@@ -521,7 +521,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
{
if ([contextInfo isEqualToString:SPExportColorScheme]) {
if (returnCode == NSOKButton) {
- [self _saveColorThemeAtPath:[panel filename]];
+ [self _saveColorThemeAtPath:[[panel URL] path]];
}
}
else if ([contextInfo isEqualToString:SPImportColorScheme]) {
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 7c8a960c..2df24c24 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -548,7 +548,7 @@
NSString *fileDefault = @"";
if([editSheetSegmentControl selectedSegment] == 1 && [sheetEditData isKindOfClass:[MCPGeometryData class]]) {
- [panel setRequiredFileType:@"pdf"];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:@"pdf"]];
[panel setAllowsOtherFileTypes:NO];
} else {
[panel setAllowsOtherFileTypes:YES];
@@ -642,7 +642,6 @@
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton) {
- NSString *fileName = [panel filename];
NSString *contents = nil;
editSheetWillBeInitialized = YES;
@@ -655,7 +654,7 @@
}
// load new data/images
- sheetEditData = [[NSData alloc] initWithContentsOfFile:fileName];
+ sheetEditData = [[NSData alloc] initWithContentsOfURL:[panel URL]];
NSImage *image = [[NSImage alloc] initWithData:sheetEditData];
contents = [[NSString alloc] initWithData:sheetEditData encoding:encoding];
@@ -710,37 +709,37 @@
[editSheetProgressBar startAnimation:self];
- NSString *fileName = [panel filename];
+ NSURL *fileURL = [panel URL];
// Write binary field types directly to the file
if ( [sheetEditData isKindOfClass:[NSData class]] ) {
- [sheetEditData writeToFile:fileName atomically:YES];
+ [sheetEditData writeToURL:fileURL atomically:YES];
}
else if ( [sheetEditData isKindOfClass:[MCPGeometryData class]] ) {
if ( [editSheetSegmentControl selectedSegment] == 0 || editImage == nil ) {
- [[editTextView string] writeToFile:fileName
- atomically:YES
- encoding:encoding
- error:NULL];
+ [[editTextView string] writeToURL:fileURL
+ atomically:YES
+ encoding:encoding
+ error:NULL];
} else if (editImage != nil){
SPGeometryDataView *v = [[[SPGeometryDataView alloc] initWithCoordinates:[sheetEditData coordinates] targetDimension:2000.0f] autorelease];
NSData *pdf = [v pdfData];
if(pdf)
- [pdf writeToFile:fileName atomically:YES];
+ [pdf writeToURL:fileURL atomically:YES];
}
}
// Write other field types' representations to the file via the current encoding
else {
- [[sheetEditData description] writeToFile:fileName
- atomically:YES
- encoding:encoding
- error:NULL];
+ [[sheetEditData description] writeToURL:fileURL
+ atomically:YES
+ encoding:encoding
+ error:NULL];
}
[editSheetProgressBar stopAnimation:self];
diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h
index 7c8fed07..bbe34f28 100644
--- a/Source/SPIndexesController.h
+++ b/Source/SPIndexesController.h
@@ -61,7 +61,8 @@
BOOL _mainNibLoaded;
NSString *table;
- NSMutableArray *fields, *indexes, *indexedFields, *supportsLength, *requiresLength;
+ NSMutableArray *fields, *indexes, *indexedFields;
+ NSArray *supportsLength, *requiresLength;
#ifndef SP_REFACTOR /* ivars */
NSUserDefaults *prefs;
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m
index 1c17dd25..3435cbcd 100644
--- a/Source/SPNavigatorController.m
+++ b/Source/SPNavigatorController.m
@@ -130,7 +130,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte
- (id)autorelease { return self; }
-- (void)release { }
+- (oneway void)release { }
#ifndef SP_REFACTOR
/**
diff --git a/Source/SPNotLoaded.m b/Source/SPNotLoaded.m
index 4e2925a7..49e6cbfa 100644
--- a/Source/SPNotLoaded.m
+++ b/Source/SPNotLoaded.m
@@ -66,7 +66,7 @@ static SPNotLoaded *notLoaded = nil;
- (NSUInteger) retainCount { return NSUIntegerMax; }
-- (void) release {}
+- (oneway void) release {}
- (id) autorelease { return self; }
diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m
index 4f0490cb..382940a1 100644
--- a/Source/SPProcessListController.m
+++ b/Source/SPProcessListController.m
@@ -409,7 +409,7 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id";
[processesString appendString:@"\n"];
}
- [processesString writeToFile:[panel filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ [processesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}
}
}
diff --git a/Source/SPQueryConsoleDataSource.m b/Source/SPQueryConsoleDataSource.m
index 29a8dc7a..a8b289d9 100644
--- a/Source/SPQueryConsoleDataSource.m
+++ b/Source/SPQueryConsoleDataSource.m
@@ -43,7 +43,7 @@ static NSUInteger SPMessageTruncateCharacterLength = 256;
}
/**
- * Table view delegate method. Returns the specific object for the request column and row.
+ * Table view delegate method. Returns the specific object for the requested column and row.
*/
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index a3c46160..82a19091 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -125,7 +125,7 @@ static SPQueryController *sharedQueryController = nil;
- (id)autorelease { return self; }
-- (void)release { }
+- (oneway void)release { }
#pragma mark -
#pragma mark QueryConsoleController
@@ -144,9 +144,9 @@ static SPQueryController *sharedQueryController = nil;
NSIndexSet *rows = [consoleTableView selectedRowIndexes];
NSUInteger i = [rows firstIndex];
-
- BOOL dateColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:SPTableViewDateColumnID] isHidden];
- BOOL connectionColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:SPTableViewConnectionColumnID] isHidden];
+
+ BOOL includeTimestamps = ![[consoleTableView tableColumnWithIdentifier:SPTableViewDateColumnID] isHidden];
+ BOOL includeConnections = ![[consoleTableView tableColumnWithIdentifier:SPTableViewConnectionColumnID] isHidden];
[string setString:@""];
@@ -154,15 +154,20 @@ static SPQueryController *sharedQueryController = nil;
{
if (i < [messagesVisibleSet count]) {
SPConsoleMessage *message = NSArrayObjectAtIndex(messagesVisibleSet, i);
-
- // If the timestamp column is not hidden we need to include them in the copy
- if (!dateColumnIsHidden)
- [string appendFormat:@"/* %@ %@ ", [dateFormatter stringFromDate:[message messageDate]], (connectionColumnIsHidden) ? @"*/ ": @""];
-
-
- // If the connection column is not hidden we need to include them in the copy
- if (!connectionColumnIsHidden)
- [string appendFormat:@"%@%@ */ ",(dateColumnIsHidden) ? @"/* " : @"", [message messageConnection]];
+
+ if (includeTimestamps || includeConnections) [string appendString:@"/* "];
+
+ if (includeTimestamps) {
+ [string appendString:[dateFormatter stringFromDate:[message messageDate]]];
+ [string appendString:@" "];
+ }
+
+ if (includeConnections) {
+ [string appendString:[message messageConnection]];
+ [string appendString:@" "];
+ }
+
+ if (includeTimestamps || includeConnections) [string appendString:@"*/ "];
[string appendFormat:@"%@\n", [message message]];
}
@@ -200,7 +205,7 @@ static SPQueryController *sharedQueryController = nil;
#ifndef SP_REFACTOR
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionSQL];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
@@ -297,7 +302,7 @@ static SPQueryController *sharedQueryController = nil;
{
#ifndef SP_REFACTOR
if (returnCode == NSOKButton) {
- [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton integerValue] connections:[includeConnectionButton integerValue]] writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ [[self _getConsoleStringWithTimeStamps:[includeTimeStampsButton state] connections:[includeConnectionButton state]] writeToFile:[[sheet URL] path] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}
#endif
}
@@ -528,12 +533,14 @@ static SPQueryController *sharedQueryController = nil;
// If the timestamp column is not hidden we need to include them in the copy
if (timeStamps) {
- [consoleString appendFormat:@"%@ ", [dateFormatter stringFromDate:[message messageDate]]];
+ [consoleString appendString:[dateFormatter stringFromDate:[message messageDate]]];
+ [consoleString appendString:@" "];
}
// If the connection column is not hidden we need to include them in the copy
if (connections) {
- [consoleString appendFormat:@"%@ ", [message messageConnection]];
+ [consoleString appendString:[message messageConnection]];
+ [consoleString appendString:@" "];
}
// Close the comment
diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m
index 90575e33..28f824fe 100644
--- a/Source/SPQueryFavoriteManager.m
+++ b/Source/SPQueryFavoriteManager.m
@@ -299,7 +299,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionSQL];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionSQL]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
@@ -319,7 +319,7 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:SPFileExtensionDefault];
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:SPFileExtensionDefault]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:NO];
@@ -828,7 +828,7 @@
[prefs synchronize];
#endif
- [[favoriteQueryTextView string] writeToFile:[panel filename] atomically:YES encoding:[[encodingPopUp selectedItem] tag] error:&error];
+ [[favoriteQueryTextView string] writeToURL:[panel URL] atomically:YES encoding:[[encodingPopUp selectedItem] tag] error:&error];
if (error) [[NSAlert alertWithError:error] runModal];
}
@@ -873,7 +873,7 @@
}
NSError *error = nil;
- [plist writeToFile:[panel filename] options:NSAtomicWrite error:&error];
+ [plist writeToURL:[panel URL] options:NSAtomicWrite error:&error];
if (error) [[NSAlert alertWithError:error] runModal];
}
diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m
index f2eb60e0..5b9114d8 100644
--- a/Source/SPServerVariablesController.m
+++ b/Source/SPServerVariablesController.m
@@ -124,8 +124,8 @@
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setRequiredFileType:@"cnf"];
-
+ [panel setAllowedFileTypes:[NSArray arrayWithObject:@"cnf"]];
+
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:YES];
[panel setCanSelectHiddenExtension:YES];
@@ -174,7 +174,7 @@
[variablesString appendFormat:@"%@ = %@\n", [variable objectForKey:@"Variable_name"], [variable objectForKey:@"Value"]];
}
- [variablesString writeToFile:[panel filename] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
+ [variablesString writeToURL:[panel URL] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
}
}
}
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index cc965e19..90cfc40c 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -51,7 +51,7 @@
IBOutlet id argumentField;
IBOutlet id filterButton;
IBOutlet id addButton;
- IBOutlet id copyButton;
+ IBOutlet id duplicateButton;
IBOutlet id removeButton;
IBOutlet id reloadButton;
#ifndef SP_REFACTOR
@@ -189,7 +189,7 @@
// Edit methods
- (IBAction)addRow:(id)sender;
-- (IBAction)copyRow:(id)sender;
+- (IBAction)duplicateRow:(id)sender;
- (IBAction)removeRow:(id)sender;
- (void)removeRowSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo;
@@ -271,7 +271,7 @@
@property (assign) id secondBetweenField;
@property (assign) id argumentField;
@property (assign) NSButton* addButton;
-@property (assign) NSButton* copyButton;
+@property (assign) NSButton* duplicateButton;
@property (assign) NSButton* removeButton;
@property (assign) NSButton* reloadButton;
@property (assign) NSButton* paginationNextButton;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 14f07866..a1ff0daa 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -67,7 +67,7 @@
@synthesize argumentField;
@synthesize betweenTextField;
@synthesize compareField;
-@synthesize copyButton;
+@synthesize duplicateButton;
@synthesize fieldField;
@synthesize filterButton;
@synthesize firstBetweenField;
@@ -453,7 +453,7 @@
// Disable table action buttons
[addButton setEnabled:NO];
- [copyButton setEnabled:NO];
+ [duplicateButton setEnabled:NO];
[removeButton setEnabled:NO];
// Clear restoration settings
@@ -699,7 +699,7 @@
// Set the state of the table buttons
[addButton setEnabled:(enableInteraction && [tablesListInstance tableType] == SPTableTypeTable)];
- [copyButton setEnabled:NO];
+ [duplicateButton setEnabled:NO];
[removeButton setEnabled:NO];
// Reset the table store if required - basically if the table is being changed,
@@ -1787,7 +1787,7 @@
/**
* Copies a row of the table-array and goes into edit mode
*/
-- (IBAction)copyRow:(id)sender
+- (IBAction)duplicateRow:(id)sender
{
NSMutableArray *tempRow;
MCPResult *queryResult;
@@ -4270,15 +4270,15 @@
// and update the status of the delete/duplicate buttons
if([tablesListInstance tableType] == SPTableTypeTable) {
if ([tableContentView numberOfSelectedRows] > 0) {
- [copyButton setEnabled:([tableContentView numberOfSelectedRows] == 1)];
+ [duplicateButton setEnabled:([tableContentView numberOfSelectedRows] == 1)];
[removeButton setEnabled:YES];
}
else {
- [copyButton setEnabled:NO];
+ [duplicateButton setEnabled:NO];
[removeButton setEnabled:NO];
}
} else {
- [copyButton setEnabled:NO];
+ [duplicateButton setEnabled:NO];
[removeButton setEnabled:NO];
}
}
@@ -4645,7 +4645,7 @@
[addButton setEnabled:NO];
[removeButton setEnabled:NO];
- [copyButton setEnabled:NO];
+ [duplicateButton setEnabled:NO];
[reloadButton setEnabled:NO];
[filterButton setEnabled:NO];
tableRowsSelectable = NO;
@@ -4678,7 +4678,7 @@
if ([tableContentView numberOfSelectedRows] > 0) {
if([tablesListInstance tableType] == SPTableTypeTable) {
[removeButton setEnabled:YES];
- [copyButton setEnabled:YES];
+ [duplicateButton setEnabled:YES];
}
}
@@ -4842,7 +4842,7 @@
}
// Duplicate row
- if (action == @selector(copyRow:)) {
+ if (action == @selector(duplicateRow:)) {
return (([tableContentView numberOfSelectedRows]) == 1 && ([tablesListInstance tableType] == SPTableTypeTable));
}
diff --git a/Source/SPTableStructure.h b/Source/SPTableStructure.h
index b69c5a55..63ac74b8 100644
--- a/Source/SPTableStructure.h
+++ b/Source/SPTableStructure.h
@@ -42,26 +42,32 @@
IBOutlet SPIndexesController* indexesController;
IBOutlet SPDatabaseData* databaseDataInstance;
+#ifndef SP_REFACTOR /* ivars */
IBOutlet id keySheet;
IBOutlet id resetAutoIncrementSheet;
IBOutlet id resetAutoIncrementValue;
IBOutlet id resetAutoIncrementLine;
- IBOutlet SPTableView *tableSourceView;
+#endif
+ IBOutlet SPTableView* tableSourceView;
IBOutlet id addFieldButton;
- IBOutlet id copyFieldButton;
+ IBOutlet id duplicateFieldButton;
IBOutlet id removeFieldButton;
IBOutlet id reloadFieldsButton;
+#ifndef SP_REFACTOR /* ivars */
IBOutlet id chooseKeyButton;
IBOutlet id structureGrabber;
IBOutlet id editTableButton;
IBOutlet id addIndexButton;
IBOutlet id removeIndexButton;
IBOutlet id refreshIndexesButton;
- IBOutlet SPTableView *indexesTableView;
+#endif
+ IBOutlet SPTableView* indexesTableView;
+#ifndef SP_REFACTOR /* ivars */
IBOutlet NSSplitView *tablesIndexesSplitView;
IBOutlet NSButton *indexesShowButton;
IBOutlet id viewColumnsMenu;
+#endif
IBOutlet NSPopUpButtonCell *encodingPopupCell;
MCPConnection *mySQLConnection;
@@ -85,6 +91,15 @@
BOOL isEditingRow, isEditingNewRow, isSavingRow, alertSheetOpened;
}
+#ifdef SP_REFACTOR
+@property (assign) SPIndexesController* indexesController;
+@property (assign) id indexesTableView;
+@property (assign) id addFieldButton;
+@property (assign) id duplicateFieldButton;
+@property (assign) id removeFieldButton;
+@property (assign) id reloadFieldsButton;
+#endif
+
// Table loading
- (void)loadTable:(NSString *)aTable;
- (IBAction)reloadTable:(id)sender;
@@ -94,12 +109,15 @@
- (void)setDatabaseDocument:(SPDatabaseDocument*)doc;
- (void)setTableListInstance:(SPTablesList*)list;
- (void)setTableDataInstance:(SPTableData*)data;
+- (void)setDatabaseDataInstance:(SPDatabaseData*)data;
+- (void)setTableSourceView:(SPTableView*)tv;
+- (void)setEncodingPopupCell:(NSPopUpButtonCell*)cell;
#endif
- (void)showErrorSheetWith:(NSDictionary *)errorDictionary;
// Edit methods
- (IBAction)addField:(id)sender;
-- (IBAction)copyField:(id)sender;
+- (IBAction)duplicateField:(id)sender;
- (IBAction)removeField:(id)sender;
- (void)removeFieldSheetDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (IBAction)resetAutoIncrement:(id)sender;
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index dd05f1e3..f9c56eb9 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -45,6 +45,15 @@
@implementation SPTableStructure
+#ifdef SP_REFACTOR
+@synthesize indexesController;
+@synthesize indexesTableView;
+@synthesize addFieldButton;
+@synthesize duplicateFieldButton;
+@synthesize removeFieldButton;
+@synthesize reloadFieldsButton;
+#endif
+
#pragma mark -
#pragma mark Initialization
@@ -172,9 +181,11 @@
[prefs addObserver:indexesController forKeyPath:SPUseMonospacedFonts options:NSKeyValueObservingOptionNew context:NULL];
#endif
+#ifndef SP_REFACTOR
// Init the view column submenu according to saved hidden status;
// menu items are identified by their tag number which represents the initial column index
for (NSMenuItem *item in [viewColumnsMenu itemArray]) [item setState:NSOnState]; // Set all items to NSOnState
+#endif
#ifndef SP_REFACTOR /* patch */
for (NSTableColumn *col in [tableSourceView tableColumns])
@@ -191,6 +202,7 @@
}
}
#else
+/*
for (NSTableColumn *col in [tableSourceView tableColumns])
{
if ([col isHidden]) {
@@ -204,6 +216,7 @@
[[viewColumnsMenu itemAtIndex:[viewColumnsMenu indexOfItemWithTag:12]] setState:NSOffState];
}
}
+*/
#endif
[tableSourceView reloadData];
@@ -284,16 +297,16 @@
// Set up the encoding PopUpButtonCell
NSArray *encodings = [databaseDataInstance getDatabaseCharacterSetEncodings];
if ([encodings count]) {
- [encodingPopupCell removeAllItems];
- [encodingPopupCell addItemWithTitle:@""];
+ [[encodingPopupCell onMainThread] removeAllItems];
+ [[encodingPopupCell onMainThread] addItemWithTitle:@""];
// Populate encoding popup button
for (NSDictionary *encoding in encodings)
- [encodingPopupCell addItemWithTitle:(![encoding objectForKey:@"DESCRIPTION"]) ? [encoding objectForKey:@"CHARACTER_SET_NAME"] : [NSString stringWithFormat:@"%@ (%@)", [encoding objectForKey:@"DESCRIPTION"], [encoding objectForKey:@"CHARACTER_SET_NAME"]]];
+ [[encodingPopupCell onMainThread] addItemWithTitle:(![encoding objectForKey:@"DESCRIPTION"]) ? [encoding objectForKey:@"CHARACTER_SET_NAME"] : [NSString stringWithFormat:@"%@ (%@)", [encoding objectForKey:@"DESCRIPTION"], [encoding objectForKey:@"CHARACTER_SET_NAME"]]];
}
else {
- [encodingPopupCell addItemWithTitle:NSLocalizedString(@"Not available", @"not available label")];
+ [[encodingPopupCell onMainThread] addItemWithTitle:NSLocalizedString(@"Not available", @"not available label")];
}
// Process all the fields to normalise keys and add additional information
@@ -427,11 +440,13 @@
[enumFields removeAllObjects];
[indexesTableView deselectAll:self];
[addFieldButton setEnabled:NO];
- [copyFieldButton setEnabled:NO];
+ [duplicateFieldButton setEnabled:NO];
[removeFieldButton setEnabled:NO];
+#ifndef SP_REFACTOR
[addIndexButton setEnabled:NO];
[removeIndexButton setEnabled:NO];
[editTableButton setEnabled:NO];
+#endif
// If no table is selected, refresh the table/index display to blank and return
if (!selectedTable) {
@@ -458,14 +473,18 @@
defaultValues = [[NSDictionary dictionaryWithDictionary:newDefaultValues] retain];
+#ifndef SP_REFACTOR
// Enable the edit table button
[editTableButton setEnabled:enableInteraction];
+#endif
// If a view is selected, disable the buttons; otherwise enable.
BOOL editingEnabled = ([tablesListInstance tableType] == SPTableTypeTable) && enableInteraction;
[addFieldButton setEnabled:editingEnabled];
+#ifndef SP_REFACTOR
[addIndexButton setEnabled:editingEnabled];
+#endif
// Reload the views
[indexesTableView reloadData];
@@ -600,7 +619,7 @@
/**
* Copies a field and goes in edit mode for the new field
*/
-- (IBAction)copyField:(id)sender
+- (IBAction)duplicateField:(id)sender
{
NSMutableDictionary *tempRow;
NSUInteger rowToCopy;
@@ -700,6 +719,7 @@
*/
- (IBAction)resetAutoIncrement:(id)sender
{
+#ifndef SP_REFACTOR
if ([sender tag] == 1) {
[resetAutoIncrementLine setHidden:YES];
@@ -719,6 +739,7 @@
else if ([sender tag] == 2) {
[self setAutoIncrementTo:@"1"];
}
+#endif
}
/**
@@ -726,12 +747,14 @@
*/
- (void)resetAutoincrementSheetDidEnd:(NSWindow *)theSheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
+#ifndef SP_REFACTOR
// Order out current sheet to suppress overlapping of sheets
[theSheet orderOut:nil];
if (returnCode == NSAlertDefaultReturn) {
[self setAutoIncrementTo:[[resetAutoIncrementValue stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
}
+#endif
}
/**
@@ -787,7 +810,9 @@
- (IBAction)unhideIndexesView:(id)sender
{
+#ifndef SP_REFACTOR
[tablesIndexesSplitView setPosition:[tablesIndexesSplitView frame].size.height-130 ofDividerAtIndex:0];
+#endif
}
@@ -1196,11 +1221,13 @@
[tableSourceView reloadData];
[indexesTableView reloadData];
[addFieldButton setEnabled:NO];
- [copyFieldButton setEnabled:NO];
+ [duplicateFieldButton setEnabled:NO];
[removeFieldButton setEnabled:NO];
+#ifndef SP_REFACTOR
[addIndexButton setEnabled:NO];
[removeIndexButton setEnabled:NO];
[editTableButton setEnabled:NO];
+#endif
[tablesListInstance updateTables:self];
return NO;
}
@@ -1225,6 +1252,7 @@
}
#ifdef SP_REFACTOR /* glue */
+
- (void)setDatabaseDocument:(SPDatabaseDocument*)doc
{
tableDocumentInstance = doc;
@@ -1240,6 +1268,21 @@
tableDataInstance = data;
}
+- (void)setDatabaseDataInstance:(SPDatabaseData*)data
+{
+ databaseDataInstance = data;
+}
+
+- (void)setTableSourceView:(SPTableView*)tv
+{
+ tableSourceView = tv;
+}
+
+- (void)setEncodingPopupCell:(NSPopUpButtonCell*)cell
+{
+ encodingPopupCell = cell;
+}
+
#endif
/**
@@ -1275,7 +1318,7 @@
}
// Duplicate field
- if ([menuItem action] == @selector(copyField:)) {
+ if ([menuItem action] == @selector(duplicateField:)) {
return ([tableSourceView numberOfSelectedRows] == 1);
}
@@ -1295,6 +1338,7 @@
*/
- (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+#ifndef SP_REFACTOR
// Order out current sheet to suppress overlapping of sheets
if ([sheet respondsToSelector:@selector(orderOut:)])
@@ -1325,6 +1369,7 @@
isCurrentExtraAutoIncrement = NO;
}
}
+#endif
}
/**
@@ -1532,14 +1577,18 @@
[tableSourceView setEnabled:NO];
[addFieldButton setEnabled:NO];
[removeFieldButton setEnabled:NO];
- [copyFieldButton setEnabled:NO];
+ [duplicateFieldButton setEnabled:NO];
[reloadFieldsButton setEnabled:NO];
+#ifndef SP_REFACTOR
[editTableButton setEnabled:NO];
+#endif
[indexesTableView setEnabled:NO];
+#ifndef SP_REFACTOR
[addIndexButton setEnabled:NO];
[removeIndexButton setEnabled:NO];
[refreshIndexesButton setEnabled:NO];
+#endif
}
/**
@@ -1560,18 +1609,22 @@
if (editingEnabled && [tableSourceView numberOfSelectedRows] > 0) {
[removeFieldButton setEnabled:YES];
- [copyFieldButton setEnabled:YES];
+ [duplicateFieldButton setEnabled:YES];
}
[reloadFieldsButton setEnabled:YES];
+#ifndef SP_REFACTOR
[editTableButton setEnabled:YES];
+#endif
[indexesTableView setEnabled:YES];
[indexesTableView displayIfNeeded];
+#ifndef SP_REFACTOR
[addIndexButton setEnabled:editingEnabled];
[removeIndexButton setEnabled:(editingEnabled && ([indexesTableView numberOfSelectedRows] > 0))];
[refreshIndexesButton setEnabled:YES];
+#endif
}
#pragma mark -
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index 5c927802..ca44c0a6 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -401,7 +401,7 @@
// If we are editing a row, attempt to save that row - if saving failed, reselect the edit row.
if (isEditingRow && [tableSourceView selectedRow] != currentlyEditingRow && ![self saveRowOnDeselect]) return;
- [copyFieldButton setEnabled:YES];
+ [duplicateFieldButton setEnabled:YES];
// Check if there is currently a field selected and change button state accordingly
if ([tableSourceView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable) {
@@ -409,7 +409,7 @@
}
else {
[removeFieldButton setEnabled:NO];
- [copyFieldButton setEnabled:NO];
+ [duplicateFieldButton setEnabled:NO];
}
// If the table only has one field, disable the remove button. This removes the need to check that the user