From 33fd38501be11213968536a0c540cee7061e42a9 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 02:45:23 +0100 Subject: Mark issue for s.o. to look at --- Source/SPTableContentDelegate.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/SPTableContentDelegate.m') diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index f6b933f7..2f78a120 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -367,10 +367,11 @@ else { tmp = [tableContentView draggedRowsAsTabString]; } - + +#warning code inside "if" is unreachable if (!tmp && [tmp length]) { - [pboard declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType, NSStringPboardType, nil] owner:nil]; + [pboard declareTypes:@[NSTabularTextPboardType, NSStringPboardType] owner:nil]; [pboard setString:tmp forType:NSStringPboardType]; [pboard setString:tmp forType:NSTabularTextPboardType]; -- cgit v1.2.3 From 994057ae2a82dc110a385ced4239ce49cc0601f8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 17:20:18 +0100 Subject: Add cast for [NSApp delegate] * (Also changed some outdated URLs) * Replaced [NSApplication sharedApplication] with NSApp --- Source/SPTableContentDelegate.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/SPTableContentDelegate.m') diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index 2f78a120..0a624efc 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -118,7 +118,7 @@ [self updateCountText]; #ifndef SP_CODA /* triggered commands */ - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; for (NSString *cmdPath in triggeredCommands) { @@ -150,7 +150,7 @@ if (!stopTrigger) { if ([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if ([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if ([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) { -- cgit v1.2.3 From 2735e15bf5d4b3a976435ebb29ca9073de0e5071 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 4 Jan 2015 03:57:26 +0100 Subject: Formalize [x release], x = nil; convention Take this commit as a proposal to formalize our existing "[x release], x = nil;" convention by introducing a macro for it. Feel free to revert this commit if you see issues with the approch or implementation. --- Source/SPTableContentDelegate.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/SPTableContentDelegate.m') diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index 0a624efc..b73282ec 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -295,7 +295,7 @@ fieldEncoding = [columnDefinition objectForKey:@"charset_name"]; } - if (fieldEditor) [fieldEditor release], fieldEditor = nil; + if (fieldEditor) SPClear(fieldEditor); fieldEditor = [[SPFieldEditorController alloc] init]; -- cgit v1.2.3 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/SPTableContentDelegate.m') 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 From 9537631e044312f6639c14b0dc5ba158ca3d3ff8 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 13 Apr 2015 16:27:15 +0200 Subject: Fix a previous commit not catching all cases. --- Source/SPTableContentDelegate.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Source/SPTableContentDelegate.m') diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index 19bbc4b3..4d7bbb04 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -263,7 +263,14 @@ // Retrieve the column definition NSDictionary *columnDefinition = [cqColumnDefinition objectAtIndex:[[tableColumn identifier] integerValue]]; - + + // 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; + } + // Open the editing sheet if required if ([tableContentView shouldUseFieldEditorForRow:rowIndex column:[[tableColumn identifier] integerValue] checkWithLock:NULL]) { @@ -347,13 +354,6 @@ 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