Changeset 2139
- Timestamp:
- Jun 17, 2007, 5:50:33 PM (15 years ago)
- Location:
- branches/file_selection/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/file_selection/macosx/Controller.h
r2100 r2139 105 105 106 106 - (void) openFiles: (NSArray *) filenames; 107 - (void) openFiles: (NSArray *) filenames ignoreDownloadFolder: (BOOL) ignore forceDeleteTorrent: (BOOL) delete; 107 - (void) openFiles: (NSArray *) filenames forcePath: (NSString *) path ignoreDownloadFolder: (BOOL) ignore 108 forceDeleteTorrent: (BOOL) delete; 109 - (void) openCreatedFile: (NSNotification *) notification; 108 110 - (void) openFilesWithDict: (NSDictionary *) dictionary; 109 111 - (void) openFilesAsk: (NSMutableArray *) files forceDeleteTorrent: (BOOL) delete; -
branches/file_selection/macosx/Controller.m
r2137 r2139 416 416 [nc addObserver: self selector: @selector(updateDockBadge:) 417 417 name: @"DockBadgeChange" object: nil]; 418 419 //open newly created torrent file 420 [nc addObserver: self selector: @selector(openCreatedFile:) 421 name: @"OpenCreatedTorrentFile" object: nil]; 418 422 419 423 //timer to update the interface every second … … 634 638 NSString * path = [[fPendingTorrentDownloads objectForKey: [[download request] URL]] objectForKey: @"Path"]; 635 639 636 [self openFiles: [NSArray arrayWithObject: path] ignoreDownloadFolder:640 [self openFiles: [NSArray arrayWithObject: path] forcePath: nil ignoreDownloadFolder: 637 641 ![[fDefaults stringForKey: @"DownloadChoice"] isEqualToString: @"Constant"] forceDeleteTorrent: YES]; 638 642 … … 646 650 - (void) application: (NSApplication *) app openFiles: (NSArray *) filenames 647 651 { 648 [self openFiles: filenames ignoreDownloadFolder: NO forceDeleteTorrent: NO]; 649 } 650 651 - (void) openFiles: (NSArray *) filenames ignoreDownloadFolder: (BOOL) ignore forceDeleteTorrent: (BOOL) delete 652 [self openFiles: filenames forcePath: nil ignoreDownloadFolder: NO forceDeleteTorrent: NO]; 653 } 654 655 - (void) openFiles: (NSArray *) filenames forcePath: (NSString *) path ignoreDownloadFolder: (BOOL) ignore 656 forceDeleteTorrent: (BOOL) delete 652 657 { 653 658 NSString * downloadChoice = [fDefaults stringForKey: @"DownloadChoice"]; 654 if (ignore || [downloadChoice isEqualToString: @"Ask"])659 if (ignore || (!path && [downloadChoice isEqualToString: @"Ask"])) 655 660 { 656 661 [self openFilesAsk: [filenames mutableCopy] forceDeleteTorrent: delete]; … … 658 663 } 659 664 660 if ( [fDefaults boolForKey: @"UseIncompleteDownloadFolder"]665 if (!path && [fDefaults boolForKey: @"UseIncompleteDownloadFolder"] 661 666 && access([[[fDefaults stringForKey: @"IncompleteDownloadFolder"] stringByExpandingTildeInPath] UTF8String], 0)) 662 667 { … … 682 687 return; 683 688 } 684 if ( [downloadChoice isEqualToString: @"Constant"]689 if (!path && [downloadChoice isEqualToString: @"Constant"] 685 690 && access([[[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath] UTF8String], 0)) 686 691 { … … 713 718 if (!(torrent = [[Torrent alloc] initWithPath: torrentPath forceDeleteTorrent: delete lib: fLib])) 714 719 continue; 715 720 716 721 //add it to the "File > Open Recent" menu 717 722 [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: [NSURL fileURLWithPath: torrentPath]]; 718 719 NSString * folder = [downloadChoice isEqualToString: @"Constant"] 720 ? [[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath] 721 : [torrentPath stringByDeletingLastPathComponent]; 723 724 NSString * folder; 725 if (path) 726 folder = path; 727 else if ([downloadChoice isEqualToString: @"Constant"]) 728 folder = [[fDefaults stringForKey: @"DownloadFolder"] stringByExpandingTildeInPath]; 729 else 730 folder = [torrentPath stringByDeletingLastPathComponent]; 722 731 723 732 [torrent setDownloadFolder: folder]; … … 729 738 730 739 [self updateTorrentsInQueue]; 740 } 741 742 - (void) openCreatedFile: (NSNotification *) notification 743 { 744 NSDictionary * dict = [notification userInfo]; 745 [self openFiles: [NSArray arrayWithObject: [dict objectForKey: @"File"]] forcePath: [dict objectForKey: @"Path"] 746 ignoreDownloadFolder: NO forceDeleteTorrent: NO]; 747 [dict release]; 731 748 } 732 749 … … 754 771 - (void) openFilesWithDict: (NSDictionary *) dictionary 755 772 { 756 [self openFiles: [dictionary objectForKey: @"Filenames"] 773 [self openFiles: [dictionary objectForKey: @"Filenames"] forcePath: nil 757 774 ignoreDownloadFolder: [[dictionary objectForKey: @"Ignore"] boolValue] 758 775 forceDeleteTorrent: [[dictionary objectForKey: @"Delete"] boolValue]]; … … 844 861 - (void) openFiles: (NSArray *) filenames 845 862 { 846 [self openFiles: filenames ignoreDownloadFolder: NO forceDeleteTorrent: NO];863 [self openFiles: filenames forcePath: nil ignoreDownloadFolder: NO forceDeleteTorrent: NO]; 847 864 } 848 865 … … 872 889 - (void) openFromSheet: (NSDictionary *) dictionary 873 890 { 874 [self openFiles: [dictionary objectForKey: @"Files"] 891 [self openFiles: [dictionary objectForKey: @"Files"] forcePath: nil 875 892 ignoreDownloadFolder: [[dictionary objectForKey: @"Ignore"] boolValue] forceDeleteTorrent: NO]; 876 893 -
branches/file_selection/macosx/CreatorWindowController.m
r2137 r2139 260 260 else 261 261 { 262 #warning add to T 262 #warning make optional 263 NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: fLocation, @"File", 264 [fPath stringByDeletingLastPathComponent], @"Path", nil]; 265 [[NSNotificationCenter defaultCenter] postNotificationName: @"OpenCreatedTorrentFile" object: self userInfo: dict]; 263 266 } 264 267
Note: See TracChangeset
for help on using the changeset viewer.