Automatically disable the Delete button in the Xtras Manager if no item is selected...
[adiumx.git] / Source / RAFBlockEditorPlugin.m
blob694d9f00be6949fa4479966d0de5ce6dbd959758
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/AIAccountController.h>
15 #define PRIVACY_SETTINGS [AILocalizedString(@"Privacy Settings","Privacy Settings menu item") stringByAppendingEllipsis]
17 @implementation RAFBlockEditorPlugin
19 - (void)installPlugin
21         //Install the Block menu items
22         blockEditorMenuItem = [[NSMenuItem alloc] initWithTitle:PRIVACY_SETTINGS
23                                                                                                           target:self
24                                                                                                           action:@selector(showEditor:)
25                                                                                            keyEquivalent:@"p"];
26         [blockEditorMenuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
27         [[adium menuController] addMenuItem:blockEditorMenuItem toLocation:LOC_Adium_Preferences];
30 - (void)uninstallPlugin
32         [blockEditorMenuItem release];
35 - (BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
37         BOOL             retVal = NO;
38         AIAccount        *account;
39         NSEnumerator *enumerator;
41         enumerator = [[[adium accountController] accounts] objectEnumerator];
42         while ((account = [enumerator nextObject]) && !retVal) {
43                 if([[account statusObjectForKey:@"Online"] boolValue] &&
44                    [account conformsToProtocol:@protocol(AIAccount_Privacy)])
45                         retVal = YES;
46         }
48         return retVal;
51 - (IBAction)showEditor:(id)sender
53         [RAFBlockEditorWindowController showWindow];
55 @end