aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMCopyTable.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/CMCopyTable.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/CMCopyTable.m')
-rw-r--r--Source/CMCopyTable.m92
1 files changed, 43 insertions, 49 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m
index 64875cea..c12e7064 100644
--- a/Source/CMCopyTable.m
+++ b/Source/CMCopyTable.m
@@ -348,70 +348,64 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
//get dragged rows a string of newline separated lines of tab separated fields
//the value in each field is from the objects description method
-- (NSString *)draggedRowsAsTabString:(NSArray *)rows
+- (NSString *)draggedRowsAsTabString
{
- if ( [rows count] > 0 )
- {
- NSArray *columns = [self tableColumns];
- NSUInteger numColumns = [columns count];
- NSIndexSet *selectedRows = [self selectedRowIndexes];
- id dataSource = [self dataSource];
-
- NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
+ NSArray *columns = [self tableColumns];
+ NSUInteger numColumns = [columns count];
+ NSIndexSet *selectedRows = [self selectedRowIndexes];
+ id dataSource = [self dataSource];
+
+ NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
- NSUInteger c;
+ NSUInteger c;
- id rowData = nil;
- NSTableColumn *col = nil;
-
- NSUInteger rowIndex = [selectedRows firstIndex];
+ id rowData = nil;
+ NSTableColumn *col = nil;
+
+ NSUInteger rowIndex = [selectedRows firstIndex];
- while ( rowIndex != NSNotFound )
- {
- rowData = nil;
- for ( c = 0; c < numColumns; c++)
+ while ( rowIndex != NSNotFound )
+ {
+ rowData = nil;
+ for ( c = 0; c < numColumns; c++)
+ {
+ col = [columns objectAtIndex:c];
+ rowData = [dataSource tableView:self
+ objectValueForTableColumn:col
+ row:rowIndex ];
+
+ if ( nil != rowData )
{
- col = [columns objectAtIndex:c];
- rowData = [dataSource tableView:self
- objectValueForTableColumn:col
- row:rowIndex ];
-
- if ( nil != rowData )
- {
- if ([rowData isNSNull])
- [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:SPNullValue]]];
- else if ([rowData isSPNotLoaded])
- [result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]];
- else
- [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
- }
+ if ([rowData isNSNull])
+ [result appendString:[NSString stringWithFormat:@"%@\t", [prefs objectForKey:SPNullValue]]];
+ else if ([rowData isSPNotLoaded])
+ [result appendString:[NSString stringWithFormat:@"%@\t", NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields")]];
else
- {
- [result appendString:@"\t"];
- }
- } //end for each column
-
- if ( [result length] )
+ [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
+ }
+ else
{
- [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
+ [result appendString:@"\t"];
}
- [result appendString: [ NSString stringWithFormat:@"\n"]];
-
- // next selected row
- rowIndex = [selectedRows indexGreaterThanIndex: rowIndex];
-
- } //end for each row
+ } //end for each column
if ( [result length] )
{
[result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
}
- return result;
- }
- else
+ [result appendString: [ NSString stringWithFormat:@"\n"]];
+
+ // next selected row
+ rowIndex = [selectedRows indexGreaterThanIndex: rowIndex];
+
+ } //end for each row
+
+ if ( [result length] )
{
- return nil;
+ [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
}
+
+ return result;
}
/*