mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Move alert panel for archive upgrade to delegate
This commit is contained in:
parent
f78f1e5425
commit
c39c54d62d
4 changed files with 28 additions and 11 deletions
|
@ -150,6 +150,19 @@
|
|||
}
|
||||
|
||||
// Gorm specific methods...
|
||||
- (BOOL) shouldUpgradeOlderArchive
|
||||
{
|
||||
NSInteger retval = NSRunAlertPanel(_(@"Compatibility Warning"),
|
||||
_(@"Saving will update this gorm to the latest version \n"
|
||||
@"which may not be compatible with some previous versions \n"
|
||||
@"of GNUstep."),
|
||||
_(@"Save"),
|
||||
_(@"Don't Save"), nil, nil);
|
||||
|
||||
return (retval == NSAlertDefaultReturn);
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isInTool
|
||||
{
|
||||
return NO;
|
||||
|
|
|
@ -3344,27 +3344,24 @@ static void _real_close(GormDocument *self,
|
|||
id<GormWrapperBuilder> builder = [[GormWrapperBuilderFactory sharedWrapperBuilderFactory]
|
||||
wrapperBuilderForType: type];
|
||||
NSFileWrapper *result = nil;
|
||||
id delegate = [NSApp delegate];
|
||||
|
||||
/*
|
||||
* Warn the user, if we are about to upgrade the package.
|
||||
*/
|
||||
if(isOlderArchive && [filePrefsManager isLatest])
|
||||
{
|
||||
NSInteger retval = NSRunAlertPanel(_(@"Compatibility Warning"),
|
||||
_(@"Saving will update this gorm to the latest version \n"
|
||||
@"which may not be compatible with some previous versions \n"
|
||||
@"of GNUstep."),
|
||||
_(@"Save"),
|
||||
_(@"Don't Save"), nil, nil);
|
||||
if (retval != NSAlertDefaultReturn)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
else
|
||||
BOOL result = [delegate shouldUpgradeOlderArchive];
|
||||
|
||||
if (result == YES)
|
||||
{
|
||||
// we're saving anyway... set to new value.
|
||||
isOlderArchive = NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
// Check if we are in the app or the tool
|
||||
- (BOOL) isInTool;
|
||||
- (BOOL) shouldUpgradeOlderArchive;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -35,6 +35,12 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) shouldUpgradeOlderArchive
|
||||
{
|
||||
NSLog(@"Upgrading archive to latest version of .gorm format");
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSDictionary *) parseArguments
|
||||
{
|
||||
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
|
||||
|
|
Loading…
Reference in a new issue