-
Notifications
You must be signed in to change notification settings - Fork 2
/
TransmissionRemoteAppDelegate.m
45 lines (37 loc) · 1.3 KB
/
TransmissionRemoteAppDelegate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// TransmissionRemoteAppDelegate.m
// TransmissionRemote
//
// Created by Tobias Rundström on 2010-03-13.
// Copyright 2010 Purple Scout. All rights reserved.
//
#import "TransmissionRemoteAppDelegate.h"
#import "PreferencesWindow.h"
#import "TransmissionClient.h"
#import "AboutController.h"
@implementation TransmissionRemoteAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *transmissionServer = [defaults dictionaryForKey:@"transmissionServer"];
if (!transmissionServer) {
NSLog(@"Showing Preferences Windows!");
PreferencesWindow *win = [PreferencesWindow new];
[win showWindow:self];
}
}
-(BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
{
NSLog(@"filename = %@", filename);
[[TransmissionClient client] addTorrentUrl:[NSURL URLWithString:[NSString stringWithFormat:@"file://%@", filename]]];
return YES;
}
-(void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
for (NSString *file in filenames) {
NSLog(@"filename = %@", file);
[[TransmissionClient client] addTorrentUrl:[NSURL URLWithString:[NSString stringWithFormat:@"file://%@", file]]];
}
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
}
@end