2 // AFSMenuCredentialContoller.m
5 // Created by Claudio on 14/07/07.
6 // Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
9 #import "AFSMenuCredentialContoller.h"
10 #import "CredentialWindowController.h"
12 #import "AFSPropertyManager.h"
14 @implementation AFSMenuCredentialContoller
16 -(id) initWhitRec:(NSRect)rect afsPropManager:(AFSPropertyManager*)afsPropManager;
19 credentialWindow = nil;
20 afsPropMngr = [afsPropManager retain];
21 NSLog(@"init AFSMenuCredentialContoller");
26 NSLog(@"dealloc AFSMenuCredentialContoller");
27 if(credentialWindow) [credentialWindow release];
34 // calculate the point where show the window
35 NSPoint topLeft = {viewRect.origin.x-160,[[NSScreen mainScreen] frame].size.height-kMenuBarHeight};
36 NSLog(@"viewRect.origin.x=%d, topLeft.x=%d", viewRect.origin.x, topLeft.x);
37 // load the bundle for
38 [NSBundle loadNibNamed:@"CredentialWindow.nib" owner:self];
39 NSLog(@"prepare to open window CredentialWindow");
41 credentialWindow = [[NSWindow alloc] initWithContentRect:[((NSView*) credentialView) frame]
42 styleMask:NSTitledWindowMask /*| NSUtilityWindowMask*/
43 backing:NSBackingStoreBuffered
44 defer:YES screen:[NSScreen mainScreen]];
46 [credentialWindow setTitle:@"Klog"];
47 [credentialWindow setFrameTopLeftPoint:topLeft];
48 [credentialWindow setContentView:credentialView];
49 [credentialWindow makeKeyAndOrderFront:self];
56 NSLog(@"closeWindow");
57 if([(CredentialWindowController*)credWinController takenToken] && afsPropMngr) {
58 [afsPropMngr getTokens:true
59 usr:[(CredentialWindowController*)credWinController uName]
60 pwd:[(CredentialWindowController*)credWinController uPwd]];
61 [afsPropMngr release];
64 [credentialWindow close];
65 credentialWindow = nil;