Changeset 2238
- Timestamp:
- Jun 29, 2007, 11:11:58 PM (15 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.h
r2198 r2238 112 112 - (void) openFilesAskWithDict: (NSDictionary *) dictionary; 113 113 - (void) openShowSheet: (id) sender; 114 115 - (void) duplicateOpenAlert: (NSString *) name; 116 114 117 - (void) openURL: (NSURL *) torrentURL; 115 118 - (void) openURLEndSheet: (id) sender; -
trunk/macosx/Controller.m
r2237 r2238 704 704 Torrent * torrent; 705 705 NSString * torrentPath; 706 tr_info_t info; 706 707 NSEnumerator * enumerator = [filenames objectEnumerator]; 707 708 while ((torrentPath = [enumerator nextObject])) … … 715 716 location = [torrentPath stringByDeletingLastPathComponent]; 716 717 718 if (tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info) == TR_EDUPLICATE) 719 { 720 [self duplicateOpenAlert: [NSString stringWithUTF8String: info.name]]; 721 tr_metainfoFree(&info); 722 continue; 723 } 724 tr_metainfoFree(&info); 725 717 726 if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location forceDeleteTorrent: delete lib: fLib])) 718 727 continue; … … 777 786 { 778 787 torrentPath = [files objectAtIndex: 0]; 779 if (tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info) == TR_OK) 788 canAdd = tr_torrentParse(fLib, [torrentPath UTF8String], NULL, &info); 789 if (canAdd == TR_OK) 780 790 break; 791 else if (canAdd == TR_EDUPLICATE) 792 [self duplicateOpenAlert: [NSString stringWithUTF8String: info.name]]; 793 else; 781 794 782 795 tr_metainfoFree(&info); … … 817 830 { 818 831 NSString * torrentPath = [dictionary objectForKey: @"Path"]; 819 Torrent * torrent = [[Torrent alloc] initWithPath: torrentPath 820 location: [[openPanel filenames] objectAtIndex: 0] 832 Torrent * torrent = [[Torrent alloc] initWithPath: torrentPath location: [[openPanel filenames] objectAtIndex: 0] 821 833 forceDeleteTorrent: [[dictionary objectForKey: @"Delete"] boolValue] lib: fLib]; 822 834 … … 881 893 882 894 [dictionary release]; 895 } 896 897 - (void) duplicateOpenAlert: (NSString *) name 898 { 899 NSAlert * alert = [[NSAlert alloc] init]; 900 [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate alert -> button")]; 901 [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Transfer of \"%@\" is already running.", 902 "Open duplicate alert -> title"), name]]; 903 [alert setInformativeText: 904 NSLocalizedString(@"The torrent file cannot be opened because it is a duplicate of an already running transfer.", 905 "Open duplicate alert -> message")]; 906 [alert setAlertStyle: NSWarningAlertStyle]; 907 908 [alert runModal]; 909 [alert release]; 883 910 } 884 911 … … 1285 1312 Torrent * torrent; 1286 1313 while ((torrent = [enumerator nextObject])) 1287 {1288 1314 [torrent resetCache]; 1289 }1315 1290 1316 #warning reset queue? 1291 1317 } … … 2001 2027 } 2002 2028 2003 NSEnumerator * enumerator; 2004 if (![[fDefaults stringForKey: @"DownloadChoice"] isEqualToString: @"Ask"]) 2005 { 2006 enumerator = [newNames objectEnumerator]; 2007 int count; 2008 while ((file = [enumerator nextObject])) 2009 { 2010 count = [fTorrents count]; 2029 BOOL ask = [[fDefaults stringForKey: @"DownloadChoice"] isEqualToString: @"Ask"]; 2030 2031 NSEnumerator * enumerator = [newNames objectEnumerator]; 2032 int canAdd, count; 2033 while ((file = [enumerator nextObject])) 2034 { 2035 canAdd = tr_torrentParse(fLib, [file UTF8String], NULL, NULL); 2036 if (canAdd == TR_OK) 2037 { 2038 if (!ask) 2039 count = [fTorrents count]; 2011 2040 [self openFiles: [NSArray arrayWithObject: file]]; 2012 2041 2013 2042 //check if torrent was opened 2014 if ( [fTorrents count] > count)2043 if (!ask && [fTorrents count] > count) 2015 2044 [GrowlApplicationBridge notifyWithTitle: NSLocalizedString(@"Torrent File Auto Added", 2016 2045 "Growl notification title") description: [file lastPathComponent] 2017 2046 notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO clickContext: nil]; 2018 2047 } 2019 } 2020 else 2021 [self openFiles: newNames]; 2022 2023 //check if an import fails because of an error so it can be tried again 2024 enumerator = [newNames objectEnumerator]; 2025 while ((file = [enumerator nextObject])) 2026 if (tr_torrentParse(fLib, [file UTF8String], NULL, NULL) == TR_EINVALID) 2048 else if (canAdd == TR_EINVALID) 2027 2049 [fAutoImportedNames removeObject: [file lastPathComponent]]; 2050 else; 2051 } 2028 2052 2029 2053 [newNames release]; -
trunk/macosx/InfoWindowController.m
r2226 r2238 952 952 } 953 953 954 #warning need?955 954 - (void) setFileOutlineHoverRowForEvent: (NSEvent *) event 956 955 {
Note: See TracChangeset
for help on using the changeset viewer.