mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
Add delegate method to handle when the archive is from a newer version of Gorm
This commit is contained in:
parent
c39c54d62d
commit
2e14ad8951
4 changed files with 28 additions and 9 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
// Check if we are in the app or the tool
|
||||
- (BOOL) isInTool;
|
||||
- (BOOL) shouldUpgradeOlderArchive;
|
||||
- (BOOL) shouldLoadNewerArchive;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue