Add delegate method to handle when the archive is from a newer version of Gorm

This commit is contained in:
Gregory John Casamento 2023-07-18 13:52:39 -04:00
parent c39c54d62d
commit 2e14ad8951
4 changed files with 28 additions and 9 deletions

View file

@ -162,6 +162,23 @@
return (retval == NSAlertDefaultReturn);
}
- (BOOL) shouldLoadNewerArchive
{
NSInteger retval = NSRunAlertPanel(_(@"Gorm Build Mismatch"),
_(@"The file being loaded was created with a newer build, continue?"),
_(@"OK"),
_(@"Cancel"),
nil,
nil);
/*
if(retval != NSAlertDefaultReturn)
{
// close the document, if the user says "NO."
[self close];
}
*/
return (retval == NSAlertDefaultReturn);
}
- (BOOL) isInTool
{

View file

@ -435,20 +435,15 @@ static NSImage *fileImage = nil;
{
NSInteger version = [filePrefsManager version];
NSInteger currentVersion = [GormFilePrefsManager currentVersion];
id delegate = [NSApp delegate];
if(version > currentVersion)
{
NSInteger retval = NSRunAlertPanel(_(@"Gorm Build Mismatch"),
_(@"The file being loaded was created with a newer build, continue?"),
_(@"OK"),
_(@"Cancel"),
nil,
nil);
if(retval != NSAlertDefaultReturn)
BOOL result = [delegate shouldLoadNewerArchive];
if (result == NO)
{
// close the document, if the user says "NO."
[self close];
}
}
}
DESTROY(infoData);
}

View file

@ -55,6 +55,7 @@
// Check if we are in the app or the tool
- (BOOL) isInTool;
- (BOOL) shouldUpgradeOlderArchive;
- (BOOL) shouldLoadNewerArchive;
@end

View file

@ -41,6 +41,12 @@
return YES;
}
- (BOOL) shouldLoadNewerArchive
{
NSLog(@"Refusing to load archive since it is from a newer version of Gorm/gormtool");
return NO;
}
- (NSDictionary *) parseArguments
{
GormDocumentController *dc = [GormDocumentController sharedDocumentController];