-
Notifications
You must be signed in to change notification settings - Fork 8
/
WebmailerConfiguration.m
63 lines (48 loc) · 1.5 KB
/
WebmailerConfiguration.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#import "WebmailerConfiguration.h"
#import "WebmailerShared.h"
@implementation ComBelkadanWebmailer_Configuration
@synthesize name, destinationURL, active;
- (id)initWithName:(NSString *)givenName destination:(NSString *)givenDestination
{
self = [super init];
if (!self) return nil;
self.name = givenName;
self.destinationURL = givenDestination;
return self;
}
- (id)init
{
return [self initWithName:@"" destination:@""];
}
- (id)initWithDictionaryRepresentation:(NSDictionary *)dict
{
self = [self initWithName:[dict objectForKey:WebmailerDestinationNameKey] destination:[dict objectForKey:WebmailerDestinationURLKey]];
if (!self) return nil;
self.active = [[dict objectForKey:WebmailerDestinationIsActiveKey] boolValue];
return self;
}
#pragma mark -
- (NSDictionary *)dictionaryRepresentation
{
return [NSDictionary dictionaryWithObjectsAndKeys:
self.name, WebmailerDestinationNameKey,
self.destinationURL, WebmailerDestinationURLKey,
(self.active ? [NSNumber numberWithBool:YES] : nil), WebmailerDestinationIsActiveKey,
nil];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"<WebmailerConfiguration: %@>", self.name];
}
- (void)dealloc
{
[name release];
[destinationURL release];
[super dealloc];
}
#pragma mark -
- (NSScriptObjectSpecifier *)objectSpecifier
{
return [[[NSNameSpecifier alloc] initWithContainerClassDescription:[NSScriptClassDescription classDescriptionForClass:[NSApp class]] containerSpecifier:nil key:@"destinations" name:self.name] autorelease];
}
@end