From 9fd78af55a55a8a5a976a6b6f31839439cc28241 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 24 Mar 2015 21:15:03 +0100 Subject: Disable editing columns in "Display in Hex" mode This is a workaround for a potential data loss/corruption bug until we really fix this (see #1876) --- Source/SPTableContentDelegate.m | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index b73282ec..19bbc4b3 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -261,11 +261,12 @@ [tableContentView reloadData]; } + // Retrieve the column definition + NSDictionary *columnDefinition = [cqColumnDefinition objectAtIndex:[[tableColumn identifier] integerValue]]; + // Open the editing sheet if required if ([tableContentView shouldUseFieldEditorForRow:rowIndex column:[[tableColumn identifier] integerValue] checkWithLock:NULL]) { - // Retrieve the column definition - NSDictionary *columnDefinition = [cqColumnDefinition objectAtIndex:[[tableColumn identifier] integerValue]]; BOOL isBlob = [tableDataInstance columnIsBlobOrText:[[tableColumn headerCell] stringValue]]; // A table is per definition editable @@ -318,6 +319,7 @@ if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"binary"] && [prefs boolForKey:SPDisplayBinaryDataAsHex]) { [fieldEditor setTextMaxLength:[[self tableView:tableContentView objectValueForTableColumn:tableColumn row:rowIndex] length]]; + isFieldEditable = NO; } NSInteger editedColumn = 0; @@ -345,6 +347,13 @@ return NO; } + // TODO: Fix editing of "Display as Hex" columns and remove this (also see above) + if ([[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"binary"] && [prefs boolForKey:SPDisplayBinaryDataAsHex]) { + NSBeep(); + [SPTooltip showWithObject:NSLocalizedString(@"Disable \"Display Binary Data as Hex\" in the View menu to edit this field.",@"Temporary : Tooltip shown when trying to edit a binary field in table content view while it is displayed using HEX conversion")]; + return NO; + } + return YES; } -- cgit v1.2.3