aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPContentFilterManager.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-04 15:17:48 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-04 15:17:48 +0000
commit1ff1b7dd89dfbea772964f347dd43755b5d7d738 (patch)
treedafd7bf91368077fe07ff49f259b03c386260e15 /Source/SPContentFilterManager.m
parent313c5bc247548319dc1f93c9ece04ea4326d37e8 (diff)
downloadsequelpro-1ff1b7dd89dfbea772964f347dd43755b5d7d738.tar.gz
sequelpro-1ff1b7dd89dfbea772964f347dd43755b5d7d738.tar.bz2
sequelpro-1ff1b7dd89dfbea772964f347dd43755b5d7d738.zip
• replaced the (10.4) deprecated [NSTableView tableView:writeRows:toPasteboard:] method by [NSTableView tableView:writeRowsWithIndexes:toPasteboard:]
• some code cosmetics
Diffstat (limited to 'Source/SPContentFilterManager.m')
-rw-r--r--Source/SPContentFilterManager.m18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index 35896fcc..cdf7ee1f 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -605,11 +605,11 @@
/**
* Return whether or not the supplied rows can be written.
*/
-- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray *)rows toPasteboard:(NSPasteboard *)pboard
+- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rows toPasteboard:(NSPasteboard*)pboard
{
NSArray *pboardTypes = [NSArray arrayWithObject:SPContentFilterPasteboardDragType];
- NSInteger originalRow = [[rows objectAtIndex:0] intValue];
+ NSUInteger originalRow = [rows firstIndex];
if(originalRow < 1) return NO;
@@ -656,9 +656,18 @@
if(row < 1) return NO;
NSKeyedUnarchiver *unarchiver = [[[NSKeyedUnarchiver alloc] initForReadingWithData:[[info draggingPasteboard] dataForType:SPContentFilterPasteboardDragType]] autorelease];
- NSArray *draggedRows = [NSArray arrayWithArray:(NSArray *)[unarchiver decodeObjectForKey:@"indexdata"]];
+ NSIndexSet *draggedIndexes = [[NSIndexSet alloc] initWithIndexSet:(NSIndexSet *)[unarchiver decodeObjectForKey:@"indexdata"]];
[unarchiver finishDecoding];
+ // TODO: still rely on a NSArray but in the future rewrite it to use the NSIndexSet directly
+ NSMutableArray *draggedRows = [[NSMutableArray alloc] initWithCapacity:1];
+ NSUInteger rowIndex = [draggedIndexes firstIndex];
+ while ( rowIndex != NSNotFound ) {
+ [draggedRows addObject:[NSNumber numberWithInt:rowIndex]];
+ rowIndex = [draggedIndexes indexGreaterThanIndex: rowIndex];
+ }
+
+
NSInteger destinationRow = row;
NSInteger offset = 0;
@@ -690,7 +699,8 @@
[contentFilterTableView reloadData];
[contentFilterArrayController rearrangeObjects];
-
+ [draggedIndexes release];
+ [draggedRows release];
return YES;
}