Permalink
Browse files

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)
  • Loading branch information...
dmoagx committed Mar 24, 2015
1 parent ea39be5 commit 9fd78af55a55a8a5a976a6b6f31839439cc28241
Showing with 11 additions and 2 deletions.
  1. +11 −2 Source/SPTableContentDelegate.m
@@ -261,11 +261,12 @@ - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn
[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 @@ - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn
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 @@ - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn
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;
}

0 comments on commit 9fd78af

Please sign in to comment.