Update the icon in the personal preferences if it's changed elsewhere (the contact...
[adiumx.git] / Source / RAFBlockEditorPlugin.m
blob0f383dd376792a7ddc2b84ef5b6f3c7eed61618b
1 //
2 //  RAFBlockEditorPlugin.m
3 //  Adium
4 //
5 //  Created by Augie Fackler on 5/26/05.
6 //  Copyright 2006 The Adium Team. All rights reserved.
7 //
9 #import "RAFBlockEditorPlugin.h"
10 #import <AIUtilities/AIMenuAdditions.h>
11 #import <AIUtilities/AIStringAdditions.h>
12 #import <Adium/AIAccount.h>
13 #import <Adium/AIAccountControllerProtocol.h>
15 @implementation RAFBlockEditorPlugin
17 - (void)installPlugin
19         //Install the Block menu items
20         blockEditorMenuItem = [[NSMenuItem alloc] initWithTitle:[AILocalizedString(@"Privacy Settings", nil) stringByAppendingEllipsis]
21                                                                                                           target:self
22                                                                                                           action:@selector(showEditor:)
23                                                                                            keyEquivalent:@"p"];
24         [blockEditorMenuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
25         [[adium menuController] addMenuItem:blockEditorMenuItem toLocation:LOC_Adium_Preferences];
28 - (void)uninstallPlugin
30         [blockEditorMenuItem release];
33 - (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
35         BOOL             retVal = NO;
36         AIAccount        *account;
37         NSEnumerator *enumerator;
39         enumerator = [[[adium accountController] accounts] objectEnumerator];
40         while ((account = [enumerator nextObject]) && !retVal) {
41                 if([[account statusObjectForKey:@"Online"] boolValue] &&
42                    [account conformsToProtocol:@protocol(AIAccount_Privacy)])
43                         retVal = YES;
44         }
46         return retVal;
49 - (IBAction)showEditor:(id)sender
51         [RAFBlockEditorWindowController showWindow];
53 @end