Changeset 9227 for trunk/macosx/TrackerTableView.m
- Timestamp:
- Oct 1, 2009, 1:15:37 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/TrackerTableView.m
r9220 r9227 25 25 #import "TrackerTableView.h" 26 26 #import "NSApplicationAdditions.h" 27 #import "Torrent.h" 27 28 #import "TrackerNode.h" 28 29 … … 35 36 } 36 37 38 - (void) setTorrent: (Torrent *) torrent 39 { 40 fTorrent = torrent; 41 } 42 37 43 - (void) setTrackers: (NSArray *) trackers 38 44 { … … 40 46 } 41 47 42 - ( IBAction) copy: (id) sender48 - (void) copy: (id) sender 43 49 { 44 50 NSMutableArray * addresses = [NSMutableArray arrayWithCapacity: [fTrackers count]]; … … 72 78 } 73 79 80 - (void) paste: (id) sender 81 { 82 if (!fTorrent) 83 return; 84 85 if ([NSApp isOnSnowLeopardOrBetter]) 86 { 87 NSArray * items = [[NSPasteboard generalPasteboard] readObjectsForClasses: 88 [NSArray arrayWithObject: [NSString class]] options: nil]; 89 NSAssert(items != nil, @"no string items to paste; should not be able to call this method"); 90 91 BOOL added = NO; 92 for (NSString * pbItem in items) 93 { 94 for (NSString * item in [pbItem componentsSeparatedByString: @"\n"]) 95 if ([fTorrent addTrackerToNewTier: item]) 96 added = YES; 97 } 98 99 //none added 100 if (!added) 101 NSBeep(); 102 } 103 } 104 74 105 - (BOOL) validateMenuItem: (NSMenuItem *) menuItem 75 106 { … … 78 109 if (action == @selector(copy:)) 79 110 return [self numberOfSelectedRows] > 0; 111 112 if (action == @selector(paste:)) 113 return [[NSPasteboard generalPasteboard] canReadObjectForClasses: [NSArray arrayWithObject: [NSString class]] options: nil]; 80 114 81 115 return YES;
Note: See TracChangeset
for help on using the changeset viewer.