Ensure proper working of autosaving for NSDocument subclasses that

override -writeWithBackupToFile:ofType:saveOperation.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29267 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2010-01-11 21:26:12 +00:00
parent 94c17965b4
commit b89db86a92
2 changed files with 21 additions and 4 deletions

View file

@ -1,6 +1,10 @@
2010-01-11 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSProgressIndicator.m (-setDisplayedWhenStopped): Fix
* Source/NSDocument.m (-writeSafelyToURL:ofType:...): Ensure
proper working of autosaving for subclasses that override
-writeWithBackupToFile:ofType:saveOperation.
* Source/NSProgressIndicator.m (-setDisplayedWhenStopped:): Fix
incorrect assignment which made this method a no-op.
2010-01-11 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -868,15 +868,28 @@ withContentsOfURL: (NSURL *)url
if (OVERRIDDEN(writeWithBackupToFile:ofType:saveOperation:))
{
BOOL isAutosave = NO;
if (op == NSAutosaveOperation)
{
op = NSSaveToOperation;
isAutosave = YES;
}
*error = nil;
return [self writeWithBackupToFile: [url path]
ofType: type
saveOperation: op];
if (![self writeWithBackupToFile: [url path]
ofType: type
saveOperation: op])
{
return NO;
}
if (isAutosave)
{
[self setAutosavedContentsFileURL: url];
[self updateChangeCount: NSChangeAutosaved];
}
return YES;
}
if (!isNativeType || (url == nil))