Replace connections alert panel and move logic to delegate

This commit is contained in:
Gregory John Casamento 2023-07-18 14:01:13 -04:00
parent 2e14ad8951
commit cc34827230
4 changed files with 27 additions and 27 deletions

View file

@ -170,13 +170,23 @@
_(@"Cancel"),
nil,
nil);
/*
if(retval != NSAlertDefaultReturn)
{
// close the document, if the user says "NO."
[self close];
}
*/
return (retval == NSAlertDefaultReturn);
}
- (BOOL) shouldBreakConnectionsForClassNamed: (NSString *)className
{
NSInteger retval = -1;
NSString *title = [NSString stringWithFormat: @"%@",_(@"Modifying Class")];
NSString *msg;
NSString *msgFormat = _(@"This will break all connections to "
@"actions/outlets to instances of class '%@' and it's subclasses. Continue?");
msg = [NSString stringWithFormat: msgFormat, className];
// ask the user if he/she wants to continue...
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
return (retval == NSAlertDefaultReturn);
}

View file

@ -2728,25 +2728,8 @@ static void _real_close(GormDocument *self,
{
NSEnumerator *en = nil;
id<IBConnectors> c = nil;
BOOL removed = YES;
NSInteger retval = -1;
NSString *title = [NSString stringWithFormat: @"%@",_(@"Modifying Class")];
NSString *msg;
NSString *msgFormat = _(@"This will break all connections to "
@"actions/outlets to instances of class '%@' and it's subclasses. Continue?");
msg = [NSString stringWithFormat: msgFormat, className];
// ask the user if he/she wants to continue...
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
if (retval == NSAlertDefaultReturn)
{
removed = YES;
}
else
{
removed = NO;
}
id delegate = [NSApp delegate];
BOOL removed = [delegate shouldBreakConnectionsForClassNamed: className];
// remove all.
if(removed)

View file

@ -56,6 +56,7 @@
- (BOOL) isInTool;
- (BOOL) shouldUpgradeOlderArchive;
- (BOOL) shouldLoadNewerArchive;
- (BOOL) shouldBreakConnectionsForClassNamed: (NSString *)className;
@end

View file

@ -47,6 +47,12 @@
return NO;
}
- (BOOL) shouldBreakConnectionsForClassNamed: (NSString *)className
{
NSLog(@"Breaking connections for instances of class: %@", className);
return YES;
}
- (NSDictionary *) parseArguments
{
GormDocumentController *dc = [GormDocumentController sharedDocumentController];