Hi all,

Our applications support creating new documents from templates. The
current way we do this is to trap attempts to open files of our
template type in -application:openFile:, call the standard
NSDocumentController path as if we were opening that file, but then
send the resulting NSDocument a -becomeUntitledWithType: message that
does the following:

- (void)becomeUntitledWithType:(NSString *)docType {
  [self setFileURL:nil];
  [self setDisplayName:nil];
  [self setFileType:docType];
  [self setAutosavedContentsFileURL:nil];
  [self setDisplayName:nil];
}

I was wondering if this is still sufficient to mimic the creation of a
fresh new document given the new autosave behavior on 10.7, or if
there is more bookkeeping (perhaps on the NSDocumentController side of
things) that I need to take care to reset.

I've been studying the new file saving and loading path: http://db.tt/9yzEKle

The thought had crossed my mind that I'd need to replicate its work in
order to support templates. But it doesn't look like that's
necessarily required, though I'll probably not be able to return YES
from +canConcurrentlyReadDocumentsOfType: when passed my template file
type.

Is there anything I'm missing?

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to