summaryrefslogtreecommitdiff
path: root/QSDeliciousPrefPane.m
blob: f0dde4e9a9dadf4597ba4120116c4cda9af4d69e (plain)
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


#import "QSDeliciousPrefPane.h"
#import <QSCore/QSResourceManager.h>

@implementation QSDeliciousPrefPane
- (id)init {
    self = [super initWithBundle:[NSBundle bundleForClass:[QSDeliciousPrefPane class]]];
    if (self) {
    }
    return self;
}

- (NSImage *) icon{
	return [[NSBundle bundleForClass:[self class]] imageNamed:@"del.icio.us"];
}

- (NSString *) mainNibName{
	return @"QSDeliciousPrefPane";
}

- (void)awakeFromNib{
	NSString *account=[[NSUserDefaults standardUserDefaults] objectForKey:@"QSDeliciousUserName"];
	NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://%@@del.icio.us/",account]];
	NSString *password=[url keychainPassword];
	if (account)[userField setStringValue:account];
	if (password)[passField setStringValue:password];	
}

- (IBAction)savePassword:(id)sender{
	NSString *account=[userField stringValue];
	NSString *pass=[passField stringValue];

	NSURL *url=[NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%@@del.icio.us/",account,pass]];
	if ([pass length])
		[url addPasswordToKeychain];
}

@end