From 5bc3071de5ca8a27b2be1daa007d2ba9d7896b56 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sun, 22 Aug 2010 12:47:39 +0000 Subject: =?UTF-8?q?=E2=80=A2=20view=20editing=20-=20if=20multipleLineEditi?= =?UTF-8?q?ngButton=20is=20set=20to=20on=20or=20field=20is=20a=20blob=20fi?= =?UTF-8?q?eld=20allow=20to=20show=20the=20field=20data=20as=20non-editabl?= =?UTF-8?q?e=20fieldEditorSheet=20if=20field=20is=20not=20editable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPTableContent.m | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'Source') diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index a3379f09..7b012f45 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -3377,6 +3377,7 @@ NSDictionary *columnDefinition; BOOL noTableName = NO; + BOOL otherErrorWasDisplayed = NO; isFieldEditable = NO; NSInteger numberOfPossibleUpdateRows = -1; @@ -3414,6 +3415,7 @@ if(!isFieldEditable) { fieldIDQueryString = nil; + otherErrorWasDisplayed = YES; NSPoint pos = [NSEvent mouseLocation]; pos.y -= 20; if(numberOfPossibleUpdateRows == 0) @@ -3424,17 +3426,21 @@ [SPTooltip showWithObject:[NSString stringWithFormat:NSLocalizedString(@"Field is not editable. Couldn't identify field origin unambiguously (%ld match%@).", @"Table Content result editing error - could not match row being edited uniquely"), (long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?NSLocalizedString(@"es", @"Plural suffix for row count, eg 4 match*es*"):@""] atLocation:pos ofType:@"text"]; - return NO; + // Allow to display blobs even it's not editable + if(!isBlob && [multipleLineEditingButton state] == NSOffState) + return NO; } } - if(!isFieldEditable) { + if(!isFieldEditable && !otherErrorWasDisplayed) { NSPoint pos = [NSEvent mouseLocation]; pos.y -= 20; [SPTooltip showWithObject:NSLocalizedString(@"Field is not editable. Field has no or multiple table or database origin(s).",@"field is not editable due to no table/database") atLocation:pos ofType:@"text"]; - return NO; + // Allow to display blobs even it's not editable + if(!isBlob && [multipleLineEditingButton state] == NSOffState) + return NO; } } @@ -3453,7 +3459,7 @@ fieldName:[[aTableColumn headerCell] stringValue] usingEncoding:[mySQLConnection encoding] isObjectBlob:isBlob - isEditable:YES + isEditable:isFieldEditable withWindow:[tableDocumentInstance parentWindow]] retain]; if (editData) { @@ -3470,13 +3476,15 @@ [editData release]; editData = [[NSNull null] retain]; } - if([tablesListInstance tableType] == SPTableTypeView) { - // since in a view we're editing a field rather than a row - isEditingRow = NO; - // update the field and refresh the table - [self tableView:aTableView setObjectValue:[[editData copy] autorelease] forTableColumn:aTableColumn row:rowIndex]; - } else { - [tableValues replaceObjectInRow:rowIndex column:[[aTableColumn identifier] integerValue] withObject:[[editData copy] autorelease]]; + if(isFieldEditable) { + if([tablesListInstance tableType] == SPTableTypeView) { + // since in a view we're editing a field rather than a row + isEditingRow = NO; + // update the field and refresh the table + [self tableView:aTableView setObjectValue:[[editData copy] autorelease] forTableColumn:aTableColumn row:rowIndex]; + } else { + [tableValues replaceObjectInRow:rowIndex column:[[aTableColumn identifier] integerValue] withObject:[[editData copy] autorelease]]; + } } } -- cgit v1.2.3