[Cocoapsql-developer] commit; Auto set the 'Connect', 'Disconnect' and 'Export' menu items enabled/d
Status: Alpha
Brought to you by:
alkirkus
From: Olaf v. O. <ol...@ad...> - 2002-05-29 19:39:30
|
Auto set the 'Connect', 'Disconnect' and 'Export' menu items enabled/disabled: I added the actions to the first responder of MainMenu.nib menuConnect: menuDisconnect: raiseConnectionSettingsWindow: doExportMenuAction: (for consistancy reasons) and reconnected the Connection-menu items to these actions in the first responder. To auto Enable menuItems, I have made PSQLController the delagate of the mainWindow. Added to PSQLController.m - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { SEL action = [menuItem action]; if (action==@selector(menuConnect:) && [connection connected]) { return NO; } else if (action==@selector(menuDisconnect:) && ![connection connected]) { return NO; } else if (action==@selector(doExportMenuAction:) && ![tableView numberOfRows] > 0) { return NO; } else { return YES; } } |