aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-29 20:06:44 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-29 20:06:44 +0000
commite93d9df70e29e53c4588a6d49bf3a056ac56e9db (patch)
tree96b774aaac21f4a81d3a573b109520859f5a908a /Source/SPCustomQuery.m
parent79f4bb582755adfdc9504830d3a8bf061e1e49c1 (diff)
downloadsequelpro-e93d9df70e29e53c4588a6d49bf3a056ac56e9db.tar.gz
sequelpro-e93d9df70e29e53c4588a6d49bf3a056ac56e9db.tar.bz2
sequelpro-e93d9df70e29e53c4588a6d49bf3a056ac56e9db.zip
• convert the Field Editor Sheet into a document-modal sheet, i.e. now the sheet doesn't block the entire app
- fixed various layout issues - fixed some tiny memory leaks • fixed tiny memory leak in MCPStreamingResult
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m57
1 files changed, 43 insertions, 14 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 31ff02d7..41a6b62f 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -2273,7 +2273,8 @@
if ([multipleLineEditingButton state] == NSOnState || isBlob) {
- SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init];
+ if(fieldEditor) [fieldEditor release], fieldEditor = nil;
+ fieldEditor = [[SPFieldEditorController alloc] init];
// Remember edited row for reselecting and setting the scroll view after reload
editedRow = rowIndex;
@@ -2305,19 +2306,18 @@
if ([originalData isNSNull])
originalData = [NSString stringWithString:[prefs objectForKey:SPNullValue]];
- id editData = [[fieldEditor editWithObject:originalData
- fieldName:[columnDefinition objectForKey:@"name"]
- usingEncoding:[mySQLConnection stringEncoding]
- isObjectBlob:isBlob
- isEditable:isFieldEditable
- withWindow:[tableDocumentInstance parentWindow]] retain];
-
- if ( editData )
- [self tableView:aTableView setObjectValue:[editData copy] forTableColumn:aTableColumn row:rowIndex];
-
- [fieldEditor release];
-
- if ( editData ) [editData release];
+ [fieldEditor editWithObject:originalData
+ fieldName:[columnDefinition objectForKey:@"name"]
+ usingEncoding:[mySQLConnection stringEncoding]
+ isObjectBlob:isBlob
+ isEditable:isFieldEditable
+ withWindow:[tableDocumentInstance parentWindow]
+ sender:self
+ contextInfo:[NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInteger:rowIndex], @"row",
+ [aTableColumn identifier], @"column",
+ [NSNumber numberWithBool:isFieldEditable], @"isFieldEditable",
+ nil]];
// Preserve focus and restore selection indexes if appropriate
[[tableDocumentInstance parentWindow] makeFirstResponder:customQueryView];
@@ -3410,6 +3410,33 @@
return YES;
}
+- (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo
+{
+
+ if (data && contextInfo) {
+ NSUInteger row = [[contextInfo objectForKey:@"row"] integerValue];
+ NSUInteger column = [[contextInfo objectForKey:@"column"] integerValue];
+ BOOL isFieldEditable = ([contextInfo objectForKey:@"isFieldEditable"]) ? YES : NO;
+
+ // if ([data isKindOfClass:[NSString class]]
+ // && [data isEqualToString:[prefs objectForKey:SPNullValue]]
+ // && [[NSArrayObjectAtIndex(dataColumns, column) objectForKey:@"null"] boolValue])
+ // {
+ // data = [[NSNull null] retain];
+ // }
+ if(isFieldEditable) {
+ [self tableView:customQueryView setObjectValue:[[data copy] autorelease] forTableColumn:[customQueryView tableColumnWithIdentifier:[contextInfo objectForKey:@"column"]] row:row];
+ }
+ }
+
+ if(fieldEditor) {
+ [fieldEditor release];
+ fieldEditor = nil;
+ }
+
+ // [[tableDocumentInstance parentWindow] makeFirstResponder:tableContentView];
+}
+
#pragma mark -
- (id)init
@@ -3703,6 +3730,8 @@
[resultData release];
[favoritesManager release];
+ if(fieldEditor) [fieldEditor release], fieldEditor = nil;
+
if (helpHTMLTemplate) [helpHTMLTemplate release];
if (mySQLversion) [mySQLversion release];
if (sortField) [sortField release];