diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-08-22 21:59:43 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-08-22 21:59:43 +0000 |
commit | dcd0413d4cc106d1efe17cc225be7c325081a113 (patch) | |
tree | b64ad0cc32741312b285736f02bd59d3c2d9698c /Source/SPCustomQuery.m | |
parent | 82439bd6c54d64a130c74e9c2dfec66e65de043a (diff) | |
download | sequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.tar.gz sequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.tar.bz2 sequelpro-dcd0413d4cc106d1efe17cc225be7c325081a113.zip |
• first preparations to allow in cell editing in Custom Query (not yet active)
• view data editing
- disable add/duplicate/remove row for views
- first improvements for editing navigation via keyboard
- after editing avoid relaodTable instead use loadTableValues
- outsourced: (NSInteger)fieldEditStatusForRow:andColumn: since it will be used for keyboard editing navigation
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r-- | Source/SPCustomQuery.m | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 80ec1c33..c7e0a9bf 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -1766,7 +1766,8 @@ NSString *columnName = [columnDefinition objectForKey:@"org_name"]; // NSString *fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn]; - + fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]]; + // Check if the IDstring identifies the current field bijectively NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue]; if(numberOfPossibleUpdateRows == 1) { @@ -2149,36 +2150,40 @@ [errorText setStringValue:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database")]; } + // if ([multipleLineEditingButton state] == NSOnState || isBlob) { - SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init]; + SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init]; - // Remember edited row for reselecting and setting the scroll view after reload - editedRow = rowIndex; - editedScrollViewRect = [customQueryScrollView documentVisibleRect]; + // Remember edited row for reselecting and setting the scroll view after reload + editedRow = rowIndex; + editedScrollViewRect = [customQueryScrollView documentVisibleRect]; - // Set max text length - if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"] - && [columnDefinition valueForKey:@"char_length"]) - [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] integerValue]]; + // Set max text length + if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"string"] + && [columnDefinition valueForKey:@"char_length"]) + [fieldEditor setTextMaxLength:[[columnDefinition valueForKey:@"char_length"] integerValue]]; - id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]]; - if ([originalData isNSNull]) originalData = [prefs objectForKey:SPNullValue]; + id originalData = [resultData cellDataAtRow:rowIndex column:[[aTableColumn identifier] integerValue]]; + if ([originalData isNSNull]) originalData = [prefs objectForKey:SPNullValue]; - id editData = [[fieldEditor editWithObject:originalData - fieldName:[columnDefinition objectForKey:@"name"] - usingEncoding:[mySQLConnection encoding] - isObjectBlob:isBlob - isEditable:isFieldEditable - withWindow:[tableDocumentInstance parentWindow]] retain]; + id editData = [[fieldEditor editWithObject:originalData + fieldName:[columnDefinition objectForKey:@"name"] + usingEncoding:[mySQLConnection encoding] + isObjectBlob:isBlob + isEditable:isFieldEditable + withWindow:[tableDocumentInstance parentWindow]] retain]; - if ( editData ) - [self tableView:aTableView setObjectValue:[editData copy] forTableColumn:aTableColumn row:rowIndex]; + if ( editData ) + [self tableView:aTableView setObjectValue:[editData copy] forTableColumn:aTableColumn row:rowIndex]; - [fieldEditor release]; + [fieldEditor release]; - if ( editData ) [editData release]; + if ( editData ) [editData release]; - return NO; + return NO; + + // } + return isFieldEditable; } else { return YES; |